Skip to main content

Pin Mapping

All DUELink modules share the same pin mapping and any additional pin features and restrictions. Pin GPIO numbers are mapped to be easier to use and are not one-to-one with what underlying micro has.


Standard Lib Pins

The system automatically knows what standard lib function is being used on a specific pin and handles mapping and configuration for that pin.

For example, Dwrite(1, level) will automatically change the pin 1 to output write it to level. Similarly, AWrite(1, 0.33) will change pin 1 to its analog feature (PWM) and then set the duty-cycle to 33%.

While all modules' schematics are provided, extra efforts are made so you do not need to look up any schematics. When using a module that exposes the pins directly, the pin numbers are listed right on the PCB, just like we have them on DueDuino.

DueDuino

The pin closest to reset button is P1 can be set to analog write (PWM) with 66% duty-cycle using AWrite(1, 0.66). Similarly, you can read the voltage on P1 using _v = VRead(1).

Other modules ship with Driver Script. This eliminates the need for accessing pins directly. Samples on using the driver is found on individual modules product pages.


Alternate Functions

All pins support digital input and output. However, some pins have alternate functions.

Pin P0 is always connected to STAT LED. In some rare cases the STAT LED becomes part of an LED matrix.

Pins capable of other functions:

  • Analog: P1, P2, P3, P4, P5, P6, P7, P8, P9, P17.
  • PWM: P0, P1, P2, P3, P4, P5, P6, P7, P8, P11.
  • Interrupt: P1, P2, P3, P4, P5, P6, P7, P12, P20.

Internal System Timers

Internal timers are used by some of the standard library functions, for example when using AWritre(), Servo(), or Freq().

These internal timers share the same timer, but have an independent duty-cycle. When we design module, we try to use different timers for different functionalities. The timers are listed here for a reference.

TimerPins
TIM1P1, P2
TIM2P4, P11
TIM3P5, P6, P7, P8
TIM14P3
TIM16P0 (STAT)

Map Table

This table shows how the official firmware maps the pins internally. This is all automated by the system and should not be used by you, unless you are building special firmware!

DUELink PinST Micro PinAnalogPWMInterruptAlternate Function
0PB8STAT LED
1PA0ADC0T1C1
2PA1ADC1T1C2
3PA4ADC4T14C1
4PA5ADC5T2C1
5PA6ADC6T3C1
6PA7ADC7T3C2
7PA8ADC8T3C3
8PB1ADC18T3C4
9PB0ADC17
10PC15
11PC6T2C3
12PB3SPI CLK
13PB4SPI MISO
14PB5SPI MOSI
15PB6I2C SCL
16PB7I2C SDA
17PB2ADC19
18PB9
19PA15
20PA14LDR / SWDCLK
21PA9Uplink (UART TX)﹡
22PA10Uplink (UART RX)﹡
23PA13ADC13SWDIO
24PC14
25PA2Downlink TX
26PA3Downlink RX
27PF2Reset

﹡These pins are only available for UART when the module has a USB connector and does not need a Uplink JST connector.