DEV Community

Cover image for Frame Consistency in Embedded LED Systems **Why hardware drivers like MAX7219 don’t solve the real problem**
Alex Rosito
Alex Rosito

Posted on

Frame Consistency in Embedded LED Systems **Why hardware drivers like MAX7219 don’t solve the real problem**

After the 74HC595 flicker article, someone will inevitably ask: "Why not just use a MAX7219? It handles everything in hardware." It's a fair question. The answer is more nuanced than most tutorials admit.


The MAX7219 Is Not a Solution to a Software Problem

The MAX7219 is an excellent chip. It handles multiplexing internally, provides constant current regulation, has its own digit buffer, and communicates over SPI. Compared to two cascaded 74HC595s and hand-rolled multiplexing, it looks like a massive upgrade.

And for hardware reliability, it is.

But here's what nobody tells you: the MAX7219 doesn't know what a valid display state looks like. That's still your job.


What the MAX7219 Actually Takes Off Your Plate

To be fair, let's be specific about what it solves:

  • Multiplexing timing — handled internally, no refresh loop needed in firmware
  • Ghosting from latch timing — not a problem because the chip manages its own output stage
  • Brightness control — built-in PWM, adjustable via SPI command
  • Constant current — no current-limiting resistors per segment

That's real. That's valuable. If you're moving from bit-banged 74HC595 code to MAX7219, you will see immediate improvement.


What It Doesn't Solve

Here's the part that gets skipped.

Most firmware that drives a multi-digit display still does something like this:

// Update the display with new sensor reading
max7219.setDigit(0, units);
max7219.setDigit(1, tens);
max7219.setDigit(2, hundreds);
max7219.setDigit(3, thousands);
Enter fullscreen mode Exit fullscreen mode

Four separate SPI transactions. Four separate moments where the display is in a partially updated state.

If an interrupt fires between digit 1 and digit 2 — maybe a timer ISR, maybe a sensor read, maybe a UART receive — the display briefly shows a mix of old and new data. The hardware is stable. The frame is not.

The MAX7219 didn't create this problem. It just didn't eliminate it either.


The Real Problem: No Concept of a Frame

The issue is architectural. Most embedded display code has no explicit notion of a complete frame — a moment where all digits are updated atomically and the display shows a coherent state.

Instead, it updates digits one at a time, sequentially, and assumes the whole thing happens fast enough that nobody notices. Usually that's true. Sometimes it isn't — and when it isn't, you get artifacts that look like hardware problems but aren't.

This is the same class of problem as the 74HC595 latch issue, operating at a higher level.

With 74HC595: the problem is at the shift register boundary — partial hardware state during transfer.
With MAX7219: the problem is at the firmware boundary — partial logical state during multi-register update.

Different layer, same root cause.


What QUAD7SHIFT Does That Generalizes

When I built QUAD7SHIFT, I didn't think about any of this explicitly. I just transferred all 16 bits — segments and digit select — in one atomic SPI transaction, then pulsed the latch once. The display never saw a partial state because the design never created one.

That rule — never expose a partial frame to the output stage — turns out to be hardware-independent.

It applies to 74HC595. It applies to MAX7219. It applies to LED matrices driven by MAX7219 chains. It applies anywhere you have a display with more than one register to update.

The implementation changes. The principle doesn't.


A Practical Mental Model

Think of it in two layers:

Layer What it guarantees
Hardware driver (MAX7219) stable, flicker-free scanning of whatever is in its buffer
Firmware that what's in the buffer is always a coherent state

The MAX7219 is excellent at the first layer. It does nothing about the second.

If your firmware never writes partial states — if every update is atomic — then the hardware driver has nothing to hide and everything works cleanly. If your firmware writes partial states, the hardware driver will display them faithfully, partial states and all.


The Next Article

This is part two of a series. The third part steps back from the hardware entirely — and asks why these principles work in the first place.


Alex Rosito — self-taught electronics engineer. ATtiny85 · ESP32 · KiCad · C++

Top comments (0)