Cascading MAX7221 doesn't work as expected

Hi

I'm trying to control 128 leds through 2 cascaded MAX7221 ICs.

Everything seems to be connected correct and the code seems to be right... but there must be a flaw somewhere :slight_smile: Connections are:

  • Data in, latch and clock are connected tot IC 1 from the Arduino
  • Data out on IC 1 is going to Data in on IC 2. Clock and Latch are shared.

This is what happens:

  • Putting in the code that I only use 1 MAX7221 will result in the 2 ICs doing the same thing: when I enable LED 1 than LED 65 will be enabled as well and vice versa.
  • Putting that I'm using 2 MAX7221 ICs will result in 1 IC behaving as expected... the other one not doing anything.

This is the code:

#include <LedControl.h>

// inputs: DIN pin, CLK pin, LOAD pin. number of chips
LedControl mydisplay = LedControl(9, 10, 11, 2);

void setup() {
  mydisplay.shutdown(0, false); // turns on display
  mydisplay.setIntensity(0, 15); // 15 = brightest
}

void loop() {
  for(int i = 0; i < 8; i++)
  {
  for(int j = 0; j < 8; j++)
    {
      mydisplay.setLed(0, i, j, true);
      delay(100);
    }
    delay(100);
  }

  delay(1000);

  for(int i = 0; i < 8; i++)
  {
  for(int j = 0; j < 8; j++)
    {
      mydisplay.setLed(1, i, j, true);
      delay(100);
    }
    delay(100);
  }

  for(int i = 8; i >= 0; i--)
  {
    for(int j = 8; j >= 0; j--)
    {
      mydisplay.setLed(1, i, j, false);
      delay(500); 
    }
  }
  delay(2000);
}

Thanks for any insights! :slight_smile:

I reconnected all wires to be sure that wiring is not an issue and I have the same result. I also updated the ledcontrol.h lib and also seeing the same.

Thanks

second debug was to use separate outputs instead of cascading... everything worked like a charm...

Got it.. I didn't wake up the second one: mydisplay.shutdown(1, false);

Leaving this topic for reference of others facing the same issue.

Stijn:
second debug was to use separate outputs instead of cascading... everything worked like a charm...

Could you give us your final schematic and sketch? THU