Skip to main content

Pin Mapping

Every DUELink module utilizes a unified pin mapping system, sharing identical features and hardware limitations. To simplify development, the GPIO numbering is abstracted, meaning the pin numbers you use in code do not correspond one-to-one with the physical pins on the underlying microcontroller.


Standard Lib Pins

The DUELink system features automatic pin configuration. It intelligently detects which standard library function is being called and automatically handles the necessary mapping and configuration for that specific pin behind the scenes.

For example, Dwrite(1, level) will automatically change pin 1 to output and 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

tip

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 equipped with alternate 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.

System Timers

System timers are used by some of the standard library functions plus for generating PWM signals, for example when using AWritre(), Servo(), or Freq().

Timers can control more than one pin. They are listed here with their used pins:

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

Pins that share the same timer will share the same frequency, but will always have an independent duty-cycle. For example, changing the frequency on P2 will also change the frequency on P1. This is not an issue of both pins are used to dim LEDs, but will be an issue of P1 is used ot dim an LED but P2 is connected to a buzzer.

When designing a module, we use different timers for different functionalities.


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 a 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.