To program the Black Pill, you can use the UART(bootloader) or ST-Link. In addition, you can also use the USB interface, but you need burn the USB bootloader to it in advance. The procedure to work Black Pill with Arduino IDE and USB interface is shown below
1. Burn USB Bootloader
a. Set the BOOT1/BOOT0 as 0/1
b. Prepare a USB-2-UART cable and connect PA9/RX, PA10/TX, +3.3V and ground
c. Download and install ST flash loader; download black pill firmware(generic_boot20_pb12.bin)
d. Start ST flasher loader and upload the firmware
** The setting and connection between Black Pill and USB-2-UART cable need assign properly, otherwise the flash loader program will not go the burn process. The connection and operation menu is displayed.
** The setting and connection between Black Pill and USB-2-UART cable need assign properly, otherwise the flash loader program will not go the burn process. The connection and operation menu is displayed.
a. Get Arduino_STM32 from github and put it over
"C:\Users\<login username>\Documents\Arduino\hardware"
(my example C:\Users\vincentlee\Documents\Arduino\hardware\Arduino_STM32)
b. run "C:\Users\vincentlee\Documents\Arduino\hardware\Arduino_STM32\drivers\win\install_drivers.bat"
to install the driver or you will see error in Arduino upload.
c. Start the Arduino IDE to select and check the Black Pill is supported. The "Get Board Info" menu can show the board information
d. Load the "blink" example, edit the indication LED pin to "PB12" for Black Pill
e. Set the BOOT1/BOOT0=0/0 to boot for flash memory and connect the Black Pill thru USB
f. Compile and upload the Sketch to Black Pill
If the "blink" Sketch is uploaded properly, it will turn-on the LED for 3 sec and turn-off LED for 1 sec continuously.
If the DFU driver is not installed in procedure 2/b, then the error message
"Couldn't find the DFU device:[1EAF:0003]" is displayed and the upload process failed.
STM = the vendor, STMicroelectronics
32 = 32-bit, i.e. ARM series
F103 = model, “F1” also indicates that this is an ARM Cortex M3
C = 48-pins
8 = flash memory size is 64 KB(B series with 128KB flash and it seems share the same dice as 8 series)
T = package type is LQFP
6 = temperature range -40 to +85 °C
2. BOOT1/BOOT0 selection
From ST's datasheet, it worked as
3. The board's COM port is not shown in programming
Sometimes, the used-to-work Black Pill is not function properly to show the COM port anymore. You can try to reset the board or load again the DFU driver again as procedure 2/b
4. reference link
a. Roger Clark's github
https://github.com/rogerclarkmelbourne
b. stm32duino wiki
http://wiki.stm32duino.com/index.php?title=Black_Pill
http://wiki.stm32duino.com/index.php?title=Blue_Pill
http://wiki.stm32duino.com/index.php?title=Maple_Mini
http://wiki.stm32duino.com/index.php?title=Red_Pill
"C:\Users\<login username>\Documents\Arduino\hardware"
(my example C:\Users\vincentlee\Documents\Arduino\hardware\Arduino_STM32)
b. run "C:\Users\vincentlee\Documents\Arduino\hardware\Arduino_STM32\drivers\win\install_drivers.bat"
to install the driver or you will see error in Arduino upload.
c. Start the Arduino IDE to select and check the Black Pill is supported. The "Get Board Info" menu can show the board information
d. Load the "blink" example, edit the indication LED pin to "PB12" for Black Pill
e. Set the BOOT1/BOOT0=0/0 to boot for flash memory and connect the Black Pill thru USB
f. Compile and upload the Sketch to Black Pill
If the "blink" Sketch is uploaded properly, it will turn-on the LED for 3 sec and turn-off LED for 1 sec continuously.
If the DFU driver is not installed in procedure 2/b, then the error message
"Couldn't find the DFU device:[1EAF:0003]" is displayed and the upload process failed.
Q&A
1. STM32F103C8T6 part number naming ruleSTM = the vendor, STMicroelectronics
32 = 32-bit, i.e. ARM series
F103 = model, “F1” also indicates that this is an ARM Cortex M3
C = 48-pins
8 = flash memory size is 64 KB(B series with 128KB flash and it seems share the same dice as 8 series)
T = package type is LQFP
6 = temperature range -40 to +85 °C
2. BOOT1/BOOT0 selection
From ST's datasheet, it worked as
Boot mode selection pins | Boot mode | Aliasing | Note | |
BOOT1 | BOOT0 | |||
x | 0 | Main Flash memory | Main Flash memory is selected as boot space | USB bootloader burned to work with Arduino IDE |
0 | 1 | System memory | System memory is selected as boot space |
USART bootloader |
1 | 1 | Embedded SRAM | Embedded SRAM is selected as boot space |
SRAM boot for debug |
3. The board's COM port is not shown in programming
Sometimes, the used-to-work Black Pill is not function properly to show the COM port anymore. You can try to reset the board or load again the DFU driver again as procedure 2/b
4. reference link
a. Roger Clark's github
https://github.com/rogerclarkmelbourne
b. stm32duino wiki
http://wiki.stm32duino.com/index.php?title=Black_Pill
http://wiki.stm32duino.com/index.php?title=Blue_Pill
http://wiki.stm32duino.com/index.php?title=Maple_Mini
http://wiki.stm32duino.com/index.php?title=Red_Pill