I get this particular dfu error as well but the flashed program works.
Here’s why I reckon this happens: If you use STM Cube Programmer to upload the program via DFU, there’s a flag you can set whether the program automatically launches upon completed flash. If you set that, the DFU resets and is disconnected, resulting in an error message in STM Cube Programmer also (the program is unable to see the DFU now because it was rebooted and launched the program you flashed). The behaviour of the commandline DFU upload seems similar.
Read this thread about community efforts to get things working with PlatformIO.
My best results so far have been to write and edit code in VSC, then compile with make
and upload with make program-dfu
. This way you’ll have nice editing with context highlighting and side by side windows etc. but the last step is command line which is very quick and easy enough.
Or maybe you’ll read the thread and just find the missing piece in the compile-from-VSC puzzle! If you do so, please share!