riscv-mcu / gd32-dfu-utils

Dfu-utils GD32 fork.
GNU General Public License v2.0
42 stars 11 forks source link

"Cannot open DFU device 28e9:0189" #2

Open maxgerhardt opened 4 years ago

maxgerhardt commented 4 years ago

I've bought a Wio Lite RISC-V (https://www.seeedstudio.com/Wio-Lite-RISC-V-GD32VF103-p-4293.html) with a GD32VF103CBT6 chip on it. I've installed the "MCU Drivers" in the "MCU tool" package listed under https://gd32mcu.21ic.com/en/index.

The USB device successfully appears in the device manager when it is connected in the BOOT0 = 1 position.

grafik

However when attempting to a upload a firmware file generated by PIO (or any), the program is unable to open the USB device

C:\Users\Maxi\Desktop>dfu-util -d 28e9:0189 -a 0 --dfuse-address 0x08000000:leave -D "C:\Users\Maxi\Documents\PlatformIO\Projects\risv5_test\.pio\build\wio_lite_risc-v\firmware.bin"
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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/

Cannot open DFU device 28e9:0189
No DFU capable USB device available

Since you have not printed the error return value (or its string help text) in the code

https://github.com/riscv-mcu/gd32-dfu-utils/blob/c2c8215061b08146e6a4c8c22bc57fae95c656df/src/dfu_util.c#L218-L220

I have no idea why opening failed or what I have to do.

Also, the device doesn't appear in Zadig so I can't load libusb drivers for it

The only upload method which works is by the "GigaDevice Dfu Tool" linked above.

grafik

So uploading via USB DFU works in general. Did I misconfigure the tool or is something wrong with the tool?

flxzt commented 4 years ago

I am experiencing the same thing. I cant load the libusb drivers in Zadig either. Did you find a solution in the meantime?

maxgerhardt commented 4 years ago

Hm I tried using libusb-win32-bin-1.2.6.0.zip from https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/ to install a libusb-win32 filter for the USB device. It said it could install the filter successfully but then the device fails to re-enumerate and is shown as "Unknown USB device (requesting device descriptor failed)"

grafik

grafik

So I'm still at a loss on how to properly install a libusb filter for the device. I'd like to try this method

https://www.smallcab.net/download/programme/xm-07/how-to-install-libusb-driver.pdf

But the inf-wizard.exe just crashes for after being executed..

maxgerhardt commented 4 years ago

Whoa I have no idea what I did but I used the the above libusb-win32 filter and pressed the reset button shortly after the installer wants to reset the device, and after that I still have the same device in the device manager, but dfu-util now says

C:\Users\Maxi\Desktop\Neuer Ordner>dfu-util -d 28e9:0189 -a 0 --dfuse-address 0x08000000:leave -D "C:\Users\Maxi\Documents\PlatformIO\Projects\risv5_test\.pio\build\wio_lite_risc-v\firmware.bin"
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 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/

Opening DFU capable USB device...
ID 28e9:0189
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
GD32 flash memory access detected
Device model: GD32VF103CB
Memory segment (0x08000000 - 0801ffff)(rew)
Erase size 1024, page count 128
Downloading to address = 0x08000000, size = 11084
Download        [=========================] 100%        11084 bytes
Download done.
File downloaded successfully
Error sending dfu abort request

But exiting the DFU mode fails and also the new firmware doesn't seem to be running (still the one from the last really succesful upload). So it's still a fail.

jribesgo commented 4 years ago

Hi! I was on the same page as you, and I was able to solve this issue by manually installing the WinUSB driver and by locally compiling the current version of dfu-util in the git dev branch. I have roughly documented the process here. Hope it helps!

stanleyseow commented 4 years ago

Same issues as above, I tried to follow the above instructions, I got lost in installation of the winUSB part ...

Pls help ...

ezoia-com commented 4 years ago

@jribesgo Thanks! Followed your process recompiling and replacing the dfu-util by PlatformIO, I'm now able to use the VSCode IDE to build and upload. I still get "Error during download get_status" but the code seems to run fine.

ggggxiaolong commented 3 years ago

I have the same problem in Ubuntu and solve it by add file /etc/udev/rules.d/70-ttyusb.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", MODE="0666"
SUBSYSTEM=="usb_device", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", MODE="0666"

then replug usb