PlatformIO Community

Problem downloading on STM32F103C8T6(bluepill) + STM32duino-bootloader + mbed framework ower microusb port and dfu protocol

There was a problem loading the project onto the STM32F103C8T6 (bluepill) board. The STM32duino-bootloader bootloader is uploaded to it.
Used by VSCode + PlatformIO. The firmware is loading through the microUsb of the board itself.

When creating a LED flashing project using the arduino framework, everything is loading and works.

platformio.ini

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = dfu

task output


Configuring upload protocol…
AVAILABLE: blackmagic, dfu, jlink, serial, stlink
CURRENT: upload_protocol = dfu
Looking for upload port…
Auto-detected: COM3
Uploading .pio\build\genericSTM32F103C8\firmware.bin
maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]…
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=398
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
error resetting after download: usb_reset: could not reset device, win error: Указано несуществующее устройство.
Done!

Resetting USB to switch back to runtime mode
================ [SUCCESS] Took 8.61 seconds ================

When creating a LED flashing project using the mbed framework, an error occurs when loading.

platformio.ini

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = mbed
upload_protocol = dfu

task output


Configuring upload protocol…
AVAILABLE: blackmagic, dfu, jlink, serial, stlink
CURRENT: upload_protocol = dfu
Uploading .pio\build\genericSTM32F103C8\firmware.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Match vendor ID from file: 1eaf
Match product ID from file: 0003
No DFU capable USB device available
*** [upload] Error 74
=============== [FAILED] Took 6.40 seconds ===============

Where is the mistake? How to upload a project to the board?

You can upload firmware using STLINK

Yes, I’m sure this option will work. But I would like to try directly, without stlink.
After all, for arduino-framervork it works.

Doesn’t mbed-os bring its own bootloader? That’s what I read from https://os.mbed.com/docs/mbed-os/v5.15/tutorials/bootloader.html.

When building for mbed-os, it probably doesn’t handle the modified application start address in flash, so you’re overwriting your USB bootloader after the first upload. If that’s the case the USB bootloader device “STM32duino bootloader v1.0” shouldn’t appear in the device manager anymore. Is that the case?

Did you get mbed-os + stm32 duino bootloader working outside of PlatformIO?

1 Like

The project assembled from the future has not yet been loaded, so I can’t say whether it overwrites the STM32duino bootloader or not.
Outside the platform, I did not try the bundle of STM32duino bootloader + mbed-os. Perhaps they are not compatible?