It’s been many a decade since there was a shortage of microcontrollers to choose from, with everything from eight-bit low-power chips to 64-bit high-performance parts flooding the market in implementations ranging from hobbyist-friendly to engineer-approved. Now, though, there’s something new: RISC-V, a fully open processor instruction set architecture (ISA) which is finally making the jump from the lab to the workbench.
SiFive announced the launch of the HiFive1 board back in December last year, promising to begin shipping in volume early 2017. It’s now early 2017, and the company is already making good on that promise: we’ve got a HiFive1 in-hand, and it’s undeniably impressive.
You’d be forgiven for thinking the HiFive1 little more than yet another Arduino clone. It’s true that the board all-but duplicates the layout of the popular Arduino Uno hobbyist development board – complete with the etched-in-stone spacing error on the 2.54mm female pin headers – but it’s no clone.
At the board’s heart is the SiFive Freedom E310, a 32-bit microcontroller implementation of the RISC-V ISA. Running at a theoretical 320MHz or more – though in the current software limited to either an Arduino-like 16MHz when clocked through the board’s oscillator or 256MHz using the alternative PLL – it’s something of a beast computationally, but in other aspects simpler than the board by which its design was inspired.
A glance at the pins reveals one drawback to the HiFive1: the E310 includes no analogue-to-digital conversion (ADC) capabilities. While it includes the same number of pins as an Arduino Uno they’re exclusively digital: 19 IO pins in total, nine of which support pulse width modulation (PWM) and all of which can be used as an externally-driven interrupt pin, while an additional bonus pin acts a dedicated wakeup signal – a feature also brought out to a handy button next to the usual reset button.
The Freedom E310 also lacks for its own dedicated storage: there’s a 16KB instruction cache on-chip alongside 16KB of RAM, but program storage is handled externally in an impressively capacious 128Mbit (16MB) flash module. Other hardware features include support for 3.3V or 5V logic selected through a physical jumper, a micro-USB host interface which handles programming, debugging, and serial communications, and the ability to run from 5V USB or 7-12V DC power.
The HiFive1 is primarily designed to be programmed using SiFive’s open-source software development kit (SDK), which weighs in at a hefty 2.8GB. Tools for compilation, upload, and debugging are included, along with a handful of example programs and benchmarks to get you started with writing for a RISC-V chip.
For beginners, there’s Arduino compatibility. By installing a board support package into the Arduino IDE, it’s possible to compile existing Arduino sketches almost without modification – when, that is, they don’t rely on features not present on the HiFive1 board or which have yet to be fully implemented in the BSP.
It’s here where the first real hiccough is found: SiFive’s software for the boards is still in the early stages, and it wasn’t long before we hit a snag. While attempting to run Wiring implementations of the Dhrystone and Whetstone benchmarks, we came across an issue with timings.
Further investigation revealed a problem with SiFive’s timer implementation, which SiFive’s Megan Wachs quickly split into two core problems: the first, that any delays made in a program will, on occasion, finish considerably faster than they should; the second that calling the micros() function, which provides a read of the number of microseconds since the microcontroller came online, is considerably slower than it should be.
With the project in as early a stage as it is, though, these problems are to be expected – and a post to the SiFive forum not only generated a quick response but also a suggested patch from a community member which should help to improve the performance of the timer function.
That the software is being constantly improved is a definite positive, but also a necessity: the impressive Freedom E310 is undoubtedly being held back by an as-yet unoptimised toolchain. Running the chip at 16MHz for a direct comparison to an 8-bit ATmega328 microcontroller at the same speed, the HiFive1 was able to toggle a pin on and off using Wiring’s digitalWrite() function at a frequency of 20KHz to the ATmega328’s 96KHz.
Switching to the 256MHz PLL clock source to increase the E310’s performance gains it a win, but a surprisingly narrow one: at this speed the HiFive1 manages 156.5KHz, which is still behind devices like Atmel’s ATSAMD family. Pure compute performance, though, is definitely a strong point of the E310: while our Dhrystone benchmark refused to give believable readings, a version of the benchmark included with the SDK read 406 DMIPS to the ATmega328’s considerably more sedate 6.25 DMIPS.
Power wise, the HiFive1 surprises: at 63.4mA while under sustained CPU load at 256MHz it’s only slightly more power-hungry than the ATmega328-based Arduino Uno, which draws 47mA, and comparable to other performance-targeted development boards like the Arduino 101 at 61.6mA and the Intel Edison at 76.3mA. Given that the E310 at its heart is one of the very first RISC-V designs to roll out of a semiconductor fab, that’s very promising for the platform’s future.
It’s easy to look at the negatives – a form factor associated with entry-level hobbyists, an unoptimised toolchain, timing issues, relatively weak IO performance – and come away underwhelmed with the HiFive1. That’s certainly not our opinion, though: we’re absolutely amazed with what SiFive has achieved so far.
The software issues we’ve come across are being dealt with and improved, both by SiFive itself and the growing HiFive1 community. The board may look at home on a hobbyist’s bench, but there’s a reason Arduino layout boards are so popular: they’re easy to work with and great for quickly knocking up a prototype or two.
If you’re working in the embedded space, you need to be investigating RISC-V – and the HiFive1 is a great way to do it without the expense and complexity of rolling your own implementation on an FPGA. It’s also a stepping-stone: when you’ve finished prototyping on the HiFive1, you’re free to download SiFive’s register-transfer level (RTL) files and begin tweaking the E310 to your own requirements.
More information on the SiFive HiFive1 is available at the official website, while the next batch is due to ship on the 10th of February and can be ordered from Crowd Supply for $59 (approximately £48) per board.