Pages: [1]   Go Down
Author Topic: TLC5940.   Is there a max. length of daisy chain?  (Read 1476 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.    

Code:
#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??
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Copenhagen / Denmark
Offline Offline
Edison Member
*
Karma: 6
Posts: 2360
Do it !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA
Offline Offline
Jr. Member
**
Karma: 1
Posts: 81
Arduino rocks my socks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
Tlc.init({numchips}, 0)
(if you don't want to use fades)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

cool~   I'll wait for update!
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Eindhoven, the Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Pages: [1]   Go Up
Jump to: