MAX7219 LED Matrix RaspberryPi HAT - Shiratech FFPGA Mezzanine and RPi HAts Pt. 1

Sahaj Sarup

Starting off with a easy one.


The MAX7219/MAX7221 are compact, serial input/output common-cathode display drivers that interface microprocessors (µPs) to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a BCD code-B decoder, multiplex scan circuitry, segment and digit drivers, and an 8x8 static RAM that stores each digit. Only one external resistor is required to set the segment current for all LEDs. The MAX7221 is compatible with SPI™, QSPI™, and MICROWIRE™, and has slew-rate-limited segment drivers to reduce EMI.

RPi LED Matrix HAT


  • Supports any revision of Raspberry Pi (directly-pluggable)
  • Driver : MAX7219
  • Matrix type : 8 × 8 common cathode LEDs
  • Color : red
  • Dimension : 64.3 × 35.0 × 26.5mm

How to make it work with the Shiratech FPGA Mezzanine

Since the HAT only requirers us to use SPI, and provided that the CS pin on the 96Boards base board is controlled by the SPI driver itself. All we need to do enable spi0 pass-through using i2cset command like: sudo i2cset 0 0x6f 0x3a 0x00

This should allow you to access MAX7219 over /dev/spidev0.0

Now you can try out the following MRAA examples to display a pattern on the LED Matrix:


Compile: gcc spi.c -o spi.o -lmraa

You should now see each led on the Matrix light up one after the other.

For a more detailed guide checkout the Shiratech FPGA Mezzanine Documentation.

comments powered by Disqus