Unboxing the RED-V Thing Plus
Not too long ago, a relatively new instruction set architecture (ISA) hit the embedded programming scene. This ISA is called RISC-V, and naturally, I had to check one out for myself.
Much like the microcontrollers in the Arduino Uno R3, the RISC-V devices are Reduced Instruction Set Computers (RISC). But the RISC Foundation has made its RISC design stand apart from many others by making it an open-hardware instruction set architecture.
The RISC-V core is something I’ve reviewed here late in 2019 via the Sparkfun RISC-V RedBoard. Today, I’m taking a second look at the RISC-V, using the smaller but very capable Sparkfun RED-V Thing Plus board.
Notice of Non-Affiliation and Disclaimer: We are not affiliated, associated, authorized, endorsed by, compensated by, or in any way officially connected with Sparkfun Electronics, SiFive, Segger Microcontroller Systems, RISC-V Foundation, Arduino, Microchip, NXP or their subsidiaries or affiliates.
RED-V Thing Plus Hardware Overview
According to the RISC-V Foundation, this particular ISA was started in 2010 as part of the University of California at Berkeley’s Parallel Computing Laboratory. Among other things, its early developers created the RISC-V architecture to: “provide a realistic but simple ISA that captures important details of commercial general-purpose ISA designs and is suitable for hardware implementation.” In other words, the ISA should be valuable in academic research and industry.
The ISA is made available on an open hardware basis, meaning the RISC-V ISA can be developed outside the RISC Foundation without royalties, licenses, or non-disclosure agreements that are common similar intellectual properties.
The RED-V Thing Plus is a system that uses one such RISC-V core that was developed by SiFive. This chip is the SiFive FE310-G002. The core design is also called “Freedom E310” in technical literature.
Objective
In this build, we will use the Sparkfun RISC-V Thing Plus to run a test application on the Freedom FE310-G002. This includes…
- Unboxing the hardware
- (Optional) Soldering headers to the RED-V Thing Plus
- Install Freedom Studio
- Install the RISC-V drivers
- Install the SEGGER and J-Link drivers
- Build an example application
- Flash the application to the RED-V Thing Plus board
By the final step, we will have a working test application that can print “Hello world” to the Freedom Studio serial terminal over the USB cable. A simple but handy tool for future use.
Hardware Materials Used
Before getting started, note that the RED-V Thing Plus is a 3.3-volt system. If you want it to interact with 5-volt logic, you will need additional hardware such as a level converter.
Hardware used:
- RED-V Thing Plus
- 2.54 mm (0.1-inch) pin headers (sold separately)
- USB-C Cable: Type A (USB 3.1) to Type C
- Desktop PC running Windows 10, 64-bit
- (Optional) Perforated circuit board with 2.54 mm (0.1-inch pitch) for pin alignment
- (Optional) Soldering iron and solder
Software Resources Used
For this build, I downloaded the Freedom Studio application version: 2019.08.2 for Windows 10. The software is based on the Eclipse platform; much like other development environments we’ve used here. It also comes pre-bundled with the RISC-V GNU Compiler Collection toolchain. This—along with the Freedom Studio User Manual—was recommended by SiFive as the fastest way to get started.
Software used:
- Freedom Studio 2019.08.2
- (Required) Do not use spaces in the installation directory
- (Required) “Windows long path” must be enabled in the Windows registry
- (Recommended) Anti-malware software
Freedom Studio was available from the official SiFive website as FreedomStudio-2019-08-2-win64.zip. Before doing anything with it, read any parts of the official Freedom Studio manual that pertain to your operating system.
Unboxing the RED-V Thing Plus Board
The RED-V Thing board is noticeably smaller than the RED-V RedBoard. But the core components were just like its larger counterpart. This includes the versatile FE310-G002 chip, and the board’s largest chip—the NXP Kinetis K22 ARM Cortex-M4. The Kinetis chip provides USB functionality and debugging thanks to the J-Link firmware pre-loaded onto it.
With the smaller form factor, there appears to be a substantial cost saving with this board. The 2.54 mm pitch headers are not included. This means you will need to supply your own interface. Luckily, this also means you the developer get to decide whether to use headers or sockets; or whether you wish to use any at all.
The schematic provided by Sparkfun also lists a JST Connector as the interface for single-cell lithium batteries. And the Quad Serial Peripheral Interface (Quad SPI or QSPI) was also present for storing non-volatile data when power is removed.
Soldering Pin Headers onto the Board
To have an easy time interfacing the system with other electronics in the future, I am going to first attach a set of 2.54 mm (0.1-inch) pitch pin headers to the bottom side of the system.
These “breakaway headers” were part of a much larger set that I had already purchased, so I only needed to break away any extra pins that the RED-V Thing Plus didn’t need.
Before soldering, I also retrieved a perforated prototyping board…
I will not solder anything to the perforated circuit board. Instead, I am only using it to line up the 2.54 mm pin headers. This will ensure the pins are perfectly aligned.
- Place the 2.54 mm headers under the RED-V Thing Plus.
- Place the RED-V Thing and the headers on the perforated board, so that the pins poke through all of the holes.
- The pins are now aligned!
- Solder the RED-V Thing to the pins.
- Remove the perforated board.
Here is what the RED-V Thing looks before soldering the pins…
And here is how it looks after soldering was complete…
After the pins are soldered, you can put the perforated circuit board away.
Next, it was time to install Freedom Studio and its Windows drivers. First, there are a couple of important notices to read before using the RED-V Thing Plus…
Important Notes Before Using the Device
Sparkfun warns that you should not attempt to reprogram the built-in NXP K22 ARM Cortex M4 chip. This chip contains the bootloader for pushing your application code to the RISC-V chip. Overwriting the bootloader will prevent you from reprogramming the RISC-V until you purchase a software license to replace it.
Important Notice for Windows Users
Before you install anything: first know you should choose an installation directory that doesn’t contain spaces. This is rule #1 in the official Freedom Studio manual.
Secondly, you should enable Windows Long Path support using the standard Windows Registry Editor (“regedit”). Full instructions for this are included in the Freedom Studio manual, but you should basically make sure the LongPathsEnabled field is set similar to Figure 8 below…
Installing Freedom Studio
The best way to get Freedom Studio is to go directly to the official SiFive website at https://www.sifive.com/.
Navigate to Products –> Boards and Software. As of this writing, this will lead you to the URL: https://www.sifive.com/boards.
Now scroll down to the section labeled “Freedom Studio.”
Select the Window, macOS, or Linux application. This will start the download.
After scanning the Freedom Studio download for malware (always scan files from the outside world), extract the .zip file to the directory where you want Freedom Studio to reside.
HiFive1_Driver.exe Installation
In file explorer: navigate to the directory where FreedomStudio.exe is now located. From here on, let’s call that directory FreedomStudio-2019.08.
Navigate to folder: FreedomStudio-2019.08\SiFive\Drivers .
This will run an installation wizard to set up the appropriate driver.
J-Link Driver Installation
Next, it’s time to install the SEGGER/J-Link drivers. Without them, you will likely encounter the ”Connecting to J-Link failed” message when you try to upload your code to the RED-V board.
Go back to the FreedomStudio-2019.08 directory, where FreedomStudio.exe is located.
Navigate to folder: FreedomStudio-2019.08\SiFive\jlink-6.52.5-2019.08.0\USBDriver .
Select the directory there that best describes your processor and your windows operating system. My desktop uses an Intel x64 processor, and so I went to the “x64” folder to run the dpinst_x64.exe application in administrator mode.
(Recommended) Use Device Manager to Check for Driver Errors
You can try to confirm the new drivers are working properly by using Window’s Device Manager. Plug in the RED-V Thing Plus board via USB. As usual, Device Manager will mark any missing or misconfigured drivers with a yellow “general caution” symbol (⚠).
Open Freedom Studio
Now it’s time to run the executable: FreedomStudio.exe. Windows Security may prompt you for confirmation first, but it should run.
You should also plug in the RED-V Thing Plus board now, if you have not already.
Create a New Freedom E SDK Project
Once the Freedom Studio environment loads, you should see the above welcome form. Select the option: “I want to create a new Freedom E SDK Project.” If the form doesn’t appear, just navigate to:
File –> New –> Freedom E SDK Project.
In the Create a Freedom E SDK Project dialog below, select “sifive-hifive1-revb” as the target device. This will designate the RED-V Thing Plus as the device to run our example application.
In the same dialog, select the Project Name of “sifive-hifive1-revb-hello.” This is the example application that will use the printf() function later.
When the dialog is properly configured, it should look like this…
A Note on the Project Name for this Guide
From this point forward, your project will be named sifive-hifive1-reb-hello. But in my case, I had already produced a project by this name, so the screenshots below will depict “sifive-hifive1-reb-hello-1” as the project name (with a -1 added). You can ignore the -1, and expect to see “sifive-hifive1-reb-hello” as your project name.
The project will immediately begin to build in the background. After a short wait, you will see the Edit Configuration dialog.
Edit Configuration
The Edit Configuration window will appear on its own. For now, simply select close. If you are asked, save any unsaved changes.
Now we can direct our attention to the example program, which was pre-populated by Freedom Studio…
Begin Debugging (Application Upload)
To upload the application to the RED-V board, we need to access the Run Configurations dialog. You can access Run Configurations by navigating to the far-left side of the IDE to the “Project Explorer” area. Then right-click the project name (at the top of the tree) and then navigate to:
Run As –> Run Configurations.
Alternatively, you can access Run Configurations using the drop-down menu next to the green “run” button at the top of the environment…
In the Run Configurations screen, expand the option for “SiFive GDB SEGGER J-Link Debugging.” This yielded sifive-hifive1-revb-hello as a selectable option. With the project selected, you can simply click the run button…
Within moments, the GDB (short for GNU Debugger) server should be automatically configured and launched; and the “hello” application will be on its way to the RED-V board. If you encounter an error here, it is a strong indication that your drivers did not install completely. This error will also occur if there is a problem with the USB-C cable.
Open Freedom Studio’s Terminal
To read the “hello world” message, you will probably need to configure Freedom Studio’s terminal. By default, mine was configured to use COM1, which displayed nothing. To configure: navigate to the lower-right of the environment and click the “Terminal” tab. This is where you can select a different COM interface.
At this point, you should open Window 10’s Device Manager to reveal the correct COM port. Device Manager groups the RED-V Thing Plus board’s COM ports in the “Ports (COM & LPT)” category. In my case, there were two identical devices marked as:
- JLink CDC UART Port (COM4)
- JLink CDC UART Port (COM5)
The exact COM port appears to be arbitrary, however the higher number has turned out the be the correct one for me most of the time. In this example, COM5 was the correct device. Now it’s time to configure the COM5 port…
The terminal was now prepared to receive the string from the RISC-V chip. I relaunched the application on the device by first navigating to the top of the Freedom Studio environment and pressing the “terminate” button (the red square/stop symbol), followed by the green run button again.
If all went well, you should see the “Hello, World!” message appear in the terminal. If not, try resetting the RISC-V again, or select the other COM device.
Conclusions
This concludes my initial look at the FE310 and RED-V Thing Plus board: hopefully with more projects to come. It’s worth noting that the full guide on getting started (including modifying the example program to blink the LED is published on the Sparkfun official site.
Having tried both the RED-V Thing Plus and the larger RED-V RedBoard, I would definitely say the RED-V Thing Plus is well-suited for anyone on a budget or in need of a smaller, lighter platform. (Drones perhaps?) Stay posted for more builds and RISC-V testing!
References
[1] | B. R. Mayes, “Unboxing the Sparkfun RISC-V RedBoard,” Voxidyne Media, 15 Dec. 2019. [Online]. Available: https://unboxing-tomorrow.com/unboxing-the-sparkfun-risc-v-redboard/. [Accessed 3 Feb. 2020]. |
[2] | A. Waterman, Y. Lee, R. Avizienis, H. Cook, D. Patterson and K. Asanovic, “The RISC-V instruction set,” in IEEE Hot Chips 25 Symposium (HCS), Stanford, CA, USA, 2013. |
[3] | B. R. Mayes, “Unboxing the New Texas Instruments MSP430 Launch Pad,” Voxidyne Media, 6 Oct. 2019. [Online]. Available: https://unboxing-tomorrow.com/unboxing-the-sparkfun-risc-v-redboard/. [Accessed 4 Feb. 2020]. |
[4] | Sparkfun Electronics, “RED-V Development Guide,” Sparkfun Electronics, [Online]. Available: https://learn.sparkfun.com/tutorials/red-v-development-guide. [Accessed 12 Dec. 2019]. |
[5] | Sparkfun Electronics, “RED-V RedBoard Hookup Guide,” Sparkfun Electronics, [Online]. Available: https://learn.sparkfun.com/tutorials/red-v-redboard-hookup-guide. [Accessed 12 Dec. 2019]. |
[6] | Sparkfun Electronics, “SparkFun RED-V RedBoard – SiFive RISC-V FE310 SoC,” Sparkfun Electronics, [Online]. Available: https://www.sparkfun.com/products/15594. [Accessed 11 Dec. 2019]. |
[7] | SiFive, Inc., “Freedom Studio User Manual,” SiFive, Inc., 2 Aug. 2019. [Online]. Available: https://static.dev.sifive.com/dev-tools/FreedomStudio/2019.08/freedom-studio-manual-4.7.2-2019-08-2.pdf. [Accessed 12 Dec. 2019]. |