Can not upload to Blue Pill using dfu

After hours of working on this I’m here for help. I have two boards of the same vendor. I have loaded the dfu into each. I can load programs into them using the Arduino IDE.

In PlatformIO it appears to find the ‘Maple DFU’(1EAF:0003) ok, but then when it issues the command to reset as a ‘com’ something goes wrong. Win10 enumerates it as 'Unknown USB Device (Device Descriptor Request Failed). At this point the program has failed to load. Resetting the device causes Win10 to again detect it as ‘Maple DFU’.

At this point trying to upload a second time yields -
“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…”

Using Arduino to upload, I get “Couldn’t find the DFU device: [1EAF:0003]”, unless I press reset before it times out. Pressing reset allows the Arduino IDE to load the program and make it a com port.

Now that it is a com port PlatformIO will start the upload, resets it, but Win10 once again lists it as an Unknown device.

Please help.

Did you hack the resistor R10 or is it already correct?

Yes I did. That is not the issue though. Remember it works with the Arduino IDE just fine.

It’s now working after several more hours of fiddling. After I stumbled on the solution I found the reason why from @Braiden


The old core supports the DFU (rogerclarkmelbourne/STM32duino-bootloader) bootloader I’m using. The newer core does not. Switching variants had the side effect of switching cores which is why my code started running.

By default PlatformIO selects ‘Arduino_Core_STM32’, it does not support dfu(usb). Adding ‘board_build.variant = BLUEPILL_F103XX’ to ‘platformio.ini’ causes PlatformIO to use the other core ‘Arduino_STM32’. This one does support dfu and everthing works fine.

PlatformIO should not give you the option of using ‘dfu’ for uploading with the blue pill and the ‘Arduino_Core_STM32’ which it defaults to, since it can’t possibly work.

1 Like

Please file an issue here Issues · platformio/platform-ststm32 · GitHub

Hold on, can you please explain the solution in more detail? I seem to be having the same issue.

If I’m understanding the history of this right, back in December (v4.6.0) there was a change from the STM32 Arduino core maintained by Roger Clark, to the official STM32duino core. As per the docs, the official STM32duino core is used by default. It seems from John’s observations that the official STM32 core doesn’t support DFU/USB updates - or at least without updating the bootloader? Hence the need to set the board_build.core parameter in platformio.ini in order to revert to the old core.

Thankfully this has been found out by others before I pulled my own STM32 blue pills out again for a project!!! :slight_smile:

Hrm. I just tried that. Now, it doesn’t compile. (STM32F1 Blue Pill stuck in DFU mode after upload)

Please update to the latest ST STM32 dev/platform and use docs ST STM32 — PlatformIO latest documentation

You need to switch to Maple Core.

1 Like

I’m sorry, but was this answer a response to my plea or the OP’s?

To yours very likely. Your problem should be directly linked to the (non) usage of the maple core so you’ll need to switch to the maple core.

1 Like