TLC5940 PWM Driver - Page 2 - Project Showcase - Netduino Forums
   
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

TLC5940 PWM Driver


  • Please log in to reply
25 replies to this topic

#21 Nevyn

Nevyn

    Advanced Member

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

Posted 02 May 2012 - 05:24 PM

could we have a Fritzing schema to follow (or any equivalent mapping of the wires from Netduino to the TLC5940), NOT using an external GSCLK signal (not anyone wants to fade... maybe many want to be able to switch between different discrete predetermined levels).

If you do not provide a GSCLK signal then you only have two levels open to you - on or off. Here's the basic algorithm for setting these levels:

1 - Load the counter with 4096 and the clock pulse counter with 4096.
2 - For each LED with a counter value > 0, turn the LED on, otherwise turn the LED off.
3 - When the clock signal changes decrement all of the LED counters by 1.
4 - Decrement the clock pulse counter.
5 - If the clock pulse counter is greater than 0 then go back to step 2.

If the clock is not connected to some changing signal then you will never get past step 3. Not tried this, but if you want to go down this route then I would try connecting GSCLK to high. However, if you want this then there are probably cheaper ways of doing it.

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


#22 Kermit

Kermit

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationCittà di Castello, Italy

Posted 02 May 2012 - 06:01 PM

Hi Mark, and thanks for your help. It looks like I totally misunderstood the role of the GSCLK signal, so I have to study again the documentation... :-( To clarify my goals: I want to have many PWM outputs controlled by Netduino, so I thought that an SPI chain of TLC5940's could be ideal, but the chip has much more functionalities I don't need at all. What I would need is: set the PWM 12 to 40%, make something else for five seconds, then set PWM 8 to 80%, then after two seconds more, re-set the PWM 12 to 0%, and so on. Nothing to fade in real time, no corrections, no adjustments of any type. I think I would use only a fraction of the chip capabilities, but that's ok, for me. Only, it has to be simple, I (still) don't have much experience on electronics... Thanks again. Andrea

#23 Nevyn

Nevyn

    Advanced Member

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

Posted 02 May 2012 - 06:26 PM

To clarify my goals: I want to have many PWM outputs controlled by Netduino, so I thought that an SPI chain of TLC5940's could be ideal, but the chip has much more functionalities I don't need at all.
What I would need is: set the PWM 12 to 40%, make something else for five seconds, then set PWM 8 to 80%, then after two seconds more, re-set the PWM 12 to 0%, and so on. Nothing to fade in real time, no corrections, no adjustments of any type.

The chips can be chained - I chained two and no more for the demonstration.

You do not need to use the adjustments if you do not want to. I would suggest that you preload the chip with a dot correction of 0 on startup. I found this necessary for something I was working on this week. I have one LED which refused to become bright and it must have had a random value in the dot correction register when the system started.

If yo need a PWM output then this can allow this but then again there are a number of other chips out there which will allow the same thing.

Hope this helps,
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


#24 Kermit

Kermit

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts
  • LocationCittà di Castello, Italy

Posted 02 May 2012 - 08:42 PM

Hope this helps??? Sure it does! :-) So, for example, could you point me to some chainable ICs for multiplying PWMs? As of tonight, I still cannot even light a LED with your code, I think I'm missing something with the wiring, but I don't know why... Thanks any time! :-) Andrea

#25 wckronholm

wckronholm

    New Member

  • Members
  • Pip
  • 1 posts

Posted 09 March 2013 - 08:15 AM

Hi Mark,

 

I'm trying to implement your code on a netduino plus 2. As written, your code wouldn't compile because of some errors in C# complaining about the blank, vprg, and xlat optional parameters not being compile-time constants. (This is in the Tlc5940.cs file.) I changed the code so that the only optional parameter for the Tlc5940 class is the number of leds. Then I changed the code to define the blank, vprg, and xlat pins as follows:

 

_blank = new OutputPort(Pins.GPIO_PIN_D9, true);                                   // BLANK = H turns the outputs off.

 

_vprg = new OutputPort(Pins.GPIO_PIN_D8, false);
_xlat = new OutputPort(Pins.GPIO_PIN_D7, false);
 
I'm wiring everything up with the circuit designed on your blog. But I'm getting very erratic behavior. When trying to pulse just one LED, it seems like random LEDs light up at random brightness levels. (Your bouncing LEDs and breathing demos also display strange behavior.) Any tips on what to trouble shoot?
 
Cheers,
-Bill


#26 Nevyn

Nevyn

    Advanced Member

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

Posted 10 March 2013 - 04:02 PM

Hi Mark,

 

I'm trying to implement your code on a netduino plus 2. As written, your code wouldn't compile because of some errors in C# complaining about the blank, vprg, and xlat optional parameters not being compile-time constants

I'm wiring everything up with the circuit designed on your blog. But I'm getting very erratic behavior. When trying to pulse just one LED, it seems like random LEDs light up at random brightness levels. (Your bouncing LEDs and breathing demos also display strange behavior.) Any tips on what to trouble shoot?

First thoughts are that this code was originally written for the Mini and so you will need to make the necessary to the references and this may make a difference to the Pins used.  The fact that the compiler is complaining rings alarm bells regarding the correct libraries being referenced.

 

Which version of the the firmware to you have installed on the N+2?  There were some bugs in the SPI on the N+2 when it was first released. I'd make sure that you have the very latest firmware installed.

 

Do you have a logic analyser available to you?  Can you determine of the data on the SPI bus is valid?

 

You could also try to make sure that the grey scale dot correction data is set to 0.

 

Hope this helps,

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





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.