Flashing Blue Pill (STM32F103) bootloader

From Tom's notes
Revision as of 00:44, 24 April 2018 by Tom (talk | contribs) (Created page with "Started off using following guide: https://medium.com/@paramaggarwal/programming-an-stm32f103-board-using-usb-port-blue-pill-953cec0dbc86 However, still didn't seem to work,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Started off using following guide: https://medium.com/@paramaggarwal/programming-an-stm32f103-board-using-usb-port-blue-pill-953cec0dbc86

However, still didn't seem to work, always got following errors in dmesg:

usb 3-1: new full-speed USB device number 122 using xhci_hcd
usb 3-1: device descriptor read/64, error -71
usb 3-1: device descriptor read/64, error -71
usb 3-1: new full-speed USB device number 123 using xhci_hcd
usb 3-1: device descriptor read/64, error -71
usb 3-1: device descriptor read/64, error -71
usb 3-1: new full-speed USB device number 124 using xhci_hcd
usb 3-1: Device not responding to setup address.
usb 3-1: Device not responding to setup address.
usb 3-1: device not accepting address 124, error -71
usb 3-1: new full-speed USB device number 125 using xhci_hcd
usb 3-1: Device not responding to setup address.
usb 3-1: Device not responding to setup address.
usb 3-1: device not accepting address 125, error -71
usb usb3-port1: unable to enumerate USB device

Workaround was to first perform an erase step and follow it up with a verify just for good measure:

python ./stm32loader -p /dev/tty.SLAB_USBtoUART -e ./generic_boot20_pc13.bin
python ./stm32loader -p /dev/tty.SLAB_USBtoUART -w ./generic_boot20_pc13.bin
python ./stm32loader -p /dev/tty.SLAB_USBtoUART -v ./generic_boot20_pc13.bin

Keep BOOT0=1 and BOOT1=0. Reset between each step just in case.

When resetting bot jumpers to 0 and resetting the fast/slow flashing worked and the device was seen on USB.

Direct links:

Make sure to verify the bootloader was downloaded and not just some HTML page.