0

I have 2 rows of 12 MAX7219 connected in series with DOUT to DIN (rows are isolated). Now the thing is I am using LedControl Library to work with it. The problem is the last 4 Matrices on both the rows don't work. The sequence in my code is like this where (row, column, matrix) is used to define the row and column of the matrix and I am talking about a single ROW from two ROWs of 12.

Sequence in Code      What Happens
----------------      -----------------
(0, 1, 0)             (0, 1, 0)
(0, 1, 1)             (0, 1, 9)
(0, 1, 2)             (0, 1, 1)
(0, 1, 3)             (0, 1, 10)
(0, 1, 4)             (0, 1, 2)
(0, 1, 5)             (0, 1, 11)
(0, 1, 6)             (0, 1, 3)
.                     .
.                     .
.                     .
(0, 1, 11)            (0, 1, 8)

Now I can understand why does this happens. This code works like this even if the Device Count is 8.

Code:

#include "LedControl.h"
LedControl row1=LedControl(2,4,3,12);
LedControl row2=LedControl(5,7,6,12);

unsigned long delaytime=500;

void setup() {
  int d_row1 =row1.getDeviceCount();
  for(int address=0;address<d_row1;address++) {
    row1.shutdown(address,false);
    row1.setIntensity(address,15);
    row1.clearDisplay(address);
  }

  int d_row2 =row2.getDeviceCount();
  for(int address=0;address<d_row2;address++) {
    row2.shutdown(address,false);
    row2.setIntensity(address,15);
    row2.clearDisplay(address);
  }
}

void loop() { 
  int devices=row1.getDeviceCount();
  for (int i = 0; i < devices; i++){
    delay(delaytime);
    row1.setLed(i,0,0,true);
    row2.setLed(i,0,0,true);
    delay(delaytime);
    row1.setLed(i,0,0,false);
    row2.setLed(i,0,0,false);
  }
}

EDIT I just noticed something, there is no data going to the last 4 matrices. The timings of the blinking of the LEDs on last 4 matrices does not ties correctly (500ms) but it is in fact 250ms (i.e. half time). It means the blinks on last 4 matrices are between pulses of the first 4 matrices.

1

Looking at your library source, it seems the number of devices is clamped at 8. This isn't a hard limit imposed by the chip but rather practical design. SPI, especially at high speeds, can get unreliable when the bus capacitance, related to the cable lengths, gets so high that signals are skewed beyond recognition. Also the buffer in the library used to hold the row data is 64 bytes in size, intended to hold the data for 8 devices with 8 rows each.

You can edit the library to make it support 12 devices though it will require attention to detail like, increasing the buffer to 96 bytes, getting rid of short-circuits within the methods that make sure that no more than 8 devices can be addressed, for-loops, etc.

| improve this answer | |
  • That was the case. I am not that good with C and buffer things. So I abandoned this Library for something else. I did try changing the buffers and stuff but I failed, So I thought, instead of trying to customize this Library, I should look for something else as my changes would mean Library is working outside its recommended features. So... yeah... – echo_salik May 1 '17 at 8:01
  • @echo_salik You can post your solution here (another library?) and accept your answer so that this question is moved off the stack. – SoreDakeNoKoto May 1 '17 at 22:28
  • Ah yes. Sure. Sorry, forgot. :) – echo_salik May 2 '17 at 15:36
0

Have you checked the wiring between matrices and/or swapped modules in case there is a faulty one in the sequence?

| improve this answer | |
  • yes I did check and it works. When any other module is swapped with that position, same bug. – echo_salik Mar 2 '17 at 11:52
0

After fiddling around with various Libraries, I came across this one.

MD_MAX72XX

It has all the functionalities that I needed with a good Simple Wiki to get you started.

Also it is simple enough that even a noob like me could figure it out.

Regards

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.