I have a MAX7219 dot matrix module (this one) that I'm trying to run on my Raspberry Pi 4 with the Luma.LED library. Its documentation suggests the following GPIOs/pins be used:

Board Pin Name Remarks RPi Pin RPi Function
1 VCC +5V Power 2 5V
2 GND Ground 6 GND
3 DIN Data In 19 GPIO 10 (MOSI)
4 CS Chip Select 24 GPIO 8 (SPI CE0)
5 CLK Clock 23 GPIO 11 (SPI CLK)

However, mine is connected as follows, because I'm also running an epaper on the Raspberry Pi that needs some of the pins:

Board Pin Name Remarks RPi Pin RPi Functions
1 VCC +5V Power 4 5V
2 GND Ground 14 GND
4 CS Chip Select 12 GPIO 18 (CLK/CE0N6/CE0N1/PWM0)
5 CLK Clock 40 GPIO 21 (SCLK6/SCLK1/GPCLK1)

I had the dot matrix module working in this configuration before but after a reinstall, I can't get it to work anymore. I have a vague memory I needed to change a config file somewhere to make the module work with the different pin, but cannot remember which one or how. Possibly something in /boot/config.txt?

What I've tried:

  • Made sure SPI is enabled via sudo raspi-config > 3-Interface options > I4-SPI.

1 Answer 1


After all of this, I finally figured it out thanks to this page: https://pinout.xyz/pinout/spi#

Just needed to add the following line to /boot/config.txt:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.