A world leader in providing the semiconductor solutions that make a positive contribution to people’s lives, both today and in the future.


General rules

  • The list of available pins per peripheral are defined in the PeripheralPins.c file.
  • The list of all pins definitions are defined in the PinNames.h file.
  • These files are available in mbed-os\targets\TARGET_STM\TARGET_STM32xxx\TARGET_STM32xxx\TARGET_xxx
  • You can find also a link to this folder path above the pinout image on the platform page on

If you look at the pinout image:

  • Only the labels written in blue/white or green/white (i.e. PA0_4, PB_5, LED1, USER_BUTTON, ...) must be used in your code.
  • Other labels like IOREF, VIN, NRST, Serial1 TX, Analog In, etc... are power and alternate-function pins. They cannot be used in your code.
  • Additional labels can also be used like SERIAL_TX, SERIAL_RX, etc... See the PinNames.h file for more detail.
  • Alternate pins (Px_y_ALTz) are not displayed.

Alternate pins (Px_y_ALTz)

The pins mentioned Px_y_ALTz (described in the PeripheralPins.c/PinNames.h files) are alternative possibilities which use other HW peripheral instances.

For example PA_7 can be associated to UART1 and PA_7_ALT0 to UART2

You can use them the same way as any other "normal" pin

PwmOut pwm(PA_7_ALT0);
DigitalOut control_io(PA_6_ALT1);
Serial connect(PA_9_ALT0, PA_10_ALT1);

Warning: When you select two pins for a I2C, SPI or Serial... object, you must take care that the "ALT" pins use the same HW peripheral, otherwise you will get a build error. All these pins are described in the PeripheralPins.c file.

Note that these pins are not displayed on the board pinout image on

PWMx/y pins

  • The first number x represents theTimer number, the second number y represents the Channel number.

Example: PWM2/3 means that you use the channel 3 of Timer 2.

  • The letter N after the second number y means that it is the complementary of channel y (the channel is inverted).

Example: PWM16/1N means that you use the complementary signal of Timer 16 Channel 1.

  • A normal channel and its complementary channel will have the same frequency and the same duty cycle. Only their waveform will be inverted.

Example: PWM1/1 and PWM1/1N

  • All the PWMx pins have the same frequency as they use the same Timer.

Example: PWM2/1 and PWM2/3 will have the same frequency as they both use the Timer 2. But a different duty-cycle can be output on these two pins because they are on two different channels. If you want different frequencies you must used for example PWM1/1 and PWM2/1 instead.

All wikipages