Quickly and Easily Apply FPGAs with the Arduino MKR Vidor 4000

著者 Steve Leibson氏

Digi-Keyの北米担当編集者 の提供

As many designers find out sooner or later, firmware running on a microcontroller or microprocessor can prove to be much too slow. This is where field programmable gate arrays (FPGAs) provide a programmable way to solve high speed, real time, embedded design problems at hardware speeds. However, getting the maximum use of an FPGA has traditionally required embarking on a technology learning curve that many designers can ill afford due to cost and deadline pressures. 

The learning curve for FPGAs often involves learning new programming languages (Verilog or VHDL), downloading large development tool packages, learning a whole new tool development flow to generate FPGA bitstreams, and possibly spending a significant amount of money (perhaps hundreds or thousands of dollars) for an FPGA development board. Because of these obstacles, many design engineers avoid using FPGAs, even though they’re an extremely useful tool in the embedded design toolbox.

Several vendors have tried to lower the barriers to FPGA use by offering starter FPGA boards, but the need to learn new hardware description languages and development tools still presents a high barrier threshold that has prevented wider FPGA adoption. The latest effort at tearing down these barriers, this one by Arduino, involves a new, low-cost development board called the Arduino MKR Vidor 4000, which represents a unique approach to the use of FPGAs in embedded system designs.

The Arduino MKR Vidor 4000 features ways to program the FPGA that are seamlessly integrated into the very popular Arduino IDE. Using this approach, getting FPGA level performance using special Arduino library extensions allows embedded system developers to quickly access the benefits directly from an Arduino sketch, while allowing more advanced designers to adopt more complex FPGA use models as their confidence in the technology grows.

This article will discuss the need for FPGAs before introducing the MKR Vidor 4000 board’s capabilities. It will then provide an in-depth look at how to apply Arduino’s new, simplified approach to using FPGAs.

First generation Arduino dev boards

The first Arduino development board, introduced in 2005, was based on a simple, 8-bit microcontroller: the Atmel (now Microchip Technology) AVR. Many subsequent generations of this dev board have also been based on various members of this microcontroller family. Because of the low cost and simple Arduino IDE, the Arduino dev board series has become a popular platform for Internet of things (IoT) product development and is commonly used for STEM/STEAM projects. In fact, the original Arduino board was the first widely successful open source hardware project.

A favorite for exposing students to embedded programming for the first time, hundreds of thousands of designers, engineers, developers, and Makers around the world now use various versions of the Arduino dev board series. The creativity is boundless, with applications ranging from music, to games, toys, smart homes, farming, and autonomous vehicles.

As Arduino users have continued to push the original Arduino architecture into more and more complex applications, they’ve run into performance problems. Part of the problem has been the simple 8-bit architecture of the original Arduino microcontroller. Another part of the problem is the software implementation of many real-time peripherals, especially time critical peripherals such as high speed timers, high frequency PWM (pulse width modulation) outputs, and quadrature encoders. One way of addressing this problem is to use faster, more powerful microcontrollers, but eventually there’s only so much that software can do in a real-time environment. Some high-speed, real-time functions simply must be implemented in hardware.

Merging Arduino and FPGAs

The challenge is making FPGA resources available to an embedded developer using Arduino that doesn’t undermine Arduino’s simplicity. Arduino has solved this challenge from a hardware perspective by adding an FPGA to the Arduino architecture so that the FPGA extends the Arduino’s microcontroller peripheral resources through Arduino libraries. These libraries are familiar to existing Arduino users, and are frequently employed when making use of the Arduino’s native peripherals, and when adding peripheral boards to the Arduino’s expansion headers.

The resulting Arduino dev board, called the MKR Vidor 4000, combines the processing power of a Microchip Technology SAMD21 low-power microcontroller based on a 32-bit Arm® Cortex®-M0+ processor core, with an Intel (formerly Altera) Cyclone 10 10CL016 FPGA (Figure 1).

Image of Arduino MKR Vidor 4000 Dev Board

Figure 1: The Arduino MKR Vidor 4000 Dev Board is based on a Microchip SAMD21 microcontroller and an Intel Cyclone 10 FPGA. (Image source: Arduino)

The FPGA contains 15,408 programmable logic elements, 516,096 bits of embedded RAM, and 56 18 x 18 bit hardware multipliers for implementing high speed DSP. Each of the FPGA’s I/O pins can toggle faster than 150 megahertz (MHz), which is considerably faster than the I/O capabilities of the on-board SAMD21 microcontroller. In short, the on-board FPGA provides considerable processing and I/O horsepower to the Arduino MKR Vidor 4000 board.

