Skip to content

Compile and flash for STM32F1xx boards

Eric Stockenstrom edited this page Jan 7, 2022 · 3 revisions

To build and flash AntTracker in the Arduino IDE for a STM32 Blue pill, follow these steps:

In the Arduino IDE, click on File, then Preferences, then open the Additional Boards Manager URLs, add this line:

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

and click OK

Now navigate to Tools, Boards, Boards Manager

and search for STM32

Install the latest core forSTM32 MCU based boards

Now click on Tools along the top line, then select Boards and "STM32 board groups (Boards .. number)", then click on "Generic STM32F1 series"

Go back to Tools, and now select Board part number: "BluePill F103CB (or C8 with 128k)"

Go back to Tools, and now select "U(S)ART support: Enabled (no generic 'Serial')"

The reason for this is that the default setting results in both Serial and Serial1 using the same UART. Right now I'm not sure why this happens, but I will try to track it down. To get 'round this obvious problem, we map the "serial" identifiers(s) to UART numbers ourselves in the code.

We will use the STMCubeProgrammer to upload and flash our firmware, so again select Tools, then Upload method: "STM32CubeProgrammer (Serial)

If you have not installed the STMCubeProgrammer on your system, it may be downloaded here

Finally, click Tools, then Port to select the correct serial port for your upload.

Clone this wiki locally