ESP32 and MAX7219 daisy chain display problem

Im reaching out on every forum! no one so far has come up with an answer or fix to this.. :frowning:

this is driving me NUTS..... having trouble with my MAX7219 dot led matrix daisy chain of 32 (running on my ESP32).... the text appear on the display but then randomly portion / half / 80% of the display goes black and sometimes one of the letters/screen just turns to garbled text :S i JUST tried a level shifter (3.3v to 5v) to make the CLK and DATA signal stronger (as suggested on some forums) but sadly didn't work.

Board : DOIT ESP32 DEVKIT V1
Display : MAX7219 (32 in daisy chain)
Pins :
CLK_PIN 18
DATA_PIN 23
CS_PIN 5

here i have the level shifter on CLK and DATA

just a close up on the level shifter

so when i first run it, it works fine

but after a while half or 80% off the display turns off but i can still see that text is updated

something to mention tho is, i wrote a "text line" that was enough to cover 22 modules and it worked fine! no glitch, garbled text or display turning off...

You don't need level shifters. The MAX7219 should be happy with 3.3V SPI logic. You don't connect the MISO pin (SPI Slave Output).
Obviously the MAX7219 has a separate VCC supply to power the 8x8 modules.
Any glitch in a SPI daisy-chain will put the SPI out of sync. But a fresh chip-select, write bytes, chip-release will re-synchronise. (the data only gets latched when CS goes high)

I am guessing that you are a Doctor with an empty waiting room.
Hence the matrix message display and empty chairs.

David.

david_prentice:
You don't connect the MISO pin (SPI Slave Output).

David.

i have it connected to MOSI on the DATA

noiasca:
Where is the sketch you are using?
Where is the link to the library you are using?
How often do you provide power to your modules?
Make a drawing of your wiring including measurements and upload it to the forum.
What kind of power supply are you using (Voltage & Amperage)?

Sketch : MD_Parola/examples/Parola_UFT-8_Display/Parola_UFT-8_Display.ino at main · MajicDesigns/MD_Parola · GitHub (obvs i changed max devices to 32,also HARDWARE type to FC16 from PAROLA::HW and the pins you can see in the post)
Librarys are MD_Parola, MD_MAX72xx, SPI
I'll make the drawing soon
PSU: MeanWell 5v 10A (where ESP32 and the display are sharing ground)

Assuming you have wired this correctly, you could start by halving the number of matrices and see it it works reliably. If it does, start adding in modules until it fails. This may give you a clue as to what is going on.

Most of the issues like this end up being signal propagation or power supply through such a long chain, especially is the signals/power supply are only connected to one end of the matrix chain.

marco_c:
Assuming you have wired this correctly, you could start by halving the number of matrices and see it it works reliably. If it does, start adding in modules until it fails. This may give you a clue as to what is going on.

Most of the issues like this end up being signal propagation or power supply through such a long chain, especially is the signals/power supply are only connected to one end of the matrix chain.

OMG the holy man himself, the guy behind Parola library :smiley: <3 i must say i realy enjoy that library!!!

aree you sure i can connect signal and VCC on both ends? as labeled on the PCB it said IN one direction and then OUT on the other, so i assumed that i couldn't connect at both ends!

You can connect VCC and GND at both ends. This is like a Ring main in your house wiring as opposed to a Spur.
This will reduce noise propagated on the power lines.

David.

The only signal that is truly IN and OUT is the DATA line, as this is generated by each MAX7219 for the next one in the chain. This is also the reason this signal should never degenerate.

All the others are like a 'bus' with each MAX7219 connected to it to pick up the CLK and CS. On a long straight run these signals will attenuate and lose their shape, especially CLK. Hence the suggestion to use buffers to clean up the signal every x (whatever that is) modules. An alternative is to wire up the signals in parallel for each module (except DATA). This is shown in the photo in this blog article Fun and Games, and a New Library – Arduino++.

As already mentioned the Vcc and Gnd can be connected in a ring or even into the middle of the string modules (ie, multiple places).

marco_c:
The only signal that is truly IN and OUT is the DATA line, as this is generated by each MAX7219 for the next one in the chain. This is also the reason this signal should never degenerate.

All the others are like a 'bus' with each MAX7219 connected to it to pick up the CLK and CS. On a long straight run these signals will attenuate and lose their shape, especially CLK. Hence the suggestion to use buffers to clean up the signal every x (whatever that is) modules. An alternative is to wire up the signals in parallel for each module (except DATA). This is shown in the photo in this blog article Fun and Games, and a New Library – Arduino++.

As already mentioned the Vcc and Gnd can be connected in a ring or even into the middle of the string modules (ie, multiple places).

so i would run VCC, GND, CLD AND CS from both ends then?

