How to Make Arduino Work with a $4.90 RISC-V Board

Written by RT-Thread IoT OS | Published 2020/05/21
Tech Story Tags: rtos | open-source | arduino | embedded-systems | iot | risc-v-board | programming | startup-top-story

TLDR Longan Nano could be the most inexpensive Nano development board currently available. With only $4.9, you will get 128KB Flash, 32KB RAM, 32K RAM, 160x80 LCD, TF card slot and even an acrylic case. The main chip on the board is a GigaDevice GD32V Series microcontroller. The board manager URL for Arduino IDE is: http://://://bigbits-oss-cn-qingdao.aliyuncs.com/Arduino_for_GD32V/package_longduino_index.json.via the TL;DR App

Longan Nano with GD32V series MCU costs only $4.9. You then got an Arduino board with 128KB Flash, 32KB RAM, LCD, and even an acrylic case.

Story
-Longan Nano
Sipeed Longan Nano could be the most inexpensive RISC-V development board currently available. With only $4.9, you will get 128KB Flash, 32KB RAM, 160x80 LCD, TF card slot and even an acrylic transparent case.
-GD32V Series Microcontroller
The main chip on the board is a GigaDevice GD32V Series microcontroller, GD32VF103CBT6. From the information provided by RISC-V website, it is a 32-bit SOC with RV32IMAC instruction set and its core named "Bumblebee".
-Arduino Support
Sipeed provides the basic board support for Longan Nano and the board manager URL for Arduino IDE is
Currently, the URL supports only the Windows platform. For macOS or Linux, the alternative IDE is PlatformIO.
The Problem
As I mentioned above, the board support package provides only the basic functions. There is no Serial library, no SPI library,...
The Solution
Arduino RT-Thread library comes to the rescue, which supports the Longan Nano board from v0.8.1.
RT-Thread is an open-source RTOS, however, it also provides various drivers and utilities.
For Longan Nano, the library currently provides UART, SPI, TF card, and LCD drivers. Its utilities are mostly hardware-independent, e.g. FatFS, tiny shell and etc. So with the single library, you may have a lot of fun.
But there is one more thing (library), RTT-GUI. It is a GUI library based on RT-Thread, which provides some UI widgets, BMP / JPEG decoder, fonts, and more. (The new problem now will be lack of memory space.)
Enable RT-Thread
For Arduino IDE, the RT-Thread library supports the Longan Nano board without any configuration, as the macro, BOARD_SIPEED_LONGAN_NANO, is defined in the board support package.
For PlatformIO, the following is an example of the configuration file, "platformio.ini".
[env:sipeed-longan-nano]
platform = gd32v
framework = arduino
board = sipeed-longan-nano
debug_tool = sipeed-rv-debugger
lib_deps = RT-Thread, RTT-GUI
build_flags = -D BOARD_SIPEED_LONGAN_NANO
monitor_port = /dev/ttyUSB1
monitor_speed = 115200

Enable RTT-GUI
Enablethefollowinglinesin "guiconfig.h". (Some features may be disabled in this file to save memory.)
#define CONFIG_GUI_DEVICE_NAME              "ST7735"   // RGB565
#define CONFIG_USING_RGB565                 (1)
RT-Thread Contact Info:



Written by RT-Thread IoT OS | An Open-Source Community-Powered Internet of Things Operating System Project!
Published by HackerNoon on 2020/05/21