Trinket M0 Physical Pin Mapping with Arduino IDE
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adolfor
- Posts: 10
- Joined: Wed Mar 13, 2013 6:23 pm
Trinket M0 Physical Pin Mapping with Arduino IDE
I am having difficulty understanding how a physical pin number is identified in the variant.cpp PinDescription array. Is there a detailed explaination on the Trinket M0 variant.cpp definition which can clarify the physical pin to arduino pin association?
- adafruit_support_carter
- Posts: 29153
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Trinket M0 Physical Pin Mapping with Arduino IDE
Physical pins where? On the SAMD microprocessor? On the Trinket M0 header pins?
- adolfor
- Posts: 10
- Joined: Wed Mar 13, 2013 6:23 pm
Re: Trinket M0 Physical Pin Mapping with Arduino IDE
Physical pins on the ATSAM21DE18A processor. I am just seeking a deeper understanding on how hardware processor pins map to Arduino pins. I read a description in a post that indicated the processor pin number is the row index of the pinDescription array but when I used that description on the Trinket M0 variant.cpp pinDescription array, it only correlated to processor pin 13 for PA10 which is connected to drive the Red LED on the board or D13. I created the table below from the Trinket M0 documentation to help me understand the relationship:
Physical ATSAMD21E18A Pin Port+Pin Function Trinket M0 Breakout
1 PA00 XTALIN RGB LED-C1/D7
2 PA01 XTALOUT RGB LED-D1/D8
3 PA02 AIN0/VOUT D1/A0
4 PA03 AIN1
5 PA04 AIN4
6 PA05 INT5
7 PA06 AIN6/SERCOM D4/A4/PWM/UART TX/SPI MOSI
8 PA07 AIN7/SERCOM D3/A3/PWM/UART RX/SPI SCK
9 VDD_ANA VCC 3.3 V
10 GND_ANA GND
11 PA08 SERCOM D0/A2/I2C(SDA)
12 PA09 SERCOM D2/A1/PWM/SPI MISO/I2C(SCL)
13 PA10 D13/SERCOM LED-RED/D13
14 PA11 SERCOM
15 PA14 SERCOM
16 PA15 SERCOM
17 PA16 SERCOM
18 PA17 SERCOM
19 PA18 SERCOM
20 PA19 SERCOM
21 PA22 SERCOM
22 PA23 SERCOM
23 PA24 SERCOM
24 PA25 SERCOM
25 PA27 INT15
26 /RESET
27 PA28 INT8
28 GND GND
29 VDDCORE 1 uF
30 VCC VCC 3.3 V
31 PA30 SWCLK Secret SWCLK
32 PA31 SWDIO Secret SWDIO
Physical ATSAMD21E18A Pin Port+Pin Function Trinket M0 Breakout
1 PA00 XTALIN RGB LED-C1/D7
2 PA01 XTALOUT RGB LED-D1/D8
3 PA02 AIN0/VOUT D1/A0
4 PA03 AIN1
5 PA04 AIN4
6 PA05 INT5
7 PA06 AIN6/SERCOM D4/A4/PWM/UART TX/SPI MOSI
8 PA07 AIN7/SERCOM D3/A3/PWM/UART RX/SPI SCK
9 VDD_ANA VCC 3.3 V
10 GND_ANA GND
11 PA08 SERCOM D0/A2/I2C(SDA)
12 PA09 SERCOM D2/A1/PWM/SPI MISO/I2C(SCL)
13 PA10 D13/SERCOM LED-RED/D13
14 PA11 SERCOM
15 PA14 SERCOM
16 PA15 SERCOM
17 PA16 SERCOM
18 PA17 SERCOM
19 PA18 SERCOM
20 PA19 SERCOM
21 PA22 SERCOM
22 PA23 SERCOM
23 PA24 SERCOM
24 PA25 SERCOM
25 PA27 INT15
26 /RESET
27 PA28 INT8
28 GND GND
29 VDDCORE 1 uF
30 VCC VCC 3.3 V
31 PA30 SWCLK Secret SWCLK
32 PA31 SWDIO Secret SWDIO
- westfw
- Posts: 2008
- Joined: Fri Apr 27, 2007 1:01 pm
Re: Trinket M0 Physical Pin Mapping with Arduino IDE
Essentially, there is no relationship between the "Arduino Pins" and the physical pins on the chip.Physical pins on the ATSAM21DE18A processor.
the pinDescription array maps from the Arduino Pin number (which usually has a number spot on the board, at BOARD level, that is BOARD and chip dependent) to a Port and bit, and then you have to refer to the chip data sheet to see which physical chip pin is connected to that Port/Bit.
I have a big spreadsheet here: https://docs.google.com/spreadsheets/d/ ... sp=sharing
Whether a pin uses the alternate function(s) available on that pin is dependent on your code.
I'm preparing a whole [s]flame[/s] Functional Specification on "ulPinType in g_APinDesciption considered useless, and probably harmful." :-(
(Slowly, since I'm afraid no one will listen. Sigh.)
- adafruit_support_carter
- Posts: 29153
- Joined: Tue Nov 29, 2016 2:45 pm
Re: Trinket M0 Physical Pin Mapping with Arduino IDE
Yep. That describes it well. That'd be the "Pin mux" table in the datasheet. For example, PA10 may show up on different physical pins for different package variants (if there are any variants).to a Port and bit, and then you have to refer to the chip data sheet to see which physical chip pin is connected to that Port/Bit.
Specific to the Trinket M0, can also use the schematic:
https://learn.adafruit.com/adafruit-tri ... nt-2910649
The port/bit's are labeled for each physical pin.
- adolfor
- Posts: 10
- Joined: Wed Mar 13, 2013 6:23 pm
Re: Trinket M0 Physical Pin Mapping with Arduino IDE
Thank you - this clarifies it - the spreadsheet is quite helpful and more comprehensive than the table I put together.
- westfw
- Posts: 2008
- Joined: Fri Apr 27, 2007 1:01 pm
Re: Trinket M0 Physical Pin Mapping with Arduino IDE
I should caution that it has not been carefully verified for correctness, or completeness. (typically I get bored by the time I hit the timers.)the spreadsheet is quite helpful
But the ability to sort the rows by chip pin, board pin, or GPIO port is very useful!
Please be positive and constructive with your questions and comments.