-
-
Notifications
You must be signed in to change notification settings - Fork 342
Description
Describe the bug
I am attempting to upload firmware to a genericSTM32F407VET6 board using the arduino framework via the dfu protocol. The upload fails, but PlatformIO provides a misleading error message ("No DFU capable USB device available"), masking the actual cause.
Root Cause Analysis
By running the dfu-util command manually in the terminal, I discovered the real error: The build system automatically appends a DFU Suffix for a Maple device (1eaf:0003), but the actual hardware is a standard STM32 DFU device (0483:df11). dfu-util correctly identifies the device but refuses to upload due to the File ID mismatch.
To Reproduce
platformio.ini:
[env:genericSTM32F407VET6]
platform = ststm32
board = genericSTM32F407VET6
framework = arduino
upload_protocol = dfu1. PlatformIO Output (Misleading)
When clicking "Upload" in VSCode, PIO output suggests no device is found:
Looking for upload port...
...
No DFU capable USB device available
*** [upload] Error 1
2. Manual CLI Output (The Truth)
When running the exact same command manually in PowerShell, dfu-util finds the device but rejects the file:
PS C:\git-program\Embedded\stm32f407> dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D .pio\build\genericSTM32F407VET6\firmware.bin
Opening DFU capable USB device...
Device ID 0483:df11
...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
Error: File ID 1eaf:0003 does not match device (0483:df11 or 0483:df11)Expected behavior
- The build script for
genericSTM32F407VET6should NOT append the1eaf:0003suffix by default, OR it should append the correct0483:df11suffix. - PlatformIO should pass through the actual
dfu-utilerror message ("File ID mismatch") instead of swallowing it and claiming no device is available.
Environment
- OS: Windows 10/11
- Board: Generic STM32F407VET6
- Framework: Arduino
Workaround:
use custom upload_command
upload_command =
dfu-suffix -D $SOURCE
C:\Users\13963\scoop\shims\dfu-util.exe -d 0483:df11 -a 0 -s 0x08000000:leave -D $SOURCE