Cascading MAX7221 problem

Hi all, I've got 3 displays with each 8 digits controlled by 3 MAX7221 They all work perfectly independently but now I wanted to cascade them. So I connected the CLK, Load all together and Datain is going from Arduino to first MAX then from DATAOUT to next MAx (DataIn) and finally from Dataout to the last Max (Datain) They all light up when I set all chars to 0 and disconnect the USB cable (arduino running from external 12V power supply). However when I connect the USB cable to control the displays with Serial only the 3rd one lights up. The code I am using the displays with is the following:

#include "LedControl.h"

LedControl MCP=LedControl(7,6,5,3);  

LedControl LED1=LedControl(12,11,10,1);
LedControl LED2=LedControl(12,11,10,1);

int ready=1;
 

void setup() {
  Serial.begin(115200);
  MCP.shutdown(0,true);
  MCP.shutdown(1,true);
  MCP.shutdown(2,true);
  
  
  MCP.shutdown(0,false);
  MCP.shutdown(1,false);
  MCP.shutdown(2,false);
  
  
  
  LED1.shutdown(0,false);
  LED2.shutdown(0,false);
  
  MCP.setIntensity(0,2);
  MCP.setIntensity(1,2);
  MCP.setIntensity(2,2);
  
  LED1.setIntensity(0,8);
  LED2.setIntensity(0,8);
  
  MCP.clearDisplay(0);
  MCP.clearDisplay(1);
  MCP.clearDisplay(2);
  
  MCP.shutdown(0,true);
  MCP.shutdown(1,true);
  MCP.shutdown(2,true);
  
   MCP.shutdown(0,false);
  MCP.shutdown(1,false);
  MCP.shutdown(2,false);
  
  LED1.clearDisplay(0);
  LED2.clearDisplay(0);
  
  MCP.setChar(0,0,0,false);
  MCP.setChar(0,1,0,false);
  MCP.setChar(0,2,0,false);
  MCP.setChar(0,3,0,false);
  MCP.setChar(0,4,0,false);
  MCP.setChar(0,5,0,false);
  MCP.setChar(0,6,0,false);
  MCP.setChar(0,7,0,false);  
  
  MCP.setChar(1,0,0,false);
  MCP.setChar(1,1,0,false);
  MCP.setChar(1,2,0,false);
  MCP.setChar(1,3,0,false);
  MCP.setChar(1,4,0,false);
  MCP.setChar(1,5,0,false);
  MCP.setChar(1,6,0,false);
  MCP.setChar(1,7,0,false);
  
  MCP.setChar(2,0,0,false);
  MCP.setChar(2,1,0,false);
  MCP.setChar(2,2,0,false);
  MCP.setChar(2,3,0,false);
  MCP.setChar(2,4,0,false);
  MCP.setChar(2,5,0,false);
  MCP.setChar(2,6,0,false);
  MCP.setChar(2,7,0,false);
 
  
}

void loop() {
    char incomingByte;
incomingByte = Serial.read();

if (incomingByte == 'L'){
  Serial.println("");
  Serial.println("LED");
functionLED();
}

if (incomingByte == 'S'){
  Serial.println("");
  Serial.println("7 Segment");
function7Segment();

}


  
  
}

void functionLED() {
char lcnumber = Serial.read();
  Serial.println("");
  Serial.println("Driver number: ");
  Serial.print(lcnumber);
char posx = Serial.read();
  Serial.println("");
  Serial.println("Position x: ");
  Serial.print(posx);
char posy = Serial.read();
  Serial.println("");
  Serial.println("Position y: ");
  Serial.print(posy);
char onoff = Serial.read();
  Serial.println("");
  Serial.println("The LED should be: ");
if (onoff == '0') {
  Serial.println("OFF");
if (lcnumber == '0'){
LED1.setLed(0,posx,posy,false);
Serial.print(ready);
}
if (lcnumber == '1'){
LED2.setLed(0,posx,posy,false);
Serial.print(ready);
}

}
else {
  Serial.println("ON");
if (lcnumber == '0'){
LED1.setLed(0,posx,posy,true);
Serial.print(ready);
}
if (lcnumber == '1'){
LED2.setLed(0,posx,posy,true);
Serial.print(ready);
}

}



}


