For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setting up STM32

Follow the steps bellow to setup programming STM32 microcontrollers with the Arduino IDE (Option 1, top) or Visual Studio and Platform IO (Option 2, bottom).

Prepare

1

Install the STM32CubeProgrammer to upload to the STM32 microcontroller (available for Windows and MacOS 64 bit).

Check the troubleshoot page if you experience issues with installing the STM32CubeProgrammer on MacOS

2

Install the Dependencies

The RESET button on the STM32 micrcontroller needs to be pressed after switching between BOOT and RUN mode in order to read the change

Option 1: Arduino IDE

1

Open Preferences > Additional Boards Manager URLs

2

Add a new line with the following URL: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

Additional Boards Manager URLs window
3

Open the Boards Manager from the Tools menu.

4

Search for 'STM32 MCU based boards' and click INSTALL v2.12.0

5

Update the Board Settings in the Tools menu

  • Set board to 'Generic STM32F4 series'

  • Board part number to 'Generic F401RETx'

  • Upload method to 'STM32CubeProgrammer (DFU)'

  • USB support to 'CDC (generic 'Serial' supersede U(S)ART)'

  • U(S)ART support to 'Disabled (no Serial support)'

  • USB speed to 'Low/Full Speed'

Arduino IDE Board Settings

The USB Serial port does not have to be specified (having one specified should not cause any problems either).

6

Now you are ready to upload your program using the upload button in the Arduino IDE

After uploading the Arduino IDE or Platform IO will enable RUN mode automatically. If the board has been RESET or disconnected from the POWER, the switch should be manually changed to RUN mode in order to run the program.

After manually switching to RUN mode press the RESET button on the STM32 microcontroller.

The program should be running now, if not check out the troubleshoot page.

Press the RESET button when the device is not recognized by the computer. Make sure the switch is set to RUN mode.

Option 2: Visual Studio & Platform IO

1

Add STM32 boards (search for ST STM)

2

When starting a new project, select STM32F401RE with framework Arduino

Visual Studio Project Board Settings
3

Make sure the settings in the platform.ini file are as follows

4

Upload your program using the upload button in Visual Studio

After uploading the Arduino IDE or Platform IO will enable RUN mode automatically. If the board has been RESET or disconnected from the POWER, the switch should be manually changed to RUN mode in order to run the program.

After manually switching to RUN mode press the RESET button on the STM32 microcontroller.

The program should be running now.

Press the RESET button when the device is not recognized by the computer. Check out the troubleshoot page when issues persist.

Last updated

Was this helpful?