STM32 is a 32bit ARM cortex microcontroller and normally we need USB to TTL module or ST-link stick to dump program to its memory. So, here in this project i will teach you how to flash USB bootloader in STM32 microcontroller so that we can program it with direct USB port from Arduino IDE.
Things you will need:
- STM32 board. (Black pill or Blue pill)
2. USB to serial converter ( TTL module) (3.3v compatible)
3. 3.3v power supply to power the board (or separate 5v micro USB cable would work )
- Download the suitable boot-loader binary file from given download link. If you don’t know which binary file will suits your black-pill, then simply trace its LED pin track and notice its pin number. This same pin number binary file you will have to flash into your board.
- Put your black-pill board on serial programming mode by setting boot0 pin high and boot1 pin low.
- Connect black-pill board to serial converter as shown in circuit diagram and connect serial connector to your computer USB port.
- Download Flash Loader Demonstrator program to flash the boot-loader into black-pill.
- Open up Flash Loader Demonstrator and follow the steps. Reference snapshots are as shown bellow..
- After finishing flashing process you will get conformation message as shown in the reference image. After that you need to change the board programming mode to normal by replacing the jumpers as previous, without switching off the board power.
Follow step 1 to 3 same as windows procedure and then use the following command to flash the boot-loader binary into your board. Change the path and file name according to your binary file.
Change the serial programming mode to normal by changing the jumper setting as previous, without switching of the power supply.