PlatformIO Community

Can not upload to Blue Pill using dfu


#1

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.
Thanks,
John


#2

Did you hack the resistor R10 or is it already correct? https://wiki.stm32duino.com/index.php?title=Blue_Pill#Known_issues


#3

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


#4

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

new: https://github.com/stm32duino/Arduino_Core_STM32
old: https://github.com/rogerclarkmelbourne/Arduino_STM32

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.


#5

Please file an issue here https://github.com/platformio/platform-ststm32/issues