# MAX7219 Daisychaining - Data becoming corrupted?

**URL:** <https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495>\
**Category:** LEDs and Multiplexing\
**Created:** [July 16, 2023, 12:14am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495 "2023-07-16T00:14:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamishgreen](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@hamishgreen](https://forum.arduino.cc/u/hamishgreen)\
**Post date:** [July 16, 2023, 12:14am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/1 "2023-07-16T00:14:17Z")

</div>

Hi all,

I'm making a 7 segment display array using 100 x 4 digit, 7 segment displays and 50 x MAX7219 chips.

The first ~60 displays (30 chips) were working great. I then soldered another 20 displays (10 chips) and the data the chips are getting towards the end of the daisy chain are becoming almost random. Sometimes all the displays will work for a short bit as intended, and then sometimes displays will turn on and off at random, change brightness, display weird things etc. (see video).

I've been working on this project for awhile now (this is the 4th iteration of the PCB design!) and I've managed to solve all of the other issues I've run into but this one has me stumped.

My initial thoughts are that there is some sort of interference(?) or something causing this randomness. I've attached a short video of me turning it on and off a couple times, as well as the schematic and the test code I'm running.

Thank you and all help appreciated.

[https://streamable.com/c018vr](https://streamable.com/c018vr)

 ![IMG_54041.PNG](https://europe1.discourse-cdn.com/arduino/original/4X/b/a/6/ba66675c5991a2b77c18137a7045af636e29a0dd.jpeg)

```arduino
#include <SPI.h>

// What pin on the Arduino connects to the LOAD/CS pin on the MAX7219/MAX7221
#define LOAD_PIN 10

void maxTransfer(uint8_t address, uint8_t value) {

  digitalWrite(LOAD_PIN, LOW);

  for (uint8_t i = 0; i < 40; ++i)
  {
    SPI.transfer(address);
    SPI.transfer(value);
  } 
  
  digitalWrite(LOAD_PIN, HIGH);
}
  

void setup() {
  
  // Set load pin to output
  pinMode(LOAD_PIN, OUTPUT);

  // Reverse the SPI transfer to send the MSB first  
  SPI.setBitOrder(MSBFIRST);
  
  // Start SPI
  SPI.begin();

  // Run test
  // All LED segments should light up
  // maxTransfer(0x0F, 0x01);
  // delay(3000);
  // maxTransfer(0x0F, 0x00);
  
  // Enable mode B
  maxTransfer(0x09, 0xFF);
  
  // Use lowest intensity
  maxTransfer(0x0A, 0x00);
  
  // Only scan one digit
  maxTransfer(0x0B, 0x07);
  
  // Turn on chip
  maxTransfer(0x0C, 0x01);
  
}

void loop() {
  
  // Loop through each code
  for (uint8_t i = 0; i < 0x10; ++i)
  {
    maxTransfer(0x01, i);
    maxTransfer(0x02, i);
    maxTransfer(0x03, i);
    maxTransfer(0x04, i);
    maxTransfer(0x05, i);
    maxTransfer(0x06, i);
    maxTransfer(0x07, i);
    maxTransfer(0x08, i);
    delay(1000);
  }
  
}
[7SDA (ATMEGA328P).pdf|attachment](upload://xDPB0vnVzxiI4b09x7ug7zd9MHg.pdf) (3.7 MB)

```

[7SDA (ATMEGA328P).pdf](https://forum.arduino.cc/uploads/short-url/xDPB0vnVzxiI4b09x7ug7zd9MHg.pdf) (3.7 MB)

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [July 16, 2023, 12:19am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/2 "2023-07-16T00:19:45Z")

</div>

- I'd start with checking the voltages down the string.

- Do you have decoupling capacitors on each Vcc pin on all chips ?

- Do you have access to an oscilloscope to look at clocking signal shapes ?

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [July 16, 2023, 12:23am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/3 "2023-07-16T00:23:37Z")

</div>

How are you running the clock signals? Please post a schematic.

---

<div class="post-metadata">

**Author:** ![hamishgreen](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@hamishgreen](https://forum.arduino.cc/u/hamishgreen)\
**Post date:** [July 16, 2023, 12:53am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/5 "2023-07-16T00:53:46Z")

</div>

Hi, thanks for your response.

I checked the voltage at a few of the chips Vcc pins and they're all getting around ~4.6V. This includes the displays that are working normally and those that appear not to be. I've checked the datasheet for the MAX7219 and this is within their operating range.

I have a 10uF and 100nF decoupling capacitor at every chip Vcc - mounted as close to the chip as I could.

Unfortunately I do not have an oscilloscope. Perhaps something I should invest in.

---

<div class="post-metadata">

**Author:** ![hamishgreen](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@hamishgreen](https://forum.arduino.cc/u/hamishgreen)\
**Post date:** [July 16, 2023, 12:55am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/6 "2023-07-16T00:55:08Z")

</div>

Oops, sorry. Forgot to append. It's at the bottom of the post now.

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [July 16, 2023, 12:58am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/7 "2023-07-16T00:58:24Z")

</div>

Okay, thanks. Can you save us some time and answer my question? It looks like all the clock lines are paralleled. What device output is driving that? Discuss.

---

<div class="post-metadata">

**Author:** ![hamishgreen](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@hamishgreen](https://forum.arduino.cc/u/hamishgreen)\
**Post date:** [July 16, 2023, 1:08am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/8 "2023-07-16T01:08:31Z")

</div>

I'm an engineer by trade (mechanical), however electronics is a hobby of mine so I'm by no means super technical with all of this. I'll do my best to describe:

All 50 chips are connected to the clock line in parallel. Initial version of my board were using an Arduino Nano to drive the clock, however, my most recent version I decided to try and teach myself something new by getting rid of the nano and using an ATMega328P. The clock line is connected to 'PB5' of the ATMega, which I believe to be the appropriate SCLK pin.

From the MAX7219 datasheet, my understanding is that the clock should be connected in parallel. I'm not sure if this helps, but below is an image from KiCAD with the clock line highlighted. It might be quite difficult to see so apologies in advance.

Thanks for your help.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/d/0/c/d0ca63e8e5348df82174ccd54ece9f6e578cb803.png)

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [July 16, 2023, 1:10am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/9 "2023-07-16T01:10:50Z")

</div>

> [@hamishgreen](#):
>
> All 50 chips are connected to the clock line in parallel.

You can't do that. The combined capactive load is too great. You need multiple drivers, each one only driving a few loads.

> From the MAX7219 datasheet, my understanding is that the clock should be connected in parallel.

It's written for electrical engineers. The authors assume you know there is a fan out limitation.

---

<div class="post-metadata">

**Author:** ![hamishgreen](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@hamishgreen](https://forum.arduino.cc/u/hamishgreen)\
**Post date:** [July 16, 2023, 1:16am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/10 "2023-07-16T01:16:57Z")

</div>

This is very interesting, thank you. Back to the drawing board and time to order another bunch of displays and drivers!

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [July 16, 2023, 1:34am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/11 "2023-07-16T01:34:36Z")

</div>

Before you commit to a new board, add some dead bug drivers, cut traces and wire into the existing PCB.

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [July 16, 2023, 1:48am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/12 "2023-07-16T01:48:48Z")

</div>

Agree. You can probably save the board with some mods. It will be ugly but can work.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 16, 2023, 2:35am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/13 "2023-07-16T02:35:01Z")

</div>

> [@anon57585045](#):
>
> It will be ugly but can work.

==\> It will be messy but can work.

> [@anon57585045](#):
>
> The authors assume you know there is a fan out limitation.

Fan-out of MAX7219:  
===\> Source Current/Input Current = 2 mA/1 uA = 2000. Is it correct?

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [July 16, 2023, 2:40am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/14 "2023-07-16T02:40:20Z")

</div>

Okay, I think some of my rat's nests are beautiful too. But maybe not other people. 🙂

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [July 16, 2023, 2:47am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/15 "2023-07-16T02:47:25Z")

</div>

Always have some **Kynar 30AWG wire wrap wire** on hand.

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/1/1/9/119d7d5822d552305f7a3301297eb975815f49ed.jpeg)

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 16, 2023, 2:56am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/16 "2023-07-16T02:56:59Z")

</div>

My eye-attractive and heart-satisfying beautiful baby though messy!

 ![6802Kit](https://europe1.discourse-cdn.com/arduino/original/4X/2/5/a/25a35fdba70064ce828b3c5af6017722ffcfe556.png)

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [July 16, 2023, 3:03am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/17 "2023-07-16T03:03:02Z")

</div>

The back looks like a tumbleweed. 🙂 Nice work. I don't think the OP needs that much wire though... or 200m of it...

I've noticed a strange physical property of wire though. It almost always ends up shorter than the length that you carefully measured out to fit somewhere.

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [July 16, 2023, 3:16am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/18 "2023-07-16T03:16:47Z")

</div>

This one is better with dual-colored wires containing less wires as I used 8279 Keyboard/Display Controller.  
 ![8086KitPic](https://europe1.discourse-cdn.com/arduino/original/4X/d/c/5/dc523c63d3207f3952d6972a34ef4e36d6320d43.png)

---

<div class="post-metadata">

**Author:** ![PaulRB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulrb/32/216330_2.png) [@PaulRB](https://forum.arduino.cc/u/PaulRB)\
**Post date:** [July 16, 2023, 8:35am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/20 "2023-07-16T08:35:02Z")

</div>

> [@hamishgreen](#):
>
> time to order another bunch of displays and drivers!

I also think you should attempt to get what you have working before you waste money on another board only to find another problem.

You should only need a buffer chip like 74hc244. Make 3 extra buffered versions of the clock signal and same for the latch signal. After every 25 max chips, break the clock & latch traces and solder a buffered signal to the chip legs.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [July 18, 2023, 4:57am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/21 "2023-07-18T04:57:32Z")

</div>

The SPI bus of a 16Mhz Uno runs AFAIK by default at 4Mhz.  
You can change that to 8MHz or a division of that.  
Try running the bus slower, at 2Mhz or 1Mhz.  
That could get your display working as you have it now.

Replace this line  
`SPI.setBitOrder(MSBFIRST);`  
with  
`SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));`

That will prove your fanout problem.  
Then use buffers, and you maybe can try 8Mhz for a faster display update speed.  
Leo..

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [January 14, 2024, 4:57am UTC](https://forum.arduino.cc/t/max7219-daisychaining-data-becoming-corrupted/1148495/22 "2024-01-14T04:57:35Z")

</div>

Closed on January 14, 2024, 4:57am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
