Unable to make MAX7219 32x8 display work with ESP32-C3-DevKitC-02

I tried to use both u8g2 and MD_Parola/MD_72xx libraries but example projects from those libraries, like hello world text doesn't seem to work.

I consulted with Guides and chatGPT. From guides, it seems they use Hardware SPI and it's clearly labeled as SPI CLK, SPI CS, etc. My DevKit is a different board than the esp32-c3-devkitc-02. But the pins are the same, as you can see in this wiring.

I tried many constructors for both HW and SW SPI. With u8g2

U8G2_MAX7219_32X8_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 6, /* data=*/ 7, /* cs=*/ 10, /* dc=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);
U8G2_MAX7219_32X8_1_4W_HW_SPI u8g2(U8G2_R0, /* clock=*/ 6, /* data=*/ 7, /* cs=*/ 10, /* dc=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);

With MD_Parola

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN   6
#define DATA_PIN  7
#define CS_PIN    10

// HARDWARE SPI
// MD_Parola ledMatrix = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
MD_Parola ledMatrix = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

Tried both HW and SW SPI, half buffer, full buffer, etc. ChatGPT keeps going back and forth between my DevKit being able to use HW SPI and NOT being able to use HW SPI. Also whether I can use any GPIO pin at all is still unsure (ChatGPT didn't help). After all is wired, before uploading, all the LEDs in the display turn on, after uploading nothing changes, no error. Since the display turns on bright, I'm assuming the DevKit can supply the power just fine. Other example project like built-in LED blink do work. I am very inexperienced in setting up development environtment. Thank you for your time.

PlatformIO.ini

[env:esp32-c3-devkitc-02]
platform = espressif32
framework = arduino
board = esp32-c3-devkitc-02
monitor_speed = 115200
lib_deps = 
	majicdesigns/MD_Parola@^3.7.0
	olikraus/U8g2@^2.34.22
        Wire @ ^2.0.0
#include <Arduino.h>
#include <U8g2lib.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

Setup & Loop when using u8g2 and MD_Parola:

// u8g2
void setup(void) {
  u8g2.begin();
  u8g2.enableUTF8Print();		// enable UTF8 support for the Arduino print() function
}
void loop(void) {
  u8g2.setFont(u8g2_font_unifont_t_chinese2);  // use chinese2 for all the glyphs of "你好世界"
  //u8g2.setFont(u8g2_font_b10_t_japanese1);  // all the glyphs of "こんにちは世界" are already included in japanese1: Lerning Level 1-6
  u8g2.setFontDirection(0);
  u8g2.firstPage();
  do {
    u8g2.setCursor(0, 15);
    u8g2.print("Hello World!");
    u8g2.setCursor(0, 40);
    u8g2.print("你好世界");		// Chinese "Hello World" 
    //u8g2.print("こんにちは世界");		// Japanese "Hello World" 
  } while ( u8g2.nextPage() );
  delay(1000);
}
// MD_Parola
void setup() {
  ledMatrix.begin();         // initialize the LED Matrix
  ledMatrix.setIntensity(0); // set the brightness of the LED matrix display (from 0 to 15)
  ledMatrix.displayClear();  // clear LED matrix display
}
void loop() {
  ledMatrix.setTextAlignment(PA_LEFT);
  ledMatrix.print("Left"); // display text
  delay(2000);

  ledMatrix.setTextAlignment(PA_CENTER);
  ledMatrix.print("Center"); // display text
  delay(2000);

  ledMatrix.setTextAlignment(PA_RIGHT);
  ledMatrix.print("Right"); // display text
  delay(2000);

  ledMatrix.setTextAlignment(PA_CENTER);
  ledMatrix.setInvert(true);
  ledMatrix.print("Invert"); // display text inverted
  delay(2000);

  ledMatrix.setInvert(false);
  ledMatrix.print(1234); // display number
  delay(2000);
}

My Display

provide full code.

No changes on display. All LEDs turn on bright before and after uploading.

with MD_Parola

#include <Arduino.h>
//#include <U8g2lib.h>
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

//U8G2_MAX7219_32X8_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 6, /* data=*/ 7, /* cs=*/ 10, /* dc=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);
//U8G2_MAX7219_32X8_1_4W_HW_SPI u8g2(U8G2_R0, /* clock=*/ 6, /* data=*/ 7, /* cs=*/ 10, /* dc=*/ U8X8_PIN_NONE, /* reset=*/ U8X8_PIN_NONE);

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN   6
#define DATA_PIN  7
#define CS_PIN    10

