Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Using the TLC5940 on .NETMF 4.2


  • Please log in to reply
8 replies to this topic

#1 Anshul

Anshul

    Advanced Member

  • Members
  • PipPipPip
  • 50 posts

Posted 25 January 2014 - 11:04 PM

I have been scouring the deepest reaches of the internet for about a week trying to find a working example for using the TLC5940 16-channel PWM driver chip for dimming LED strips, but without any luck. Most of the examples are either incomplete (missing the wiring diagram) or just don't work. Here's a few examples that I couldn't get to work: 

 

1. http://forums.netdui...c/4123-tlc5940/

2. http://forums.netdui...940-pwm-driver/

 

All of these are old, so I'm fairly certain they target .NETMF 4.1. The first one didn't work (http://forums.netdui...c/4123-tlc5940/) because it uses PWM.SetPulse from .NETMF 4.1 which I tried to convert the code to 4.2, but it's still not working.

 

Here is my request: Can someone help me out with a program that simply fades an LED from 0 to full brightness and back to 0, and then repeats, using the TLC5940? 

 

Once I can get a single LED to PWM using the TLC5940, the rest of the work is already done and I have the high-power drivers for the LED strips already built. Thanks for the help.



#2 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 26 January 2014 - 08:00 AM

well, the tlc5940 is a bit a pain with netmf. it needs timing, wich would be nice in native with a timer (thats what i do on arduino)

- its just a mix of a shift register and a counter

 

theres different tlc59xx versions wich dont need a gs clock and a blank signal. they work great for led stuff, but not for led matrixes (flickering cos you cant control the blank line - timing issues)

 

 

btw: in the second links theres a link to nevyn's blog, with some code. that should work "ok" (i still see a timing issue with an external counter like that - you normally sent the new data directly after you blanked the chip)



#3 Anshul

Anshul

    Advanced Member

  • Members
  • PipPipPip
  • 50 posts

Posted 26 January 2014 - 04:48 PM

Do you know which chips do not require an external clock signal? The blog did have a wiring diagram but I don't have the components for creating a clock. Can you post any details on how you implemented it? Especially the wiring diagram and the basic algorithm. Thanks.

#4 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 27 January 2014 - 07:59 AM

Do you know which chips do not require an external clock signal? The blog did have a wiring diagram but I don't have the components for creating a clock. Can you post any details on how you implemented it? Especially the wiring diagram and the basic algorithm. Thanks.

 

For LEDs you can get away without the clock as an external circuit by using PWM.  You really need two signals for the clock and blank control.  The grey scale clock controls the counter inside the chip and the blank signal resets the counters and starts the count sequence again.

 

Try setting up a PWM signal of say 1 MHz (or some other suitably high value) with a 50% duty cycle.  This will be the greyscale clock.

 

Once this is working setup a second PWM which is a single pulse.  These pulses will occur at the greyscale clock frequency from above divided by 4096.  The pulse should be very narrow.

 

Although this will not give an ideal clock for the chip it will be accurate enough for LED control.

 

Regards,Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#5 Anshul

Anshul

    Advanced Member

  • Members
  • PipPipPip
  • 50 posts

Posted 28 January 2014 - 02:45 AM

Once this is working setup a second PWM which is a single pulse.  These pulses will occur at the greyscale clock frequency from above divided by 4096.  The pulse should be very narrow.

 

How do you do this on the Netduino in NETMF 4.2? You can change the frequency and/or period but how would you send a single pulse? 



#6 Anshul

Anshul

    Advanced Member

  • Members
  • PipPipPip
  • 50 posts

Posted 29 January 2014 - 03:22 AM

 

Once this is working setup a second PWM which is a single pulse.  These pulses will occur at the greyscale clock frequency from above divided by 4096.  The pulse should be very narrow.

 

 

 

Is the second PWM the latch signal?

 

I found a programming flowchart (http://www.ti.com/li...106/slvc106.pdf) that I've been following, but I'm still confused as to how exactly the values are moved inside the TLC5940. If some values are shifted out to the outputs, does that output constantly output a PWM signal with that duty cycle?

 

For example if I write out 011111111111 (binary) = 2048 (dec) = 0.5 duty cycle to the first output (OUT0), after I clock out the values by PWMing GSCLK and then pulsing the latch once, will OUT0 output a 0.5 duty cycle until something changes? That's what I thought the chip does but maybe I'm wrong.



#7 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 29 January 2014 - 05:24 AM

Is the second PWM the latch signal?

 

I found a programming flowchart (http://www.ti.com/li...106/slvc106.pdf) that I've been following, but I'm still confused as to how exactly the values are moved inside the TLC5940. If some values are shifted out to the outputs, does that output constantly output a PWM signal with that duty cycle?

 

For example if I write out 011111111111 (binary) = 2048 (dec) = 0.5 duty cycle to the first output (OUT0), after I clock out the values by PWMing GSCLK and then pulsing the latch once, will OUT0 output a 0.5 duty cycle until something changes? That's what I thought the chip does but maybe I'm wrong.

 

The second PWM signal is the "counter reset" signal.  If you do not pulse this pin then the counters start at 4095, count down to zero and then stop.  Pulsing the Blank pin tells the chip to restart.  That it why the pulses should come along every 4096 grey scale clock pulses.

 

The data is latched on the XLAT pulse.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#8 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 29 January 2014 - 05:24 AM

Is the second PWM the latch signal?

 

I found a programming flowchart (http://www.ti.com/li...106/slvc106.pdf) that I've been following, but I'm still confused as to how exactly the values are moved inside the TLC5940. If some values are shifted out to the outputs, does that output constantly output a PWM signal with that duty cycle?

 

For example if I write out 011111111111 (binary) = 2048 (dec) = 0.5 duty cycle to the first output (OUT0), after I clock out the values by PWMing GSCLK and then pulsing the latch once, will OUT0 output a 0.5 duty cycle until something changes? That's what I thought the chip does but maybe I'm wrong.

 

The second PWM signal is the "counter reset" signal.  If you do not pulse this pin then the counters start at 4095, count down to zero and then stop.  Pulsing the Blank pin tells the chip to restart.  That it why the pulses should come along every 4096 grey scale clock pulses.

 

The data is latched on the XLAT pulse.

 

Regards,

Mark


To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#9 Anshul

Anshul

    Advanced Member

  • Members
  • PipPipPip
  • 50 posts

Posted 29 January 2014 - 05:28 AM

The second PWM signal is the "counter reset" signal.  If you do not pulse this pin then the counters start at 4095, count down to zero and then stop.  Pulsing the Blank pin tells the chip to restart.  That it why the pulses should come along every 4096 grey scale clock pulses.

 

The data is latched on the XLAT pulse.

 

Regards,

Mark

 

That clears it up a bit more. One question though, when you say that the data is latched on the XLAT pulse, is that latching the data from the serial input to the GS register or from the GS register to the outputs? 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.