question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recommended approach to reset MAX7219 devices?

See original GitHub issue

I’m in the process of trying to figure out why my large (>100 matrices) MAX7219 display board is encountering glitches. I’ve spent a lot of time experimenting with clock speeds, bus transfer rates, and I’ve got something very close to a stable state. Despite being stable for minutes or hours, the most common glitch is that single matrices seem to shut off and on, get stuck pixels, or change contrast for some reason, and it’s not clear why. I’m fairly certain this is not a memory leak or something on the software side causing corrupted signals. That is to say, I don’t think the software is the problem, but that doesn’t mean that there isn’t a software solution to my problem.

Resetting the display fixes the problem. I want to do some debugging to investigate what about the reset process fixes the problem, but aside from running the high level get_device() (from demo_opts), the only methods that I can find to reset the display are the max7219 class’s show() and clear() methods. I’m really not sure which one of the two, or both one after the other, are responsible for resetting the device to a stable state again. It would be great if I could figure out what mechanism is actually “fixing” the devices and cut away any extra cruft that slows down this process so that it could potentially be run repeatedly with minimal latency added to the rendering of subsequent frames.

So, if I can find a way to meet this requirement, my hypothesis is that if I’m rendering frames on the display at a constant rate, I could inject the command that successfully cleans up the glitches every second (framerate+1 frames) or so and it would hopefully be fast enough prevent the glitched matrices from appearing glitched to the human eye, with minimal impact on performance in terms of overall average framerate.

I’m also analyzing the signals using a protocol analyzer and oscilloscope to see if there’s some other reason why the MAX7219 modules are doing this strange behavior. From this perspective, the hypothesis is that the devices being affected by the glitch are missing a clock cycle or something similar and that’s making their shift registers go out of sync from the others in the cascade. Not sure about this yet. Power reads clean on the oscilloscope, signals are 5V0 using a boost converter from the pi’s 3V3 outputs, everything is wired in parallel except the DOUT to DIN pins on each module which are wired in series. I’m using PCBs with 4x MAX7219 chips each, the typical ones found on Amazon and Ebay with 8x8 LED dot matrices. There’s no significant ringing or any other analog weirdness on any of the signal pulses as far as I can see. At this point there’s nothing I can really change with respect to wiring, the clock speed, or the SPI MTU chunk size that seems to make the display glitch less, so I’m hoping I might be able to get closer to a sustainable solution by resetting the devices as quickly as possible on a regular interval.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
drspanglecommented, Dec 9, 2018

Check it out… 20181205_182537

I’m pretty confident that you could daisy chain these pretty much ad infinitum. This huge 5x 4x4 matrix array was exactly what I was trying to do.

1reaction
drspanglecommented, Mar 28, 2018

@thijstriemstra @rm-hull This is still ongoing. I don’t think this is a software issue, I think there’s actually a signal degradation problem with the MAX7219 devices arranged in cascades.

I’m still in the process of developing a PCB that can be used to strap together 4x4 modules so that they’ll work reliably. I’m learning that PCB design takes a lot of time and effort, though, so it might not be reasonable to expect a resolution in the very short term.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MAX7219 turning off? - LEDs and Multiplexing - Arduino Forum
Resetting it will get things going again but then it'll blank out after a bit. ... and the corresponding maximum recommended segment current...
Read more >
Tutorial – Arduino and the MAX7219 LED Display Driver IC
And for good reason, it's a simple and somewhat inexpensive method of controlling 64 LEDs in either matrix or numeric display form.
Read more >
Luma.LEDMatrix Documentation - Read the Docs
Python library interfacing LED matrix displays with the MAX7219 driver (using SPI) ... clear() (luma.led_matrix.device.max7219 method), 18.
Read more >
MAX7219 : Learn How to Easily Drive 64 LEDs using 3 wires.
The most important point is that multiple MAX7219 devices can be cascaded together ... TIP: The above method can be used to identify...
Read more >
Raspberry PI MAX7219 driver - Read the Docs
This library supports: multiple cascaded devices; LED matrix and seven-segment variants. max7219 matrix. Python Usage¶. For the matrix device, initialize ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found