sipeed / platform-gd32v

GD32V: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/gd32v
Other
183 stars 46 forks source link

cannot upload over usb-c to sipeed-longan-nano from linux #10

Closed levpaul closed 5 years ago

levpaul commented 5 years ago

Hi there,

I cannot upload to my nano. I'm running arch and have it connected via usb-c. In dmesg I see:

[15912.862725] usb 1-3: new full-speed USB device number 8 using xhci_hcd
[15913.193941] usb 1-3: device descriptor read/64, error -71
[15913.442442] usb 1-3: New USB device found, idVendor=28e9, idProduct=0189, bcdDevice=10.00
[15913.442448] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[15913.442452] usb 1-3: Product: GD32 0x418 DFU Bootloade
[15913.442455] usb 1-3: Manufacturer: GDMicroelectronics
[15913.442457] usb 1-3: SerialNumber: 䌳䩂

I'm worried about the second line above.

this is the output when trying to upload the blink example after deleting my ~/.platformio:

[levi@arch-x1c longan-nano-blink]$ platformio run -e sipeed-longan-nano --target upload  
*******************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for IoT development > https://platformio.org/platformio-ide
- support us with PlatformIO Plus > https://pioplus.com
*******************************************************************************

Processing sipeed-longan-nano (platform: gd32v; framework: gd32vf103-sdk; board: sipeed-longan-nano)
-------------------------------------------------------------------------------
PlatformManager: Installing gd32v
gd32v @ 1.1.0 has been successfully installed!
The platform 'gd32v' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
PackageManager: Installing framework-gd32vf103-sdk @ ~1.0.0
framework-gd32vf103-sdk @ 1.0.0 has been successfully installed!
PackageManager: Installing tool-openocd-gd32v @ ~0.1.1
tool-openocd-gd32v @ 0.1.1 has been successfully installed!
PackageManager: Installing tool-gd32vflash @ ~0.1.0
tool-gd32vflash @ 0.1.0 has been successfully installed!
PackageManager: Installing toolchain-gd32v @ ~9.2.0
Downloading  [####################################]  100%          ^_
Unpacking  [####################################]  100%          
toolchain-gd32v @ 9.2.0 has been successfully installed!
CorePackageManager: Installing tool-scons @ ~3.30101.0
tool-scons @ 3.30101.0 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/gd32v/sipeed-longan-nano.html
PLATFORM: GigaDevice GD32V 1.1.0 > Sipeed Longan Nano
HARDWARE: GD32VF103CBT6 108MHz, 32KB RAM, 128KB Flash
DEBUG: Current (altera-usb-blaster) External (altera-usb-blaster, gd-link, jlink, rv-link, sipeed-rv-debugger, um232h)
PACKAGES: framework-gd32vf103-sdk 1.0.0, tool-openocd-gd32v 0.1.1, tool-gd32vflash 0.1.0, toolchain-gd32v 9.2.0
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Linking .pio/build/sipeed-longan-nano/firmware.elf
Checking size .pio/build/sipeed-longan-nano/firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [=         ]   7.0% (used 2310 bytes from 32768 bytes)
PROGRAM: [=         ]   5.0% (used 6572 bytes from 131072 bytes)
Configuring upload protocol...
AVAILABLE: altera-usb-blaster, gd-link, jlink, rv-link, serial, sipeed-rv-debugger, um232h
CURRENT: upload_protocol = serial
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
===================================================================================================== [FAILED] Took 23.48 seconds =====================================================================================================
[levi@arch-x1c longan-nano-blink]$ 

I'm not sure if I'm supposed to see something in /dev/ttyUSB.... but I don't see any device there. lsusb shows:

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 06cb:00bd Synaptics, Inc. 
Bus 001 Device 002: ID 5986:114e Acer, Inc Integrated Camera
Bus 001 Device 008: ID 28e9:0189 GDMicroelectronics GD32 0x418 DFU Bootloade
Bus 001 Device 004: ID 8087:0aaa Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Not sure what I'm missing.

Update:

Also tried on my desktop running ubuntu 18.04 - Basically the same stuff. Read error in dmesg, lsusb shows device in list but no ttyUSB entry.

levpaul commented 5 years ago

Okay figured it out - I was supposed to use dfu mode for downloading to the board - that's what the usb-c connects to. I guess to do serial downloads you have to use ISP or something? I got blink example to run, so I'm happy!

This topic was my help: https://bbs.sipeed.com/t/topic/1338

Catochi commented 4 years ago

Hey did you do anything else? I'm getting the following

levpaul commented 4 years ago

Are you booting the device in DFU mode? It should show up in your syslog as a DFU device found.

Catochi commented 4 years ago

Thanks for the info. Was missing a few steps before i could program it.

Catochi commented 4 years ago

Are you booting the device in DFU mode? It should show up in your syslog as a DFU device found.

Where did you download the firmware? image

This part specificly

poproar commented 4 years ago

Okay figured it out - I was supposed to use dfu mode for downloading to the board - that's what the usb-c connects to. I guess to do serial downloads you have to use ISP or something? I got blink example to run, so I'm happy!

This topic was my help: https://bbs.sipeed.com/t/topic/1338

Hello @levpaul , I am trying to upload to the SeeedStudio-GD32-RISC-V-Dev-Board

I switched to dfu after installing dfu-util on ubuntu 18.04 no luck then I tried to make install the gd32-dfu-util, seemingly successful and still no go.

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

Your topic listed above is not found and hoping you can shed a little light.

jannst commented 4 years ago

Hi @poproar, i got the same board and had the same problem.

Is there a new device in the output of lsusb if you connect the board to your computer? If not, are you sure that you moved the BOOT0 jumper from GND to HIGH? That was the mistake i made.

My board is now being recognized but it still fails to open the dfu device correctly.

gerisse commented 3 years ago

hi. same thing for me that @jannst . board in dfu mode , but when i tried to target it, i have : dfu-util: Cannot open DFU device 28e9:0189 dfu-util: No DFU capable USB device available

01xz commented 3 years ago

Hi @gerisse, i got the same problem on ArchLinux and i've solved it by trying this: 99-platform-udev.rules although it still shows the error information like this:

 File downloaded successfully
 dfu-util: Error during download get_status
 *** [upload] Error 74

the new firmware is uploaded to the Nano, you can reset the Nano manually by pressing RESET button.