Close

Adventures with the Sipeed Longan Nano development board

ken-yapKen Yap wrote 09/24/2021 at 11:59 • 3 min read • Like

The Sipeed Longan Nano development board by Seeed Studio is based on the Gigadevice GD32V which implements the RISC-V architecture. It has an impressive list of features, which you can read for yourself. Low power consumption is claimed as one, a third of the Cortex-M3. Actually if you go to that Seeed Studio link you will find that a newer v1.1 is about to be released. The older v1.0 is listed as out of stock. However it is still sold by many vendors on AliExpress. I bought one for about $12 delivered with a tiny LCD screen on top. I figured I can experiment with the v1.0 now and display stuff on the LCD and buy v1.1 when it is released. Never can have too many toys. 😉

Several things can be noted from the photo. The USB connector is USB-C. So if you have been using micro-USB cables, it's time to upgrade. Fortunately I had a spare cable. There are two buttons. One is RESET and the other is BOOT. What's the difference? RESET is what you expect. BOOT is to be held down before RESET when you want to flash firmware (your program binaries) onto the board. We met the same scheme this in #Adventures with ESP8266-12E, NodeMCU, and Lua One more thing cannot be seen in the photo. On mine, there are 4 pins for attaching a serial interface. If you don't have a FDTI type converter from USB to serial, then you'll have to get one.

I do have a USB to serial converter but I was loath to use a USB port of my computer to power the board, and use another USB port to connect to the serial interface. But it turns out that the USB port on the board can indeed be used to download firmware using the DFU protocol. The Linux utility for this is dfu-util. But it turns out that I may eventually need to use a second connection as DFU doesn't support debugging.

For development, PlatformIO (see my page on PlatformIO setup) is the required IDE, and this board is supported. That page is a bit out of date as upload_protocol = dfu is not mentioned as the setting you need to add to your platformio.ini of your projects. The other thing you should do is add a udev rule so that your Linux account can access the USB port. Before you flash the firmware you should hold down BOOT, then pulse RESET so that the USB device materialises. You can check if the device exists with dmesg -T -w as root, or with dfu-util -l which gives a lot more info. This needs to be done for each download as the USB device disconnects after completion. I think I may need to get a couple of small styluses to avoid squeezing my huge fingers on the tiny board. Here is a gist which mentions many key steps.

I copied one of the three example projects available for this board, all versions of blink. I chose nano-blink and succeeded building the firmware with only a few compiler warnings. However when it tried to flash the firmware, dfu-util reported an Error 74 which is a known issue. I found the more recent version in my Linux distro's repositories. However I could not delete the PlatformIO installed dfu-util package as it insisted on installing it as a platform dependency. So I subverted it by renaming the old binary and making a symlink to /usr/bin/dfu-util. After that blink worked. Wow, exciting. Not!

Well that should get you started. I'll have to see what more exciting programs I can run on it, in particular ones that use the display. Incidentally in my rabbit hole explorations I found that there is a toolchain for Rust, so you could program in this safer language that retains the efficiency of C/C++.

Like

Discussions