I am currently working on a 2 line display based on the standard 8x8 LED matrix modules.
The µC is an Atmega1284p with optiboot.
One line consists of 8 FC-16 pre-built modules. This line is working fine.
The other line is my own attempt at wiring up 5 cascaded MAX7219 chips. This line isn't working and shows random distortions, the well known "all-on" problem, lights up with different brightness (even single lines) or shows some kind of delayed response when shifting data from one panel to the next.
Here's a video of the problem: Max7219 + KYX-788BW
The library in use is MD_MAX72XX and I'm just running the test sketch with only the pins adjusted to my setup:
#define MAX_DEVICES 5
#define CLK_PIN 22 // or SCK
#define DATA_PIN 23 // or MOSI
#define CS_PIN 21 // or SS
// SPI hardware interface
//MD_MAX72XX mx = MD_MAX72XX(CS_PIN, MAX_DEVICES);
// Arbitrary pins
MD_MAX72XX mx = MD_MAX72XX(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
The MAX7219 are the SMD variant and I purchased them from China so they may very well not be original Maxim chips but I can't tell for sure. All I know is the engraving looks just the same as on the FC-16 Modules which are working well.
Rset is 33k and I am driving KYX-788BW. As these are Row Anode Column Cathode I just turned them 90° counter clockwise and connected them accordingly to get effectively another set of FC-16 compatible modules.
All five of them are soldered to a PCB (.svg of the layout. I just removed the GND-fill to make connections more visible. A .png is also attached in case google breaks the file again. Looks like google drive doesn't like SVG so I had to compress it)
I suspect some kind of timing problem with the SPI data and clock line or a power problem so here's what I tried until now:
put additional capacitors on the V+ pins of each MAX7219 (10µF / 100µF, + 0.068µF)
removed the big 680µF capacitors from the power bus because I suspected they may be too big
measured all data lines to and between the chips. There are no short circuits or broken solder joints.
removed the step up/step down power supply to get rid of possible ripple from the switchmode PSU chip
powered the board from my PC PSU to get smooth 5VDC
measured data, clock and cs with an oscilloscope. The signal seems to be fine and quite clean. Some spikes on the edges but no difference compared to the working FC-16 panels
added some small capacitors to the data lines to smooth out spikes on signal edges
added pull down / pull up resistors to the data lines to possibly get rid of induced signals from nearby tracks
Here's the catch: Nothing of the above made any visible difference whatsoever. I am now at a loss on what is causing
the display to misbehave in such a random manner.
I hope someone here has any additional idea on what i could try or can point me to a blatant mistake I may have made.
If the LED modules are socketed, are they in the right orientation?
Can you test the matrices by swapping them into the FC16 modules to verify that they work (ie eliminate them from 'defective' consideration)?
Is your home built section the start or the end of the chain? From the video it looks like the start.
If you are running 16 modules, have you changed the constants in the .ino file to tell the library you have 16?
Any shorts between the SMD MD_MAX7219 pins on the PCB?
It does look a lot like the connections aren't 100%. There are only 3 lines to worry about (CLK, DAT, LD) so I would be inspecting that part of the circuit end to end with a strong magnifier or USB microscope.
The LED modules are in the right orientation and working. The test code is even slightly visible (at the beginning of the video it tries to display the word "Graphics") if of course horribly distorted so the modules are definitely in the right orientation. I tested them with a working FC-16 PCB and wired them up with jumper cables. As I mentioned my KYX-788BW are Row Anode Column Cathode and not Row Cathode Column Anode like the 1088AS modules that are usually used with these, so i had to wire them differently (effectively using the rows as columns and vice versa)
The KYX matrices are also much smaller.
Occasionally one of the five modules will even work almost 100% so I can tell the wiring between the matrices and the MAX7219 is correct. This however depends on pure luck. Sometimes parts of the display work and then they fail again.
My home built section is currently the start and I am only running 5 or 8 modules at a time. The intention is to share data and clock between the two module strips but select them with am individual cs pin as it is done in the multi line example.
I have disconnected the 8 module section for now to make debugging easier. Right now only my home made 5 module strip is connected to the µC.
I will check all data line connections on the PCB for possible errors again.
I checked the PCB again and gave it another cleaning. Seems like it got a little better maybe (Just a tiny bit, it's still unusable)
All connections are completely fine. I also replaced the first MAX7219 of my cascaded display just in case it was broken: No difference.
I then cross checked with the pre-built FC-16 modules by soldering one of my MAX chips on one of the PCBs: They are working absolutely fine.
So I can eliminate the chips being bad and wiring is also ok. The only thing left is my PCB that may have a flawed layout.
The tracks are admittedly in close proximity to each other.
Is there a possibility of the multiplexed lines throwing EMI spikes onto the data lines and therefore disrupting communication?
Okay some progress at last. By pure luck I saw that module 4 was often displaying weird but continuous distortions on row 7, no matter what else was displayed.
I then cut the data in line running from module 3 to 4 and the display suddenly started working. Wohooo yay
Even when I bridged module 4 completely and only ran 4 modules (1,2,3,5) by putting in a juḿper cable from 3 to 5 it works fine. No distortions, no problems.
Unfortunately as soon as i connect the input of module 4 again everything goes to hell and I'm back to random-mania, no matter where in the chain it is placed.
I already checked every single connection of module 4 and also replaced its MAX7219 (twice!). No luck. The Problem still persists and I'm completely out of ideas now. The resistor value is fine. all GND connections are there. V+ 5V is there.
No bridges. No short circuits. Nothing that points to the problem at all.
If anyone has any ideas left on what is causing this please share your ideas.
At this point even scratching a pentagram into the PCB is more likely to work
Apparently a small error in the PCB etching process bridged two connections: The clock line and a track that was running nearby which was unfortunately running from pin 8 (DIG7) to the matrix of module 4. The bridge was absolutely tiny and not visible even with a magnifying glass but it led to absolute disaster on the display. Whenever module 4 powered up DIG 7 its multiplexing signal collided with the clock line signal which resulted in random triggering of all MAX7219 on the line, which of course ended up in even greater randomness of LEDs lighting up because i effectively created a feedback loop.
An absolute horror of an error as one can't see where it's coming from or which module is at fault.
Moral of the story: Everything that can go wrong will go wrong (Kudos to Mr. Murphy). Check your privilege PCB and if you think it's fine check it again, because it isn't.
I will now proceed to wear the cone of shame as it took me 3 days to solve this mess which for me is an unrivaled low on my personal scale.
Casualties:
1 Atmega1284p, Died while fighting a 12V PSU Rail connected to it by the moron in front of the desk. R.I.P.
3 MAX7219, Weren't even dead so they have technically been buried alive in my trashcan