Max7219 + esp32 (esp wroom 32) doesn't work

max7219 + esp32 (esp wroom 32) doesn't work.
Good day to everyone! I have been designing printed circuit boards and programming controllers for a relatively long time. This is my first post on such forums. Thank you everyone for your time.
I have already worked with max7219(sop-24) bare IC and designed boards on it. And now I ran into a problem, but first I will describe my project:
I have two boards: On one board there is an esp wroom 32 with all the wiring, on the second there is a bare max7219 and indicators (4 x 3 digit, but soldered only ONE piece). Two boards are connected by 5 wires 7-8 centimeters (vcc (5v) gnd data clk, cs).
When flashing and turning on, the seven-segment indicator (one digit) just periodically flickers (every 6-7 seconds, for a very short period of time, it's even hard to notice) with random indicators (1-2) (the sticks light up ALL including the dot) + does not display anything
What I tried by reading the forums:

  1. Soldered the wires directly without using adapters (didn't help)
  2. I removed the wires altogether and inserted one board into another directly through the connectors (did not help)
  3. Soldered other boards with max7219 from another batch (did not help)
  4. All contacts are called by a multimeter (vcc gnd data clk, cs)
  5. I took the ready-made max7219 module purchased from aliexpress, inserted it into the same contacts, it WORKS (it means the problem is not in the code and not in the first board with esp32)
  6. Added ceramic capacitors for power supply (between 4 and 19 pins vcc and gnd) at 0.1uF and 10uF near max7219
  7. Changed the pull-up resistor between iset and vss from 10k to 30k (didn't help)
    I'm lost... What else could be the reason? Maybe I designed the second board incorrectly? Used the easyeda environment, no DRC errors.
    Good luck with your projects.

Have you had the exact same circuit working on a breadboard ?

Welcome to the forum.

You already know what you are doing, so it requires some investigation. Can you give more information ? Do you have a schematic that shows where the wiring between the boards is. How long are the boards apart ? Can you show the sketch ? Can you show a photo ?

When someone on this forum says that something can not be the cause, then we have to look into that, because it could be the cause :wink: Some pins on the ESP32 have startup conditions which could result in a timing issue, resulting in one situation that works and another not. So yes, we would like to know everything.

Before that, I had one board: with esp32 and max7219. Everything worked. The circuit is the same, only the two boards are separated. 5 wire connection: (vcc (+5v) gnd data clk, cs)




Resistors 10k + 20k.
Capacitors 0.1 and 10 uF.
The code just outputs characters from 1 to 8
I connected the module for clarity, that everything works with it
found a similar video: Assd on Vimeo

First question, how far? 4" wouldn't be an issue, but 4' quite possibly.
Second question, can you run your power to the 7219 using dedicated, larger gauge wires, particularly for the ground? I found the 7219 to be finicky about power, if your return currents are passing through a poor connection (common with the 0.1" jumpers), the ground can 'bounce', leading to garbled comms and poor functionality.

I tried the ESP32 with MD_Parola library in Wokwi simulation: ESP32 with MD_Parola library - Wokwi Arduino and ESP32 Simulator
The Wokwi simulation has unlimited power, no crosstalk or glitches from wires, no grounding issues. That works, but you already know that with the cheap module.

Oops :grimacing: wrong display :cry:

Is VCC 5V or 3.3V ? A chip running at 5V might not work with the lower signal levels of a ESP32.
Could you try a capacitor of 470µF or 1000µF on the led board ? A capacitor of 10µF for all those leds does not feel good.
How are the wires connected to the control board ? I wonder if the grounding is okay, as camsysca already wrote about.
Did you use other pins for the AliExpress module ?

For the pins I use this: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
ESP32 Pins 2 and 5 have something special.

Can you show a small sketch that has the problem ?

7-8 centimeters (about 2.5-3 inches). But it doesn't matter:

I tried to connect directly through the pins (see photo). It seems to be a little better (I'm not sure)
Good theory about the thickness of the wires! I will definitely try to add thicker wires today

I'll probably try your library, but I'm not sure if that's the issue. Cheap module works.
The display on the board is 100% working (I worked with them in another project). common cathode.
I feed from 5V.
The wires are also soldered to the control board.
I'll try to change the wires to thicker ones and add a 470/1000 uF capacitor. Remove the 10uF capacitor.
I use the same contacts for the module with aliexpress. Working contacts: I always used them for this microcircuit
Code sent
Thanks for your time, I'll try it and let you know!
`#include <LedControl.h>
LedControl lc = LedControl(4, 23, 2, 2); // dataPin, clkPin, csPin

void setup() {
lc.shutdown(0, false);
lc.setIntensity(0, 8);
lc.clearDisplay(0);
}

void loop() {
lc.clearDisplay(0);
lc.setDigit(0, 0, 1, false);
lc.setDigit(0, 1, 2, false);
lc.setDigit(0, 2, 3, false);
lc.setDigit(0, 3, 4, false);
lc.setDigit(0, 4, 5, false);
lc.setDigit(0, 5, 6, false);
lc.setDigit(0, 6, 7, false);
lc.setDigit(0, 7, 8, false);
lc.setDigit(0, 8, 9, false);
delay(2000);
}`

In the Arduino IDE is this "LedControl" library: https://github.com/wayoda/LedControl, but it does not work with a ESP32.

I didn't know that... Always used this library for max7219 chip :joy: Why the module always worked fine then? I have used in other projects also

I don't think so, in LedControl.h is this line:

#include <avr/pgmspace.h>

that does not work on a ESP32.

But anyway, the Wokwi simulator can not simulate the MAX7219 + 7-segments display, so I am not able to try it in Wokwi.

So, I'm back. I connected the boards with thicker wires (with a cross section of about 0.75 mm ^ 2).
I removed the capacitor at 10uF near max7219 and soldered it to 1000uF for power (left 0.1uF).
And it paid off! The seven-segment indicator began to glow with all the numbers. In addition, max7219 began to warm up significantly. I know these symptoms: most likely somewhere unreliable contact with the ground.
I thought about it, visually looked at the tracks and realized:
I filled only the top layer of the board with a copper polygon, forgetting about the bottom one .... I'm shocked with myself)
The GND track runs along the top and bottom layers, respectively. I threw a wire from 4 ground pins max7219 directly to the junction with the board. No changes. I think it's easier to just order another board and not suffer. Most importantly, we were able to eliminate the first problem, and then I already know in which direction I need to figure it out.
Thank you very much for your help. You are very responsive and kind people :smiling_face_with_three_hearts: I sincerely wish you good luck and patience in all your projects!

I understand you. Most likely I changed something so that the code compiles and everything works. I don't remember exactly

When you got your hardware working now, you can try MAX7219 Library.
https://werner.rothschopf.net/201904_arduino_ledcontrol_max7219.htm

The API is similar to LedControl, but implements the full Print.h interface meaning you can print numbers like

lc.setCursor(0, 6);
lc.print(34);

It can print text also (with the limitations of a 7 segment display)
Furthermore it supports Hardware SPI.

Wow, this is very cool and useful, thanks) I will definitely use