Maker Pro
Arduino

Getting Started With FPGAs Using the Arduino MKR Vidor 4000

November 25, 2019 by Daniel Hertz
Share
banner

Intimidated by FPGAs? Don't be! Learn about Arduino's most programmable board with this Arduino MKR Vidor 4000 tutorial.

The MKR Vidor 4000 is an interesting Arduino development board for many reasons. It not only contains a 32-Bit MCU, Wi-Fi, Bluetooth, a camera interface, and built-in HDMI support but it also features an on-board Intel Cyclone 10CL016 FPGA.

Arduino_MKR_Vicor_4000.jpg

The Arduino MKR Vicor 4000.

The MKR Vidor 4000 is an interesting Arduino development board for many reasons. It not only contains a 32-Bit MCU, Wi-Fi, Bluetooth, a camera interface, and built-in HDMI support but it also features an on-board Intel Cyclone 10CL016 FPGA.

What is an FPGA?

A field-programmable gate array (FPGA) is an integrated circuit that can be freely configured by a user again and again to implement a logic function. This process is similar to programming a microcontroller. However, on an FPGA, you don’t upload software that runs on set hardware. 

Instead, you configure the FPGA to be the hardware itself. This enables you to implement very fast filters, audio and video processors, and other things that microcontrollers aren’t able to do. 

You can think of the Intel Cyclone on the MKR Vidor as a freely configurable expansion board that allows you to implement different hardware that can be used with the Arduino. 

If you’re interested in a deeper dive around FPGAs, check out What Is an FPGA? An Introduction to Programmable Logic.

Setting Up the Basics

Before you can begin, you need to install the board’s core in Arduino IDE. If you are using Windows, the necessary drivers will be installed automatically when you perform these steps.

In Arduino IDE, select “Tools” and open the board manager:

select board manager in Arduino IDE

In Arduino IDE, go to "Tools" and select the board.

In the window that opens up, search for “MKR 4000” and install the following package:

installing FPGA package in arduino ide

Install this package into Arduino IDE.

Once that’s done, you are ready to go! This package allows you to program the MCU in Arduino IDE just like you would with any other Arduino compatible board.

But remember, regular Arduino programming is not what we’re discussing in this article

The Vidor 4000 and Verilog

Unfortunately, there’s no easy way to program the Intel Cyclone 10 FPGA on the Vidor board. Arduino announced a graphical tool that lets you combine pre-defined Verilog IP-blocks to build a larger FPGA project, but this tool has not yet been released. 

Luckily, there is a way for experienced users to utilize Verilog to configure the FPGA. To do this, you’ll need the Arduino IDE, Intel Quartus Prime 18.1 (or newer), and a tool that converts the compiled files for the FPGA. 

The official program is available in this Vidor 4000 repository on GitHub. However, I used an alternative VidorFPGA version as well as the accompanying Verilog project I’ll use throughout this article.

Compiling and Uploading Code

Once you download the sample project, it’s time to compile and upload it to the board. Open the Quartus project in the IDE and you’ll see something similar to this:

Open the Quartus project in Arduino IDE

Open the Quartus project in Arduino IDE.

Make sure to open these two files: 

  1. MKRVIDOR4000_top.v 
  2. user.v 

MKRVIDOR4000_top.v is the main file, where all the pins are defined. User.v gets included in the first file, and it contains your custom code. 

Note that the pins can not be shared between the microcontroller and the FPGA. If you accidentally define the same pin as an output or input in the Arduino sketch and the Verilog program, your board might get damaged. However, it’s possible to use the pins to transfer data between the two devices.

Compile the FPGA Code

Once you are ready to compile the FPGA code, double-click the Compile Design task on the left-hand side of the Quartus main window.

compile design in quartus

Compile design in Quartus.

When the process is finished, a compiled ttf-file is placed in the output-files folder within your project’s main folder. Use the conversion program to modify this file and then change its name to app.h and place it in the same directory as your Arduino sketch.

A short Arduino program can be downloaded at the end of this article. It already contains a compiled and converted version of a simple Quartus test project that was taken from the GitHub repository mentioned above.

Upload the Sketch and FPGA Configuration

The last step is uploading the sketch and the FPGA configuration to the Arduino. This can be accomplished with the Arduino IDE, just like for any other Arduino board. The microcontroller on the MKR Vidor 4000 will directly communicate with the FPGA and reconfigure it over JTAG. 

It’s worth mentioning that you can also use the JTAG pads on the board to upload the code to the FPGA directly. Once the code uploads, you should see something similar to this in the serial monitor:

successful MCU and FPGA configuration

A successful MCU and FPGA configuration!

If you connect an LED to pin six of the Arduino, it should toggle on and off, enabling you to change the frequency.

Final Reminders About the Vidor 4000

Arduino intended for the FPGA on the Vidor 4000 to be used with pre-configured Verilog IP-blocks. Luckily, the FPGA can be fully configured with Verilog and, with a few extra steps, the code can easily be uploaded to the board.

The microcontroller and the FPGA can communicate over the GPIO pins. However, they can not simultaneously use the same pin as either an in- or output. The microcontroller directly configures the FPGA, but it’s also possible to do this manually by utilizing the JTAG header on the board.

To follow a more in-depth guide for Quartus IDE, check out How to Program the Arduino MKR Vidor 4000’s FPGA with Quartus IDE.

Author

Avatar
Daniel Hertz

Hi! I am a software engineer and owner of nerdhut.de who loves to experiment with electronics, gadgets and tech in general.

Related Content

Comments


You May Also Like