I have been trying to get my Giga arduino board to load from PlatformIO (on VS Code) all night. I have the “No DFU” problem, and cannot find a resolution.
I have Arduino IDE installed and it works fine.
I have tried “reloading” the bootloader on the Giga, using STLINK, and it doesn’t help.
I have tried putting the board in reset mode (double press RST button, pulsing LED), doesn’t help.
I’ve tried everything I can find in the community post, but I still get this:
Configuring upload protocol…
AVAILABLE: cmsis-dap, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = dfu
Looking for upload port…
Auto-detected: COM3
Forcing reset using 1200bps open/close on port COM3
Waiting for the new upload port…
Uploading .pio\build\giga_r1_m7\firmware.bin
dfu-util 0.11-arduino4
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
No DFU capable USB device available
*** [upload] Error 74
The board resets during the upload process, so it’s clear that through the the process there is some interaction with the board. Just no update.
I would be interested in ANY ideas. I’d really like to move away from Arduino IDE, but this is my first attempt at PlatformIO and it’s almost give up time for me…
While some flag values are equivalent, the Arduino IDE uses a slightly older version of dfu-util.
I would advise:
Check that upload still works in the Arduino IDE. (Pointless otherwise)
In the Arduino IDE, activate File → Prefrences → Show verbose output during “upload”
Upload again. You should get a command string like above.
Copy over C:\Users\<user>\AppData\Local\Arduino15\packages\arduino\tools\dfu-util\0.10.0-arduino1/dfu-util (or whatever path it showed) into C:\Users\jimpo.platformio\packages\tool-dfuutil-arduino\ to replace the dfu-util binary.
Interesting point… when I try to run the exact same command line from the ArduinoIDE output on a command prompt, I get the same “no DFU” found message.
Somehow when the command is run the in the IDE environment it can connect to the board. But outside that environment, it does not.
One other interesting note… on the Arduino output it show the upload port as COM4
*Performing 1200-bps touch reset on serial port COM3*
*Waiting for upload port...*
*Upload port found on COM4*
The device is on COM3. The app that I’m using just to test the upload is a simple touchscreen app that sends the location of the touch to the serial port.
I can monitor COM3 and see the output, but the upload from ArduinoIDE is COM4.
It is correct that bootloader / DFU mode is only entered when opening the serial port at 1200bps shortly before upload. However, PlatformIO is also instructed to do that.
Max - first… thank you for your help today! It’s really been great!
Yes, the bootloaders always.
But I think I’m getting closer to the problem… which seems to be the differences in the command lines.
PlatformIO.uses the following dfu-util switch: -d 0x2341:0x0366,0x2341:0x0266,0x2341:0x0466
This switch identifies the device, and the device I have is the first one: 0x2341:0x0366
For some reason, identifying 3 devices in the line causes dfu-util to NOT find the device.
But if I put the board in boot mode (double press RST button), and go to the CLI line using the same command but remove the last 2 devices in the -d description… it works.
So I seem to have an answer… but how can I tell PlatformIO to ONLY call out the 0x2341 device?
Looking at the device tab in PlatformIO, it correctly identifies the device: USB VID:PID=2341:0266 SER=003E00393033510734323437
But for some reason, it wants to try and include the other two devices.
I now have a new issue and wanted to add to this thread for others that may be having issues.
When I attempt to upload to my GIGA board when it’s running existing code, everything works fine.
But if I put the board in DFU mode (which is needed when a code issue causes the board to fail and blink the red light) it will not upload properly.
I reset the board by pressing the RST button twice, putting it in DFU mode.
When I try to upload, I get the following error:
…
Auto-detected: COM5
*** [upload] Cannot configure port, something went wrong. Original message: PermissionError(13, ‘A device attached to the system is not functioning.’, None, 31)
If I then load good code to the board (like an example sketch using Arduino IDE, which works fine), then attempt to upload again from VS Code while the good code is running, I get:
…
Auto-detected: COM4
Forcing reset using 1200bps open/close on port COM4
Waiting for the new upload port…
Uploading .pio\build\giga_r1_m7\firmware.bin
…
This works fine.
If I put the board back in DFYU mode, the Arduino IDE shows me this:
…
Performing 1200-bps touch reset on serial port COM4
Waiting for upload port…
Upload port found on COM5
…
Any ideas on why the VS code upload process doesn’t properly “touch reset” ?
Both processes are using dfu-util 0.10-dev.