Giter Club home page Giter Club logo

Comments (24)

pcotret avatar pcotret commented on May 30, 2024 1

@dr-br. FYI, I found another way to use my Longan Nano :
https://github.com/dwelch67/gigadevice_samples/tree/master/Sipeed.Longan.Nano
dfu-util -a 0 -D notmain.bin -s 0x08000000

Now, my LED blinks!

from platform-gd32v.

dr-br avatar dr-br commented on May 30, 2024 1

Problem solved:
The dfu-util bundled with platformio has not been patched accordingly. So, when I was running platformio run -e sipeed-longan-nano --target upload all the different versions of dfu-util which I compiled and which I was assuming to be in use simply have not been used.
So, now I build with platformio run and flash to device using the patched dfu-util.

Now, my LCD plays videos :) !


EDIT: Details on working setup

  • dfu-util version
    https://git.code.sf.net/p/dfu-util/dfu-util
    git clone https://git.code.sf.net/p/dfu-util/dfu-util
    cd dfu-util && ./autogen.sh && ./configure --prefix=$HOME && make -j install
  • build
    platformio run from within the examples directory
  • firmware flashing
    dfu-util -d 28e9:0189 -a 0 --dfuse-address 0x08000000:leave -D .pio/build/sipeed-longan-nano/firmware.bin from within the examples directory

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024 1

This has been stale for long enough. Closing.

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024

When using the latest revision of dfu-util from the offical source it works.
The official branch: https://sourceforge.net/p/dfu-util/dfu-util/ci/master/tree/
See this merge request.
https://sourceforge.net/p/dfu-util/dfu-util/ci/f2b7d4b1113ef6c3ada31a0654c9aefebcdb1de5/ by Thomas Hebb.
I would suggest to integrate this new revision of dfu-utils in the platform.io package.

from platform-gd32v.

pcotret avatar pcotret commented on May 30, 2024

I have the same issue.
However, installing the latest version of dfu-util as @jhaand suggested doesn't work in my case...

from platform-gd32v.

dr-br avatar dr-br commented on May 30, 2024

Exactly same issue like @pcotret
I already tried different versions of dfu-util, no luck so far.

from platform-gd32v.

ivankravets avatar ivankravets commented on May 30, 2024

@btx000 @Zepan could you resolve this issue?

from platform-gd32v.

orzel avatar orzel commented on May 30, 2024

I've had this issue for several months on both "longan nano" and "longan nano lite" (the one with lesser specs, based on GD32VF103C8T6 instead of GD32VF103CBT6).

Please update the dfu-utils in platformio.

from platform-gd32v.

pcotret avatar pcotret commented on May 30, 2024

Hi @orzel, OK. Just need to find a proper way to override the new dfu-util in my platformIO setup ;)

from platform-gd32v.

valeros avatar valeros commented on May 30, 2024

@dr-br and @jhaand mentioned that the uploading works just fine with the original package, so we've switched this platform to the latest tool-dfuutil package available in our CDN. It'd great if someone could test uploading via dfu using the upstream version of the platform, e.g.:

[env:sipeed-longan-nano]
platform = https://github.com/sipeed/platform-gd32v.git
framework = arduino
board = sipeed-longan-nano
monitor_speed = 115200

@btx000 @Zepan Is there anything special that differs your fork from the official dfu-utils repository?

from platform-gd32v.

rj45jack avatar rj45jack commented on May 30, 2024

@dr-br and @jhaand mentioned that the uploading works just fine with the original package, so we've switched this platform to the latest tool-dfuutil package available in our CDN. It'd great if someone could test uploading via dfu using the upstream version of the platform, e.g.:

[env:sipeed-longan-nano]
platform = https://github.com/sipeed/platform-gd32v.git
framework = arduino
board = sipeed-longan-nano
monitor_speed = 115200

@btx000 @Zepan Is there anything special that differs your fork from the official dfu-utils repository?

CURRENT: upload_protocol = dfu
Uploading .pio/build/sipeed-longan-nano/firmware.bin
dfu-util 0.9
 
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2020 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 = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash  "
Found GD32VF103, which reports a bad page size and count for its internal memory.
Fixed layout based on part number: page size 1024, count 64.
Downloading to address = 0x08000000, size = 8268
Download        [                         ]   0%            0 bytesdfu-util: dfuse_download: libusb_control_transfer returned -4
*** [upload] Error 74
========================== [FAILED] Took 8.87 seconds ==========================

I get the above error when running on Debian Linux. This is compiling the Arduino Blink Example.

from platform-gd32v.

valeros avatar valeros commented on May 30, 2024

Hi @rj45jack, thanks for testing. Looks like -4 means LIBUSB_ERROR_NO_DEVICE. Could I ask you to compile dfu-util from sources (@dr-br provided a nice instruction) and try to manually upload the binary using freshly compiled dfu-util?
Thanks!

from platform-gd32v.

rj45jack avatar rj45jack commented on May 30, 2024

@valeros Building from source worked. Still unsure why it failed previously with a -4, looks like the Nano reset after detection? Not 100% sure on that.

from platform-gd32v.

valeros avatar valeros commented on May 30, 2024

@rj45jack Could you please check out what version of libusb library is installed in your system?

from platform-gd32v.

rj45jack avatar rj45jack commented on May 30, 2024

@valeros Here is what my system reports for libusb:

||/ Name                   Version      Architecture Description
+++-======================-============-============-===================================================
ii  libusb-1.0-0:amd64     2:1.0.22-2   amd64        userspace USB programming library
ii  libusb-1.0-0-dev:amd64 2:1.0.22-2   amd64        userspace USB programming library development files
ii  libusb-1.0-doc         2:1.0.22-2   all          documentation for userspace USB programming
un  libusbguard0           <none>       <none>       (no description available)

from platform-gd32v.

gsauthof avatar gsauthof commented on May 30, 2024

FWIW, DFU upload works for me out of the box when using the stable PlatformIO 5.2.4 against a Longan Nano v1.1.

My platformio.ini reads:

[env:sipeed-longan-nano]
platform = gd32v
board = sipeed-longan-nano
framework = gd32vf103-sdk
upload_protocol = dfu

And I needed to add an udev rule for fixing the permissions:

$ cat /etc/udev/rules.d/99-platformio-udev.rules
#GD32V DFU Bootloader
ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", MODE="0660", GROUP="dialout", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"

So uploading my code works fine, however, the upload process reports success followed by a failure!
Example:

$ pio run --target upload                                        
Processing sipeed-longan-nano (platform: gd32v; board: sipeed-longan-nano; framework: gd32vf103-sdk)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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.2.1) > 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-dfuutil 1.9.200310 
 - tool-gd32vflash 0.1.0 
 - tool-openocd-gd32v 0.1.1 
 - toolchain-gd32v 9.2.0
[..]
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
DfuSe interface name: "Internal Flash  "
Found GD32VF103, which reports a bad page size and count for its internal memory.
Fixed layout based on part number: page size 1024, count 128.
Downloading to address = 0x08000000, size = 6584

Erase   	[                         ]   0%            0 bytes
Erase   	[=======                  ]  31%         2048 bytes
Erase   	[===============          ]  62%         4096 bytes
Erase   	[=======================  ]  93%         6144 bytes
Download	[                         ]   0%            0 bytes
Download	[=======                  ]  31%         2048 bytes
Download	[===============          ]  62%         4096 bytes
Download	[=======================  ]  93%         6144 bytes
Download	[=========================] 100%         6584 bytes
Download done.
File downloaded successfully
dfu-util: Error during download get_status
*** [upload] Error 74

Although the get_status fails, the device resets fine into my uploaded program and executes it as expected.

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024

I saw that this issue remained open until now. I see that dfu-util has 2 new releases since opening this issue.
The latest release concerns 0.11.

Platformio shows 4 interim releases on their project page for dfuutil.
https://registry.platformio.org/tools/platformio/tool-dfuutil/versions

It seems that the revision numbers from Platformio differ from dfu-util. The latest revision could (1.9.211020) correspond to the 0.11 release of dfu-util. So that could work.

However when building for gd32, still the old version gets installed. (tool-dfuutil @ 1.9.200310)
If I try to manually upgrade the dfuutil pkg to the latest release, it seems that it only contains the Macos_arm64 package. Not the Linux_x64 or other builds. So that explains why the dfuutil package still concerns the old release.

In order to help everyone, a new package for all platforms should become available via Platformio.
Should I write a new issue for this, or do we continue with this one?

Edit: I see this is also mentioned via sipeed/Longan_GD32VF_examples#5

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024

Reply to #17 (comment)

@btx000 @Zepan could you resolve this issue?

@ivankravets The dfu-util is a tool maintained by Platformio according to the registry (tool-dfuutil), not Sipeed. The latest update only supports MacOS Arm64 according the compatibility chart. The rest is stuck with the old version from 2 years ago.

https://registry.platformio.org/tools/platformio/tool-dfuutil/versions

It would be really nice if all platforms would have dfu-util 0.11 available out of the box. But I can't figure out the process or where to submit an issue to trigger this.

Can you please help?

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024

There is a new update of tool-dfuutil 1.11.0 available that supports most larger Operating systems.
See https://registry.platformio.org/tools/platformio/tool-dfuutil/versions

I will write a PR to merge this for the platform.json

from platform-gd32v.

ivankravets avatar ivankravets commented on May 30, 2024

Could we close this issue?

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024

Yes we can close this issue.

from platform-gd32v.

thijstriemstra avatar thijstriemstra commented on May 30, 2024

There is a new update of tool-dfuutil 1.11.0 available that supports most larger Operating systems.

Unfortunately not for Raspberry Pi OS (linux_armv7l):

$ pio pkg install -g --tool "platformio/tool-dfuutil@^1.11.0"
Tool Manager: Installing platformio/tool-dfuutil @ ^1.11.0
Error: Could not find the package with 'platformio/tool-dfuutil @ ^1.11.0' requirements for your system 'linux_armv7l'

Any idea how to compile this from source? The platformio registry claims the source is on sourceforge but this isn't the case unfortunately, I can only find 0.11 and older..

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024

No support for Rasberry Pi. Please add support for ARM32 and ARM64.

from platform-gd32v.

jhaand avatar jhaand commented on May 30, 2024

There is a new update of tool-dfuutil 1.11.0 available that supports most larger Operating systems.

Unfortunately not for Raspberry Pi OS (linux_armv7l):

$ pio pkg install -g --tool "platformio/tool-dfuutil@^1.11.0"
Tool Manager: Installing platformio/tool-dfuutil @ ^1.11.0
Error: Could not find the package with 'platformio/tool-dfuutil @ ^1.11.0' requirements for your system 'linux_armv7l'

Any idea how to compile this from source? The platformio registry claims the source is on sourceforge but this isn't the case unfortunately, I can only find 0.11 and older..

SF names 0.11 but that corresponds to Platformio 1.11

from platform-gd32v.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.