TLC5940.   Is there a max. length of daisy chain?

Hi. all! I'm using acleone's library version 005. Generally it works so fine, Thanx to Acleone. But when I connected 11th TLC5940 to my daisy chain, the whole chain didn't work at all. First I thought it was because of my wiring mistake - but wasn't. So I tested the example code that I used with another Arduino board which wasn't connected to anything but USB for serial comm.

#include <TLC5940LED.h>
#define NUM_TLCS      11

int counter = 0;

void setup()
{
  Tlc.init(NUM_TLCS);
  Tlc.resetTimers();
  Serial.begin(115200);
}

void loop()
{
  counter++;
  Serial.print(counter);  Serial.print("_");
  for (uint8_t channel = 1; channel <= NUM_TLCS * 16; channel++) {

//  Tlc.set(channel, value (0-4095))   this requires a Tlc.update() to set the values.
    Tlc.set(channel, 4095);
    Tlc.update();
    delay(30);    
  }
Tlc.clear(); // sets all the channels to zero, but doesn't update
 
}

This code sends back signal to IDE everytime it loops. It works perfectly until NUM_TLCS <= 10. When NUM_TLCS is 11 or 12 or more, it just doesn't work at all... hmm..

Anybody had an idea??

Sounds like you are running out of RAM.

You could look at upgrading to the AtMega328 (involves some hacking at the moment) which will give you twice the RAM (2k vs 1k) and twice the program space (32k vs 16k)

Did you check that the library you are using don't have an upper limit to the number of daisychaine IC's it support ?

Looking through the library, I realized the max you can have is 10. This isn't due to RAM usage but because I use an 8-bit (uint8_t) variable to iterate over the array (24 bytes per chip), so 11 * 24 = 264 which is greater than 255 and overflows uint8_t. I'm cleaning up the library and I'll change this code, check the main thread in the development section for updates!

Just fyi, If you aren't using fades, you can free up a lot of ram. The second argument of Tlc.init is how many fades you want to use at once:

Tlc.init({numchips}, 0)

(if you don't want to use fades)

cool~ I'll wait for update!

Hi, I was curios if anyone has managed to get a daisy chain of more than 10 tlc5940's?

I did. In my last project I used a daisy chain of 12 TLC's.
Works fine...

found this on TI PDF Application Report:
LED Display System Module Using Cascading

Figure 1. Cascading Devices
The maximum number of cascading TLC5940 devices depends on the application system and is in the
range of 40 devices. The following equation calculates the minimum frequency required:
f(GSCLK) = 4096 ´ f(update)