platformio / platform-ststm32

ST STM32: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/ststm32
Apache License 2.0
405 stars 312 forks source link

Posible error with dfu-util UPLOADERFLAGS "No DFU capable USB device available" #794

Closed pmmarquez closed 1 month ago

pmmarquez commented 3 months ago

With the Arduino Nicla Vision i was having this issue:

dfu-util: No DFU capable USB device available
*** [upload] Error 74

I tracked it down to this line in builder/main.py:

_upload_flags = [
    "-d", ",".join(["%s:%s" % (hwid[0], hwid[1]) for hwid in hwids]),
    "-a", "0", "-s",
    "%s:leave" % board.get("upload.offset_address", "0x08000000"), "-D"
]

Changing the "," by " " to join the hwids was the solution:

_upload_flags = [
    "-d", " ".join(["%s:%s" % (hwid[0], hwid[1]) for hwid in hwids]),
    "-a", "0", "-s",
    "%s:leave" % board.get("upload.offset_address", "0x08000000"), "-D"
]

I don't know if this is a general issue or is just related with my system, I tested in both Windows and Linux(WSL), I also don't have any other boards to test at the moment, but hopefully this helps other people with the same issue.

valeros commented 3 months ago

Hi @pmmarquez,

How did you come up with the idea of using " " instead of ","? The official manual page for dfu-util suggests using , for separating several device IDs.

pmmarquez commented 3 months ago

Hi @pmmarquez,

How did you come up with the idea of using " " instead of ","? The official manual page for dfu-util suggests using , for separating several device IDs.

I tried different variants directly in the command line and only with space worked out, later I changed in builder/main.py and that solved the issue for me

denblock commented 3 months ago

I had the same problem on Windows with the Arduino GIGA.

Using " " instead of "," as the seperator also worked for me.

cheddarwhizzy commented 3 months ago

Trying to run an example sketch from the Arduino IDE via PlatformIO using Arduino Giga Display Shield + R1 Giga Wifi on OSX yielded the same result. Had to remove all except the first array under hwids from ~/.platformio/platforms/ststm32/boards/giga_r1_m7.json as per this comment - after doing that, I was able to pio run -t upload successfully. Works fine in Arduino IDE as-is, but PIO didn't work w/o this change for me.

zulu8k commented 2 months ago

I have the same problem with the Arduino Giga. I am using macos, platformio 6.1.15 / 3.4.4 with CLion. I have reproduced the issue with the command line. The comma is not the cause, but a symptom. The upload always fails if more than one device ID is specified. The suggestion from @pmmarquez, causes only one device ID to be transferred and masks the actual problem.

bu5hm4nn commented 2 months ago

I ran into the same issue as @zulu80 with my Arduino Giga. I ended up editing giga_r1_m7.json and removing all device id's but the first. Then it worked. Please fix.

EvanRobinson commented 1 month ago

Me3 on the same problem as @zulu80 and @bu5hm4nn with the Giga R1 WiFi working on the Mac (M2 Max MacBookPro, 14", 32GB , Sonoma 14.4.1), PIO 6.1.16 / 3.4.4.

Edited giga_r1_m7.json as well, problem appears solved.

Please fix.