Yes you can. As mentioned you can also connect into the middle.

I would, however, start with dropping the number of modules and seeing when the problem stops/starts happening.

KrisRevi:
i JUST tried a level shifter (3.3v to 5v) to make the CLK and DATA signal stronger (as suggested on some forums) but sadly didn't work.

Sorry, that is not a proper level shifter. It is only for interfacing I2C buses.

It is not capable of driving the lines that are not chained, specifically the clock and latch lines and the ESP32 itself most certainly does not have the "grunt" to drive multiple devices ("fan-out"), ESPecially at the higher speeds with which it is probably operating

You need a 74HC04 or 74HCT14 to buffer all three lines - data, clock and latch. It has six inverters, you connect them in three cascade pairs to make three non-inverting buffers.

Everytime i pull the power to my esp32 and MAX7219 and then plugg it back in, it's completely random if the display would work 100% or just some of the display...

is this a known problem for the MAX7219 or the MD_Parola library? :S

No, it is a problem with your secret wiring or code. :astonished:


Now here's a thought! :roll_eyes:

Why don't you address the problem I explained to you before?

MY CODE :

============================================================================================================= //
// MY PAROLA
// ============================================================================================================= //
   #ifndef MYPAROLA_H
   #define MYPAROLA_H

   #include <MD_Parola.h>
   #include <MD_MAX72xx.h>
   #include "Parola_Fonts_data.h"
   #include <SPI.h>
    
   #define HARDWARE_TYPE MD_MAX72XX::FC16_HW
   #define MAX_DEVICES 32
   #define CLK_PIN   18 // BROWN
   #define DATA_PIN  23 // ORANGE
   #define CS_PIN    5  // RED
   #define PAUSE_TIME  3000

   // HARDWARE
   MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
   // SOFTWARE
   //MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
   char MSG[100];
   char tmpPlaying[100];
   int isPlaying;


// --------------------------------------------------------------------------------------------------------------------- //
   class MYPAROLA {
   private:

   public:

   static void SETUP() {
     P.begin();
   }
     
   static void SHOW() {
     utf8Ascii(MSG);

     if ((strcmp(tmpPlaying, MSG) != 0) && (isPlaying == 1)) {
       P.print(MSG);
       strcpy(tmpPlaying, MSG);
     }
   }

   static void utf8Ascii(char* s){
     uint8_t c;
     char *cp = s;

     while (*s != '\0'){
       c = utf8Ascii(*s++);
         if (c != '\0')
           *cp++ = c;
         }
     *cp = '\0';   // terminate the new string
   }

   static uint8_t utf8Ascii(uint8_t ascii){
     static uint8_t cPrev;
     uint8_t c = '\0';

     if (ascii < 0x7f) {
       cPrev = '\0';
       c = ascii;
     }else{
       switch (cPrev){
         case 0xC2: c = ascii;  break;
         case 0xC3: c = ascii | 0xC0;  break;
         case 0x82: if (ascii==0xAC) c = 0x80; // Euro symbol special case
       }
     cPrev = ascii;   // save last char
     }

  return(c);
}

   };

   #endif

and i have

on the right VCC - GND - DIN - CLK - CS
on the left VCC - GND - CLK - CS

Topics on the same subject merged

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

when the power is ON i can keep restarting the ESP32 untill the display shows correctly (after 2 resets) and it keeps it like that as long as the power is not disconnected, what does this suggest? :S

Not sure. Possibly a problem with the level shifter as I suggested.

Please read the instructions for posting (part 7) and correct how you posted your code - you can modify the post you already made.

Paul__B:
Not sure. Possibly a problem with the level shifter as I suggested.

Please read the instructions for posting (part 7) and correct how you posted your code - you can modify the post you already made.

im not using the "level shifter" anymore as it works without it! i fixed the first problem by adding VCC, GND, CLK and CS at the other end aswell :slight_smile:

BUT the problem now is as mentioned when the power is plugged out and in the display sometimes display correctly and sometimes only half the screen :confused:

but the text and display is stable and fine, no problem it is just at that startup phase where i have to push the "reset" on the ESP32 like 1 - 2 - 3 times to fix the display.... and that should not be required :S

i've even tried to upload just a PLAIN example from MD_Parola library and still have that startup problem :S

Suggest you try the level shifter/ buffer I described in #10. :roll_eyes:

Paul__B:
Suggest you try the level shifter/ buffer I described in #10. :roll_eyes:

i dont have 74HC04 or 74HCT14 at hand right now so....

Paul__B:
Suggest you try the level shifter/ buffer I described in #10. :roll_eyes:

the level shifter i have in the picture says that it is for "I2C, SPI and other digital signals."