Arduino HAT Carrier RPI to Arduino IDE Pin Mapping
I have collected all these links into a Bookmarks folder. 😄
Thank you for this information! Maybe I can dissect all this information and get us all much needed reference. 😄
29 Replies
The SAI pins on the rpi header are on the J2 HD connector and can be used as 78, 79, 80 and 81 in Arduino code -> https://docs.arduino.cc/resources/pinouts/ABX00074-full-pinout.pdf
This should be the full pinout for the rpi header which you can use in your Arduino code:
Thank you! I will add these to my file and do some testing to see if I can access them.
Some of these pins are not going to map correctly to the connector.

Which pins? It is upside down compared to the Portenta pinout. Could be confusing.
I know. I think I understand how it works now. Are those pin numbers from the Portenta MCU?
The numbers I posted here (https://discord.com/channels/420594746990526466/1206334029931094047/1206340529105670184) are from the Portenta MCU.
Ah, OK. That is important information. Now, I can properly label that column. 😉 I think a spread sheet is in order... 😉
We have a total of 25 pin now. Are these all guaranteed to be routed to the RPI Connector??
Yeah, the HD connectors plug into the hat carrier which connects those pins to the raspberry pi header.
You can actually see them all here on the HD connector pinouts (J1 and J2): https://docs.arduino.cc/resources/pinouts/ABX00074-full-pinout.pdf
Ah, OK. That does not tell me anything about the RPI Connector though. I understand the naming convention now though, which is good. 🙂
It only covers the MKR compatible pins on the board.
You might want to change the title of this thread to something like "Arduino HAT Carrier RPI to Arduino IDE Pin Mapping"
I created an image with the numbers. @HybridRobotix

Very nice! 😄
I received an email from Arduino with the following:
I need to experiment and see if this really gives us what we need.
https://docs.arduino.cc/resources/pinouts/ASX00049-full-pinout.pdf
And this:
https://docs.arduino.cc/hardware/portenta-hat-carrier/#features
Those documents in addition to this one (https://docs.arduino.cc/resources/pinouts/ABX00074-full-pinout.pdf) are how I got the numbers for the image. They also align with the array indices here: https://github.com/arduino/ArduinoCore-renesas/blob/main/variants/PORTENTA_C33/variant.cpp#L40, so they should work in your code with pinMode, digitalWrite, etc.
I used the BSP* designations in my sketch and it compiled! Now, I have to see if I can access the hardware pins. 😄
However, I think using these designations in sketches is highly undesirable and unfriendly, so I think we need a friendlier pin mapping for Arduino.
I still need to do some thinking on this.
You can just use the numbers from the image I created (https://discord.com/channels/420594746990526466/1206334029931094047/1206350354069856346).

I need to do this my way. 😉
I am almost done making a sample header file with MKR pins so you can see what I have in mind. I will get that off to you in an hour or so. 😉
I need more I/O than what is available on the MKR compatible pins, so I need to access Raspberry Pi Compatible pins on the 40-pin connector.
I am also going to need this when I get the Raspberry Pi robot controller I am going to use for this robot.
https://www.amazon.com/gp/product/B0BX539VH1/ref=ox_sc_saved_image_3?smid=A1N1A77RUX51FT&psc=1
This is just a sample of what I am working on. I still need to add the rest of the pins on the Raspberry Pi header.
Yahboom Multifunctional Development Board for Raspberry Pi Jetson N...
Yahboom Multifunctional Development Board for Raspberry Pi Jetson Nano Building ROS1 ROS2 Robot Expansion Board with 9-axis IMU Sensor STM32F103C8T6 Core (ROS Expansion Board)
I am confused. I think there is some communication failure here.
I labeled every pin on the 40 pin header in the image I made.
BSP_IO_PORT_01_PIN_05 is already defined as D0 in the renesas arduino core.
You don't need to create these defines.
The arduino core takes care of everything with the pin mux configuration here: https://github.com/arduino/ArduinoCore-renesas/blob/main/variants/PORTENTA_C33/variant.cpp#L40
All you need are the numbers in the image I made to use the pins on the 40 pin header.
You can use the numbers directly.
For example this will set the I2S SDI pin on the 40 pin header to high logic level:
Users should be able to use familiar pin names for the pins they want to use. This also serves as part of the documentation for a sketch. Users should not have to look up what "pin 65" is. This lets users and readers know immediately that D65 is being used as a digital I/O. Maybe somebody wants to use a UART on the Rasberry Pi connector of the Arduino HAT Carrier, they would not be able to make their pin selections easily.
As it is now, I can not tell which pins are associated with the Arduino HAT Carrier except those on the MKR pins. I need to know exactly which pins are associated with pins on the Raspberry Pi connector, which go from 1 to 40 and also have pneumonic names that should be usable. The pin designations might be something like "HAT_<RPi neumonic name such as GPIO12_32>." Proper Raspberry Pi pin naming must be used.
I see, so something like this?
That should cover both rpi pinouts and the hat carrier pinout.
Should make things easier when you've got it all done.
I will leave you to it. 😄
Yes, this is pretty much what I have been thinking about. I want to keep the pin names as short as possible and still keep all the needed information. 😉
I still need to know which pins are on the HAT connector and which Raspberry Pi pins they map to. 😉
I will continue to work on this.
If you flip the RPI pinout image here upside down and compare to the hat carrier image with the numbers, that should give you everything you need.
https://fossbytes.com/wp-content/uploads/2021/04/gpio-pins-raspberry-pi-4-e1617866771594.png
For example:
I2S SDI is GPIO 20 (PCM_DIN) and that is pin 65 on the Portenta C33.
TX1 is GPIO 12 (PWM 0) which is pin 92 on the Portenta C33.
@HybridRobotix
OK, let me see. Is the pin number on the Portenta the same as the D<number> pins?
If this is true then I have everything I need to finish this very quickly. 😉
More tomorrow because I have all day to work on this uninterrupted. 😄 😄 I am exhausted and must have sleep now.
Yes, the same as the D numbers in the Arduino core and these numbers here.
https://docs.arduino.cc/resources/pinouts/ABX00074-full-pinout.pdf

There is still no association with the pins on the Arduino HAT Carrier. I am trying to figure out how to get this information most easily but it looks like I will need a schematic to trace the lines. I will see if I can get this information from the Arduino people.
These are the pins on the Arduino HAT Carrier.

Here are the pin numbers for the 16 pin header as well.

Oh, um, yes, I see that now. I apologize for my denseness. 😉 😄 My brain has been on vacation and does not want to come back. 😉 😄
No worries. It happens. 😂