The Arduino MKR Vidor 4000 is one of a series of Maker Arduino boards with a new MKR form factor that doesn’t match previous Arduino boards. The MKR series also includes:

Like the preceding Arduino dev boards, Arduino’s MKR series was developed to be used by both beginners and professionals for fast system prototyping. The Arduino organization developed this series of boards after observing that a growing number of serious engineering projects were using Arduino dev boards for prototyping, and even for production.

The Arduino MKR Vidor 4000 includes a number of peripherals including several that are not generally associated with the earlier, simpler Arduinos. There’s a 28-pin MKR pin header interface, similar in concept but physically different from the original Arduino shield header. The I/O pins in this header interface can be controlled by either the SAMD21 microcontroller or the Intel Cyclone 10 FPGA. In addition to the standardized MKR pin header interface, the list of peripheral ports on the Arduino MKR Vidor 4000 board includes:

  • A micro USB connector
  • A micro-HDMI video output connector
  • A MIPI video camera connector compatible with Raspberry Pi camera modules
  • Wi-Fi and BLE (Bluetooth Low Energy) RF interfaces implemented with a U-BLOX NINA-W102 RF transceiver module
  • A MiniPCIe connector with as many as 25 user programmable pins

Note that the Arduino MKR Vidor 4000 dev board does not have a true PCIe interface port. It merely re-purposes the connector associated with a MiniPCIe port, breaking out many of the Cyclone 10 FPGA’s I/O pins on the MiniPCIe edge connector. This is an inexpensive, high-volume connector that has proven its reliability through widespread use on many millions of PC motherboards. The MiniPCIe connector makes it easy to plug the Arduino MKR Vidor 4000 board into a larger system or an I/O expansion board.

The Arduino MKR Vidor 4000 dev board is small, despite having so many I/O connectors. It measures 83 mm (3.25 inches) by 25 mm (0.98 inches) allowing it to fit in tight spaces, which is increasingly common in embedded computing applications. The board’s current consumption is rated at 100 milliamps (mA), so it should also fit within the power envelope of many embedded system projects, including battery powered systems.

The board has a connector for direct connection of a 3.7 volt lithium polymer (LiPo) battery, as shown in Figure 1. However, the current consumption will vary depending on what’s implemented in the FPGA and how fast that instantiated hardware runs, which will complicate calculations for battery capacity and will ultimately require a bit of experimentation to get the battery sized correctly.

The MKR Vidor 4000 board’s video output is a true HDMI video output generated by the Intel Cyclone 10 FPGA. Arduino has included the Adafruit GFX graphics core library in the Arduino IDE for the MKR Vidor 4000 board to allow the SAMD21 microcontroller to generate graphics under software control using Arduino sketches.

Arduino has also added several hardware IP blocks to the Arduino IDE through two main libraries specifically created for the MKR Vidor 4000 board: VidorPeripherals and VidorGraphics. These hardware IP blocks are automatically constructed in the Intel Cyclone 10 FPGA on the Arduino MKR Vidor 4000 when the relevant peripheral library is included in an Arduino sketch. The current roster of peripheral IP blocks includes:

  • I2C ports
  • SPI ports
  • UARTs
  • High frequency PWM controllers
  • High-speed timers
  • High-speed quadrature decoders
  • Adafruit Neopixel addressable RGB Smart LED controller

Similarly, the Arduino MKR Vidor 4000 board’s software library includes video capture code for the board’s MIPI camera input. This library includes routines that can capture 640 x 480 pixel video images from an attached camera. The camera’s 24-bit RGB images are stored in the board’s 8 megabyte SDRAM, which is directly connected to the Cyclone 10 FPGA. In addition, it’s possible to use one of the Arduino MKR Vidor 4000 board’s I2C interfaces to access the attached camera’s control and status registers.

Some of these peripherals, such as I2C and SPI, were already available as software IP blocks for earlier Arduino boards. The difference between these earlier software implementations and the equivalent IP blocks implemented on the Arduino MKR Vidor 4000 board’s FPGA is that the FPGA versions of these peripherals provide much better performance.

For example, each I2C and SPI instantiation is implemented with separate programmable hardware blocks inside of the board’s FPGA. As a result, there’s no performance loss when instantiating several such serial ports.

FPGA speed example: fast quadrature encoding

Quadrature encoders are popular as a positioning feedback mechanism for stepper motors used in 3D printers. Software-based encoders can be problematic because they are speed limited; they can miss counts when the processor is busy executing other code. The Arduino MKR Vidor 4000 board’s quadrature encoders instantiated in the Cyclone 10 FPGA hardware are clocked at 100 megahertz and implemented with 32-bit hardware counters, so they won’t miss counts in any realistic physical system.

