Aloha Folks,
I am able to successfully flash a STM32 Blue Pill board with the Arduino bootloader using a FTDI board and the STMicroelectronics ‘Flash Loader Demonstrator’. After doing that, I am able to upload an Arduino sketch using the Arduino IDE and verify that the blink program is running using PC13.
However, when uploading using VSCode and PlatformIO, the terminal shows a successful upload but the board is rendered useless as the LED on PC 13 is not blinking but on continuously and the board shows up as an ‘unknown device’ in Windows Device Manager as opposed to the ‘Maple Serial’ device, requiring me to have to re-flash the board again with the generic_boot20_pc13.bin file.
Resources were:
https://donneyfan.com/blog/usb-serial-for-blue-pill-stm32-with-platformio
https://community.platformio.org/t/platformio-on-vscode-for-stm32-stm32f103-bluepill-with-the-arduino-framework-cannot-upload-via-usb-dfu-bootloader/16393
My platformio.ini is as follows:
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
monitor_speed = 115200
upload_port = COM15
upload_protocol = dfu
…and the last bit of the terminal window after uploading:
Linking .pio\build\bluepill_f103c8_128k\firmware.elf
Checking size .pio\build\bluepill_f103c8_128k\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 3.9% (used 808 bytes from 20480 bytes)
Flash: [= ] 9.5% (used 12460 bytes from 131072 bytes)
Building .pio\build\bluepill_f103c8_128k\firmware.bin
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, stlink
CURRENT: upload_protocol = dfu
Looking for upload port...
Using manually specified: COM15
Uploading .pio\build\bluepill_f103c8_128k\firmware.bin
maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]...
Reset via USB Serial Failed! Did you select the right serial port?
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...
Found it!
Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0 Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=255
Starting download: [##################################################] finished!
error resetting after download: usb_reset: could not reset device, win error: A device which does not exist was specified.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
timeout waiting for COM15 serial
I’m not sure what to try now, any suggestions would be helpful.