// HARDWARE SPI
// MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
MD_Parola ledMatrix = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
void setup() {
  ledMatrix.begin();         // initialize the LED Matrix
  ledMatrix.setIntensity(0); // set the brightness of the LED matrix display (from 0 to 15)
  ledMatrix.displayClear();  // clear LED matrix display
}
void loop() {
  ledMatrix.setTextAlignment(PA_LEFT);
  ledMatrix.print("Left"); // display text
  delay(2000);

  ledMatrix.setTextAlignment(PA_CENTER);
  ledMatrix.print("Center"); // display text
  delay(2000);

  ledMatrix.setTextAlignment(PA_RIGHT);
  ledMatrix.print("Right"); // display text
  delay(2000);

  ledMatrix.setTextAlignment(PA_CENTER);
  ledMatrix.setInvert(true);
  ledMatrix.print("Invert"); // display text inverted
  delay(2000);

  ledMatrix.setInvert(false);
  ledMatrix.print(1234); // display number
  delay(2000);
}

do you have anything on the display?

maybe try
ledMatrix.setIntensity(7);

Welcome to the forum.

It worked for me right away the first time (in a simulation).
I used the most simple example from the MD_PAROLA library: MD_Parola/examples/Parola_HelloWorld/Parola_HelloWorld.ino at main · MajicDesigns/MD_Parola · GitHub

With pins 4, 5 and 6:

// Program to demonstrate the MD_Parola library
//
// Simplest program that does something useful - Hello World!
//
// MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
//

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4

#define CLK_PIN   6
#define DATA_PIN  4
#define CS_PIN    5

// Hardware SPI connection
// MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

void setup(void)
{
  P.begin();
}

void loop(void)
{
  if (P.displayAnimate())
    P.displayText("Hello", PA_CENTER, P.getSpeed(), 1000, PA_SCROLL_DOWN, PA_SCROLL_DOWN);
}

Try it in Wokwi:

Can you try that with real hardware ? If it does not work, then there might be a hardware problem.

Note that GPIO-4, 5, 6, 7, 2, 10 are used for communicating with off-chip SPI-flash memory of the ESP32 C3 Kit. Therefore, look for the data sheets for alternative pins to be used as second SPI Port to communicate with your MAX7219 chip.

What are you using for power? Each 8x8 can draw close to 1/2A with all 64 LEDs on at full brightness. Thats nearly 2A for the four module strip. You need a SOLID 3+A 5V power supply to drive that display. Your wiring diagram seems right.


Pins shown for Mega2560

Power is from the USB PC from where I uploaded the code. So PC(USB) -> ESP32 -> MAX7219

It is like this before and after uploading the code. In this picture, I give the display VCC only 3.3v from the ESP32 3.3v pin.

I also tried my code with the esp32-c3-devkitm-1 on that site. It works, and showing letters albeit not well placed yet, but at least it is showing something. I still have no idea why it is not happening on my board. I use ESP32-C3-DevKitC-02, too bad the site doesn't have it as a supported hardware to play with. Also adding that this is a also custom board, I really don't know what the next step should be, what is there left to try.

The LED matrix displays need 5V and the ESP32 works on 3.3V. Direct conenctions mostly work but sometimes they don't. You need to make sure that the signals from the ESP32 are the correct voltage levels for the MAX7219 chip and the displays.

Oh I see. Thank you! This gave me something to try. I'm going to get bi-directional logic converter modules to make sure the voltage is right.

Only needs single direction level shifter. Display doesn’t send data.

Drop the other shoe.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.