How To Get Started With RISC-V-Based Microcontrollers
What is RISC-V?
RISC-V has in the recent past attracted the attention of major corporations across the globe like Google, NVIDIA, and Qualcomm among others. It has thrown developers into a frenzy. What exactly is RISC-V though? RISC-V is an instruction set architecture (ISA) that is open source and based on RISC principles. In essence, an ISA is an interface between software and hardware. ISA defines the supported registers, data type, main memory hardware support, and the I/O model of implementation of the ISA. RISC-V was developed at the University of California Berkeley in 2010. It is a simplified architecture thus is well adopted for speed and low power operation. RISC-V based chips are therefore good for commercial applications.
Getting started with RISC-V
The LoFive FE310
The best way to get hands-on experience with RISC-V is through development boards that are based on RISC-V processors. One such board is the LoFive FE 310 by GroupGets LLC. The board comes with a RISC-V processor that can run up to 320 MHz. It also has 8KB of one-time-programmable memory, 8KB of OTM, 16kb of SRAM, and 16KB of instruction cache. The FE310 also has 3 independent pulse width modulation controllers, UART, SPI, and I2C.
The board either has headers soldered to it or it can be soldered onto the carrier board where it can be used as the processor. It has an onboard QSPI flash that is provided through the IS25LP128 module. The flash module is 128Mbit, 16KB module. It can operate at SPI bus speeds of up to 133MHz if used in quad I/O mode. This flash module can be used for storage thus ensuring that there is sufficient space for storing apps or run-time data.
The development board also runs on 5 volts which is further converted to 3.3V by the onboard SPX3819M5 which provides up to 500 mA. The FE301 does not draw much current so it can support other devices and sensors. All the design details of the FE301 for instance the schematics and BOM are readily available on GitHub.
Setting up the development board
There are numerous toolchains available for use with RISC-V depending on the board you choose. RISC-v SDK is available for Linux, Windows, and macOS. There two versions of SDK available, the legacy SDK, and the latest version. Use the latest version as it has a prebuilt toolchain and has OpenOCD for debugging.
You can program the development board using several different ways. You could use the standard JTAG on the processor. You can access this through the LoFive-R1 expansion connectors. You can use any programmer that supports JTAG like SEGGER J-LINK. If you can’t find such, you can use a low-cost USB-to-serial converter like the FT223H-56Q mini MDL. The converter hosts all the connections and breakouts needed to interface to the FE301. RISC-V SDK uses general purpose Input/output available on the FT2232H-56Q to come up with the necessary JTAG connection to program the microcontroller. Below are the connections that need to be made between the LoFive-R1 and the ST2232H-56Q
You can make these connections directly or using a breadboard. If you are using the development board for the first time, it’s prudent to install a bootloader on board. The bootloader is installed once and could be used to implement upgrades later.
RISC-V is ideal for developers intending to use open-source hardware architecture. There are numerous development boards one could use. Setting it up is also not difficult. The only shortcoming with it is that its ecosystem is not as rich as that of other microcontroller platforms. RISC-V is very intriguing though.