Each instantiated quadrature encoder is implemented using separate FPGA blocks, so there’s no loss of performance when instantiating multiple encoders. Implementing more encoders simply entails using more of the FPGA’s internal programmable logic. This is a key benefit of an FPGA’s hardware parallelism.

Using FPGAs is easy—the Arduino way

By implementing peripheral blocks as FPGA hardware and making them available using the same library mechanism already familiar to the legions of Arduino sketch writers, the Arduino MKR Vidor 4000 board makes FPGAs easy to use. There’s no new hardware description language (HDL), like VHDL or Verilog, to learn. To the developer, FPGA-based peripherals look like any other C++ object from the programmer’s viewpoint. Arduino plans to add more such hardware IP block peripherals later.

Arduino has accomplished this magic trick—making FPGA hardware look like hardened peripheral blocks—using a software stack that extends far below the original Arduino IDE’s software stack. The software stack for the MKR Vidor 4000 board creates a link between the high level sketches, written in Arduino’s variant of C++, and the board’s FPGA hardware using remote procedure calls sent to a mailbox instantiated on the FPGA, which is connected to the SAMD21 microcontroller through a JTAG connection (Figure 2).

Image of Arduino software stack for the MKR Vidor 4000 dev board

Figure 2: The Arduino software stack for the MKR Vidor 4000 dev board uses remote procedure calls transmitted through a JTAG API to the Intel Cyclone 10 FPGA, which has an Arduino driver instantiated in the FPGAs programmable hardware. (Image source: Steve Leibson)

Using this software stack to access the FPGA-based peripherals is as simple as including the right calls to the correct Vidor peripheral libraries. Arduino sketch writers need not know how the Vidor’s FPGA magic trick works. It simply does.

Accessing predefined peripheral IP blocks implemented with programmable hardware is certainly a valid way to boost system performance using an FPGA, although the resulting performance boost taps only a fraction of the FPGA’s full capabilities. Even so, Arduino is encouraging MKR Vidor 4000 users to develop additional peripheral blocks to grow the selection through the very large, Arduino open source community.

The Arduino MKR Vidor 4000 board is not yet a general purpose FPGA development board because it lacks support for direct programming of the on-board Cyclone 10 FPGA using HDL code. However, Arduino is also planning on allowing more advanced users to realize more utility from the Arduino MKR Vidor 4000 board’s FPGA by releasing an Intel Quartus project that demonstrates the implementation of FPGA HDL code directly on the MKR Vidor 4000 board. Quartus is the comprehensive HDL development tool Intel provides designers to develop FPGA designs with the company’s FPGAs.

When Arduino publishes this Quartus project for the Arduino MKR Vidor 4000 board, designers, engineers, Makers, and students who want to learn HDL programming will be able to use the board as a low-cost development and production platform for more advanced FPGA projects. With this direct FPGA programming capability, designers will be able to instantiate almost any sort of hardware block in the Arduino MKR Vidor 4000 board’s FPGA. For example, the on-board FPGA resources are more than sufficient to accommodate an Arm Cortex-M1 processor core in the FPGA fabric. Doing so would transform the Arduino MKR Vidor 4000 board into a dual-processor embedded system.

Conclusion

While FPGAs offer higher performance for many processing functions alongside a microcontroller or microprocessor, they require a long learning curve. The Arduino MKR Vidor 4000 board and the companion Arduino IDE substantially lower the barrier to learning how to develop more advanced applications using FPGAs. Designers thinking about dipping a toe into unfamiliar FPGA waters will likely find the water neither too hot nor too cold in the Arduino MKR Vidor 4000 pond.

免責条項:このウェブサイト上で、さまざまな著者および/またはフォーラム参加者によって表明された意見、信念や視点は、Digi-Key Electronicsの意見、信念および視点またはDigi-Key Electronicsの公式な方針を必ずしも反映するものではありません。

著者について

Steve Leibson氏

Steve Leibson氏は、HPとCadnetixでシステムエンジニアを務め、EDNとMicroprocessor Reportで編集長として活躍し、XilinxとCadenceなどの企業では技術ブロガーを担当しました。また、同氏は、「The Next Wave with Leonard Nimoy」の2つのエピソードで技術専門家を務めました。同氏は、33年間にわたって、高速でかつ信頼性の高い優れたシステムを設計技術者が開発することを支援しています。

出版者について

Digi-Keyの北米担当編集者