Problem with TLC5940

Dear community

I want to use the TI TLC5940 led driver to build a module.
It can be controlled via SPI, that’s not the problem.
But as described in the datasheet it needs a reference clock for grayscale PWM control on pin GSCLK.
I googled a while and only found a few AVR and arduino examples. They always use timer interrupts to do that.
There are also matches that use NetMF. First one is this:
http://www.ghielectronics.com/community/forum/topic?id=5475

and the second one (netduino) is that:

I simply don’t understand how I can get the count for the GSCLK pin.
In the first article the threadstarter wrote about “LPC2387” to generate the signal.
Altough Brett described the meaning of it, I don’t get it :frowning:

And in the second article, an external circuit is used (I don’t have enough skills to understand the usage of the components, so I would avoid to use that solution).

So can someone tell me what “LPC2387” means, or are there other solutions the get the signal? Maybe using an AVR only for that?

Regards
Dominik

Hi Dominik,

LPC2387 is the microcontroller/processor on many of the Fez boards. It’s the chip that has the micro framework loaded.

In your case, you’ll need to tell us what device you’re going to use. As this example shows, http://www.ghielectronics.com/community/codeshare/entry/362 it uses register access, which is largely processor specific (this example talks about the Panda processor). Direct register changes allows you to make the processor do specific things that netmf doesn’t give you access to do - in this case, I think the changes are to allow specific timing to be generated on a pin.

I haven’t looked at the datasheet for TLC5940, but I suspect that you can’t actually just use a PWM signal - what exactly did you mean by “get the count for the GSCLK”?

Ah okay I understand, thank you Brett.
I actualy wanted to build a module with the TLC5940 on it using a S socket, so I don’t know which processor is used =/

To describe the function of GSCLK, I quote the datasheet page 19:

[quote]
GRAYSCALE PWM OPERATION
The grayscale PWM cycle starts with the falling edge of BLANK.
The first GSCLK pulse after BLANK goes low increases the grayscale counter by one and switches on all OUTn with grayscale value not zero.
Each following rising edge of GSCLK increases the grayscale counter by one.
The TLC5940 compares the grayscale value of each output OUTn with the grayscale counter value. All OUTn with grayscale values equal to the counter values are switched off.
A BLANK=H signal after 4096 GSCLK pulses resets the grayscale counter to zero and completes the grayscale PWM cycle (see Figure 21).
When the counter reaches a count of FFFh, the counter stops counting and all outputs turn off. Pulling BLANK high before the counter reaches FFFh immediately resets the counter to zero.[/quote]

So I think I need a counter that counts up to 4096 and then toggles BLANK and resets the counter.

@ dominik38 - are you fixed on using that chip?

there are much easier chips using spi like the ws2803 which is also cheaper.

Unless you need to sync the control to the PWM control, then I don’t really think you need the counter on the processor. The second example you pointed out seems to just have a simple oscillator (555 timer in testing, and a crystal) so you could just try a PWM pin. So you will need a combination of pins or even two sockets, to allow you to put this on a module. As Justin says, maybe there are other options you should look at, unless you’re specifically trying to use this chip?

@ Justin - no I’m absolutely not fixed to that chip
But I found an Arduino example and thought it would be nice to build a module with it :smiley:
If it would be to complicated (or much easier to use another chip) I’ll look for a another chip.

@ dominik38 - i have used the WS2803 alot as they are cheap and very easy to use.
more than happy to help you build a module using it…

Okay I thinks it would be the wrong desicion not to use another chip.
I will read about the WS2803 the next days :slight_smile:
Thank you for your help!

@ dominik38 - ping me an email when ever you want about the 2803, i also have plenty of them if you want some…

Justin at ingenuitymicro dot com

Okay thank you Justin :smiley:

I’ve used the 5940 before. It needs a lot of babysitting. Basically you strobe data into the chip, then wiggle the clock pin 4096 times. It is not suitable for a .NETMF device.

Well I decided to use the WS2803 instead. Good suggestion from Justin :smiley: