Go Down

Topic: help with texas instruments tlc5940 (Read 1 time) previous topic - next topic


Jan 09, 2007, 05:22 am Last Edit: Jan 09, 2007, 05:23 am by yiyi Reason: 1
I purchased a few texas instruments tlc5940(http://focus.ti.com/docs/prod/folders/print/tlc5940.html) led drivers to play around with. These are the first integrated circuits that I am trying to work with, and I haven't been able to get it to work.

After going over the datasheet many times over the past few days and trying 100 different things, I feel it is time to ask for some help.
My current setup on my breadboard is the following:
TLC5940 pin:    Connected to
28(out0):        led to gnd
27(vprg):        gnd
26(sin):         arduino pin 2
25(sclk):        arduino pin 3
24(xlat):        arduino pin 4
23(blank):       arduino pin 5
22(gnd):         gnd
21(vcc):         +5v
20(iref):        220 ohm resistor to gnd
19(dcprg):       gnd
18(gsclk):       arduino pin 9
17(sout):        arduino pin 10
16(xerr):        no-connection
all other pins:   no-connection

The following is the code I am trying to achieve this goal with.
Code: [Select]
int gsClk = 9;
int sIn = 2;
int sClk = 3;
int xlat = 4;
int blank = 5;

int sOut = 10;

void setup()
 pinMode(sIn, OUTPUT);
 pinMode(sClk, OUTPUT);
 pinMode(xlat, OUTPUT);
 digitalWrite(xlat, LOW);
 for(int x = 0; x < (196); x++)
   digitalWrite(sIn, HIGH);
   digitalWrite(sClk, HIGH);
   digitalWrite(sClk, LOW);
 digitalWrite(sIn, HIGH);
 digitalWrite(sClk, HIGH);
 digitalWrite(sClk, LOW);
 digitalWrite(xlat, HIGH);
 digitalWrite(xlat, LOW);
 pinMode(gsClk,   OUTPUT);   // sets the pins as output
 //analogWrite(gsClk, 0xFF);    // was trying to just use pwm for the clock
 pinMode(blank, OUTPUT);
 digitalWrite(blank, HIGH);
 digitalWrite(blank, LOW);
 digitalWrite(sClk, HIGH);
 digitalWrite(sClk, LOW);
 pinMode(sOut, INPUT);

int foo;
void loop()
 for(int x = 0; x < 4096; x++)
  digitalWrite(gsClk, LOW);
  digitalWrite(gsClk, HIGH);
  // 'Greyscale pwm operation' of the datasheet(page 16) says that
 // blank should be pulsed after a full pwm cycle. this works neither pulsing it or not pulsing it
 //digitalWrite(blank, HIGH);  
 //digitalWrite(blank, LOW);

After this starts running, out0 and all other outs show low on my multimeter. xerr and sOut also show low on the multimeter. Is there something that I am missing? Has anyone else worked with this IC and have code that I can look over?


Jan 14, 2007, 09:22 pm Last Edit: Jan 14, 2007, 11:07 pm by ritzdank Reason: 1
well, i´m not sure, if i can help you, but it looks like a hardcore-crash course>>if you are new to electronics and wanna tweak the TLC5940. unfortunately, i don´t have experience with it, but i guess you can limit your errors a bit. or boil the problem down: easily said, you will need 16 12-bit "packets" because it will shift the input with a 192-bit width after a rising edge of XLAT (10ms should be enough). then next  192bit through Sin. i´m not sure, if you really need to use BLANK, cause it´s never mentioned in the timing diagrams. just put it to GND.

you should use delays between HIGH and LOWs, otherwise the IC is not capable to detect a raising or falling edge!

and increase the size of R(iREF). it is responsible for output current. if you have ordinary LEDs, you can easily take a 1,9kOhm resistor, as you will have 20mA on each output.

Hopefully, there are other users who experimenting with TLC5940, as for me it is unclear, if you can talk to it with SPI, or the serial interface just looks like an SPI interface. if so, where is Chipselect?!

good luck!

Go Up