void function7Segment() {
  Serial.println("");
  Serial.println("The display addressed is: ");
  char Display;
Display = Serial.read();

if (Display == '0'){
  Serial.println("");
  Serial.println("CRS L: ");
CRSL();
}
if (Display == '1'){
  Serial.println("");
  Serial.println("SPD: ");
SPD();
}
if (Display == '2'){
  Serial.println("");
  Serial.println("HDG: ");
HDG();
}
if (Display == '3'){
  Serial.println("");
  Serial.println("Altitude: ");
ALT();
}
if (Display == '4'){
  Serial.println("");
  Serial.println("Vertical Speed: ");
VSPD();
}
if (Display == '5'){
  Serial.println("");
  Serial.println("CRS R: ");
CRSR();
}

}

void CRSL() {
char digOne;
digOne = Serial.read();
  Serial.print(digOne);
MCP.setChar(0,0,digOne,false);
char digTwo;
digTwo = Serial.read();
  Serial.print(digTwo);
MCP.setChar(0,1,digTwo,false);
char digThree;
digThree = Serial.read();
  Serial.print(digThree);
MCP.setChar(0,2,digThree,false);
Serial.print(ready);
}

void SPD() {
char digOne;
digOne = Serial.read();
  Serial.print(digOne);
MCP.setChar(0,4,digOne,false);
char digTwo;
digTwo = Serial.read();
  Serial.print(digTwo);
MCP.setChar(0,5,digTwo,false);
char digThree;
digThree = Serial.read();
  Serial.print(digThree);
MCP.setChar(0,6,digThree,false);
char digFour;
digFour = Serial.read();
  Serial.print(digFour);
MCP.setChar(0,7,digFour,false);
Serial.print(ready);
}

void HDG() {
char digOne;
digOne = Serial.read();
  Serial.print(digOne);
MCP.setChar(1,0,digOne,false);
char digTwo;
digTwo = Serial.read();
  Serial.print(digTwo);
MCP.setChar(1,1,digTwo,false);
char digThree;
digThree = Serial.read();
  Serial.print(digThree);
MCP.setChar(1,2,digThree,false);
Serial.print(ready);
}

void ALT() {
char digOne;
digOne = Serial.read();
  Serial.print(digOne);
MCP.setChar(1,3,digOne,false);
char digTwo;
digTwo = Serial.read();
  Serial.print(digTwo);
MCP.setChar(1,4,digTwo,false);
char digThree;
digThree = Serial.read();
  Serial.print(digThree);
MCP.setChar(1,5,digThree,false);
char digFour;
digFour = Serial.read();
  Serial.print(digFour);
MCP.setChar(1,6,digFour,false);
char digFive;
digFive = Serial.read();
  Serial.print(digFive);
MCP.setChar(1,7,digFive,false);
Serial.print(ready);
}

void VSPD() {
char digOne;
digOne = Serial.read();
  Serial.print(digOne);
MCP.setChar(2,0,digOne,false);
char digTwo;
digTwo = Serial.read();
  Serial.print(digTwo);
MCP.setChar(2,1,digTwo,false);
char digThree;
digThree = Serial.read();
  Serial.print(digThree);
MCP.setChar(2,2,digThree,false);
char digFour;
digFour = Serial.read();
  Serial.print(digFour);
MCP.setChar(2,3,digFour,false);
char digFive;
digFive = Serial.read();
  Serial.print(digFive);
MCP.setChar(2,4,digFive,false);
Serial.print(ready);
}

void CRSR() {
char digOne;
digOne = Serial.read();
  Serial.print(digOne);
MCP.setChar(2,5,digOne,false);
char digTwo;
digTwo = Serial.read();
  Serial.print(digTwo);
MCP.setChar(2,6,digTwo,false);
char digThree;
digThree = Serial.read();
  Serial.print(digThree);
MCP.setChar(2,7,digThree,false);
Serial.print(ready);
}

I hope you can help me because this is really annoying!!!!

All the best,
marc

I found out by accident what was wrong: The arduino was too close to the chips... That is why only the 3rd one worked - it was on the other side of the panel...

Hi looks like you are sending the code to a flight simm, I am trying to do the same. FS 2004, PM. B777
sim. hows it going?. I have been using the EPIC hardware for many years but it, the EPIC is old a lots of problems. I am going to replace it with the Adruino and write all the code, so far so good but trouble with displays. Ron.

hey, we are a developer team, called XPANDT - our current homepage is on facebook, XPANDT (x-plane avr networking development team) however we will finish our own homepage soon. We are developing two pieces of software, a handler to interact with an IOCP server and the software for the arduino. You will find more information on facebook.

all the best,
Marc