By Ken Wells | Apr 4, 2016
Cyclone V Lessons From an Angry Moose
In 2013, Nuvation designed and built a mechatronic version of the popular mobile game Angry Birds. Keeping with our company’s Canadian heritage, we dubbed the game Angry Moose. A 3D-printed, comically large slingshot is aimed using three linear actuators which set the azimuth, angle and stretch (“anger”). These actuators are controlled by Jaguar motor controllers which take a PWM control signal generated by an FPGA. The player uses an iPad with a custom Angry Moose app to wirelessly send control data to a WiFi router, which relays the control data to the FPGA over wired Ethernet.
Since then, Nuvation has been continually updating the FPGA platform with new Altera FPGA parts, adding features and tweaking the game to make it more fun. In 2014 we upgraded the FPGA from a Cyclone III, running an embedded NIOS microcontroller, to a Cyclone V running the latest NIOS II soft-core embedded processor. In October of 2015, we incorporated the Arrow Electronics SoCKIT, which upgraded the FPGA to the Cyclone V SoC and utilized the hard, dual ARM-core processor, which allowed us to do the software development in a Linux environment.
“Altera SoCs integrate an ARM-based hard processor system (HPS) consisting of processor, peripherals, and memory interfaces with the FPGA fabric using a high-bandwidth interconnect backbone.” (text copied from Altera website).
The hardware side of the project involved using the QSys system integration software to instantiate the ARM-based Hard Processor System (HPS), attach the Ethernet controller, import our existing PWM controllers and assign hardware addresses. I then used the Quartus II IDE to build the Verilog top level module and create the pin assignments. Compiling the FPGA took minutes. From there, it was a quick effort to get the development kit to boot Linux using an SD card image provided by www.RocketBoards.org. As a testament to Altera’s ever-improving tool flow, I did all of this in one afternoon with no prior SoC experience. At this point, the hardware implementation was done. The rest of the project required developing the software driver to communicate with the memory mapped PWM modules.
Not being familiar with driver design in Linux, I fumbled around, looking for similar drivers and trying, unsuccessfully, to pattern match something that would work. The online documentation at Rocket Boards consisted of a few rough tutorials and some community-generated projects with sparse documentation. I felt disappointed that documentation for SoC design was largely left up to the community and wished more had been done to provide developers with example projects. One developer was able to put together a driver that worked, but in his words, wasn’t pretty. Nevertheless, at this point our Angry Moose demo was able to receive commands over Ethernet using a simple web server and parse the commands in order to direct the PWM modules and move the actuators.
We debuted the improved Angry Moose game at Altera’s ASDF (Altera SoC Developer’s Forum), where it was a smash hit.