Overview
Controlling the Adafruit 32x16 RGB LED Matrix with a DE0-Nano FPGA Board
Adafruit currently sells a really cool 16x32 RGB LED matrix panel in their store that is "designed to be driven by an FPGA or other high speed processor." The purpose of this tutorial is to help you get started driving a small handful of these displays with the DE0-Nano board, which contains a mid-range Altera FPGA.Prerequisites
This tutorial is for those who are familiar with electronics, microcontrollers, programming IDEs and noodling around on a windows computer with drivers, command prompts, editing text files, etc. Its a good introductory FPGA project but not a good introductory microcontroller/electronics project.
You need to have the Quartus II software installed on your computer. If not, you can download it from Altera's website or install it from the DVD that comes with the DE0-Nano board. You will also need to install the USB-Blaster drivers that enable your computer to communicate with the FPGA (see this short YouTube video).
Page last edited March 08, 2024
Text editor powered by tinymce.
New Project
User configuration
Once you are all set up and ready to begin, download the necessary files for this project from its Github repository (click on the "ZIP" icon).
Open the file vhdl/config.vhd in a text editor and change line 32 (constant NUM_PANELS...) to indicate the total number of LED panels you have daisy-chained together in your display. For example, if you are using a 1x2 or 2x1 grid, you will want to change the line to:
constant NUM_PANELS : integer := 2
You may optionally edit line 33 (constant PIXEL_DEPTH...) in a similar manner to indicate how many bits-per-pixel you want to use. This will affect the level of brightness control available to you later. Finally, save the file!
Creating the Quartus II project
Start Quartus II and open the "New Project Wizard" from the "File" menu. On the first page, name the project rgbmatrix-fpga (or something similar) and name the top-level entity top_level. Click Next.
Page last edited March 08, 2024
Text editor powered by tinymce.
Pin settings
Pin settings
Now that the project has been created, you need to change two more settings before we can move on. Go to the Project Navigator panel in the top left area of Quartus and right click on the device ("Cyclone IV E: ..."). Select "Device" from the menu.
Now select the "Voltage" category. Change the "Default I/O standard" to "3.3-V LVTTL". This is essential to do because the panels will not recognize a signal below this voltage.
Page last edited March 08, 2024
Text editor powered by tinymce.
Pin Assignments
Making pin assignments
Go to the "Assignments" menu and select "Import Assignments...". Import the de0-nano/rgbmatrix-fpga.qsf file. After you do this, a message should appear in the "System" console tab at the bottom of Quartus: "Import completed. 14 assignments were written (of of 14 read)."
You may want to use female-female jumper wires to make the connections between the IDC pins!
Page last edited March 08, 2024
Text editor powered by tinymce.
Synthesize and Upload
Synthesizing the design
To synthesize the design, go to the "Processing" menu and select "Start Compilation", or click on the purple arrow icon in the toolbar. Synthesis should be quite fast since the design is small. After compilation is successful, you should have a new .sof file in your Quartus project directory. It should be 703,642 bytes long.
Uploading the bitfile
Plug in your DE0-Nano board via the USB connector. Now, go to the "Tools" menu and select "Programmer".
The FPGA is now programmed with your design! (This only programmed the SRAM though, not the onboard EEPROM — so the design is only stored until power is turned off.)
Note: In the future, you can use the command script de0-nano/program.cmd to quickly program the FPGA's SRAM with your .sof file (it uses the Quartus command line programming utility).
Page last edited March 08, 2024
Text editor powered by tinymce.
Demos
Running the Virtual JTAG interface server
Open the command script tcl/run.cmd in a text editor and ensure that the path to the quartus_stp executable is correct. Then, double click the script to launch the Virtual JTAG interface server (tcl/vjtag_server.tcl). This binds to a TCP port to allow programs and scripts to write data to the FPGA through Altera's Tcl API.
This allows you to send video to the FPGA from any device that can communicate over the network! For example, a remote Arduino with a Wi-Fi shield, or an Android cellphone.
The included Processing demos and code
Two demos written in the Processing programming language (a dialect of Java) are available in the processing folder. You can run either demo by copying its directory to your local sketchbook folder (usually ~/Processing). The first demo, Chaser is a basic test animation. The second demo, Magnify sends a real-time screen capture to the panels through the FPGA.
Page last edited March 08, 2024
Text editor powered by tinymce.
More!
Page last edited March 08, 2024
Text editor powered by tinymce.