From STM32duino wiki
Jump to: navigation, search

F103 boards

F103 boards are cheap and readily available in all shapes and sizes. The F103 chips are available in a convenient QFP48 package as used on the Maple Mini and Pill Boards.

There are also some GD32F103 boards featuring code and pin compatible chips from GigaDevice.

F4 boards

F4 boards offer even more power than F1 boards, but are a little more expensive. F4 boards currently only receive limited support and are recommended for experienced users only.

Other STM32 Chips

F0, F2, F3 and F7 chips are not currently supported by the libmaple core. See information on the new HAL MX core.

Pin Maps

The source files that relate pin numbers to internal microcontroller ports can, for example with the Blue Pill board, be found in:


The pin number is the element number of the PIN_MAP array in the board.cpp file corresponding to the desired processor port pin (not necessarily the number of the pin on the physical circuit board). In the board.cpp file for the blue pill board for example, pin PA0 is the first line of the PIN_MAP array and is thus element zero of the PIN_MAP array (i.e. PIN_MAP[0]), so pin number 0 corresponds to PA0. Pin PB0 is the 17th line of the PIN_MAP array, or element PIN_MAP[16] and so pin 16 corresponds to PB0. For the blue pill board.cpp file, PC13 is the 33rd line in the PIN_MAP array so pin 32 corresponds to PC13.

An analogRead() line of Arduino code to read pin PB1 on a blue pill board could be written like this:

   int analogValueB1 = analogRead(17);

Although it would probably be better to define a name for pin 17 something like this before the setup block:

   #define ADCPINPB1 = 17;

To set pin PC15 (element PIN_MAP[34] ) HIGH on a blue pill board after putting it in write mode, you could use:

   digitalWrite(34, HIGH);

If an example sketch code refers to say, pin 17 on a maple mini, and you've got a blue pill, then you have to look at the board.cpp file for the maple mini to find out what processor port is referred to on the PIN_MAP[17] line, which happens to be PB6 for the Maple Mini, and find the corresponding line of the PIN_MAP array in the blue pill board.cpp file, which for PB6 is PIN_MAP[22]. So in the example code you would change the 17 to 22.

For the original Arduinos, the pin maps can be found in:


But they use a different format.