TLC5940 - Page 2 - General Discussion - 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


  • Please log in to reply
61 replies to this topic

#21 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 09 May 2012 - 10:49 AM

I use a shield from Sparkfun, not all pins are exposed there (notably VPRG), but for now it'll do. I actually wanted to ask if there is anyone interested in code like this. Maybe I should just put it on Sourceforge?

Sounds interesting, definitely interested!
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#22 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 11:29 AM

I'm working on a driver for the Tlc5940 for Netduino. I use the PWM ports from the Netduino to control the BLANK and GSCLK cycles, and the output looks pretty smooth to me, no flicker whatsoever. I have a GSCLK period of 2 microseconds, BLANK on 4096 times that, so roughly 10 ms per PWM cycle. Communication on the SPI port runs at about 40 MHz (if I can believe the documentation ;) ), I don't see any noticable interruptions when switching the signals.

I use a shield from Sparkfun, not all pins are exposed there (notably VPRG), but for now it'll do. I actually wanted to ask if there is anyone interested in code like this. Maybe I should just put it on Sourceforge?


...mmmmmmm... why do you think I could be interested? :-))))))))))
Apart from jokes, I already thank you so much, moreover, I hope you can share the schematic too, I'm only a software guy, and I found a lot of problems to wire cables and components correctly...
I'm *really* waiting for you! :-)
Thanks again
Andrea
P.S. You can also attach files just here... :-)

#23 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 09 May 2012 - 02:11 PM

P.S. You can also attach files just here... :-)


Ok, let's start with that. I think the driver will need some work still. I'll post code and pictures when I get back home tonight.

#24 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 06:54 PM

Ok, let's start with that. I think the driver will need some work still. I'll post code and pictures when I get back home tonight.


I hope to find you online... in which timezone are you? What do you mean by 'tonight'? :-)
Andrea

#25 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 06:55 PM

Ops... I see you are using a breakout board: so maybe there is some component inside that I cannot be able to replicate... :-( Andrea

#26 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 09 May 2012 - 07:11 PM

So my basic setup is like this Netduino port tlc pin 13 SCLK 11 SIN 10 BLANK 9 XLAT 5 GSCLK Then ground and Vcc and Vin to 0, 5, 5. XLAT is on a PWM port, I know, but that's not necesary, really. - BLANK and GSCLK drive the basic PWM process - SIN and SCLK used for SPI send data - XLAT signals that the last 192 bits were data. I attach what I have so far, I think I'll put it up on Sourceforge somewhere when it's more stable. Sorry, I'm just working on this for 2 evenings now ;) I think I need to write a value 0 to get a 100% duty cycle, and 4096 for a 0% cycle. Attached File  PWMSample.cs   2.59KB   29 downloads Attached File  Tlc5940.cs   9.69KB   30 downloads

#27 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 07:16 PM

I'm going home, I'll give it a try as soon as I can, but I fear that I don't have the right passive components around the chip, and I'm not able to derive them from the datasheet :-( Andrea

#28 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 09 May 2012 - 07:29 PM

@Andrea: Netherlands. Can't seem to find how to edit that in my profile :/ I was at work this afternoon, this is just hobbying arounf at home. I'm not using any special parts, so you should be ok. Put VPRG to ground, DCPRG to +5, and I think you can ignore SOUT, XERR. Only one I'm not sure about is IREF. On the layout from Sparkfun, it just shows two resistors to ground. In the datasheet, it says that the resistor to ground programs the max current per channel. On my board it's apparently about 2k2. Do you have the datasheet? I think the 2k2 gives about 20 mA max current.

#29 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 09 May 2012 - 07:42 PM

@Andrea: Netherlands. Can't seem to find how to edit that in my profile :/ I was at work this afternoon, this is just hobbying arounf at home.

Goedenavond ;)
You can edit your profile here: http://forums.netdui...rcp&tab=members

In the datasheet, it says that the resistor to ground programs the max current per channel. On my board it's apparently about 2k2. Do you have the datasheet? I think the 2k2 gives about 20 mA max current.

According to the schematic, it's not such a difficult set-up.
The 2k2 resistors are, according to the description "to make this board suitable for use with servos".
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#30 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 08:14 PM

Goedenavond ;)
According to the schematic, it's not such a difficult set-up.
The 2k2 resistors are, according to the description "to make this board suitable for use with servos".


This is really strange: at the end of page 14 of the datasheet (http://www.ti.com/li...ink/tlc5940.pdf) there is the formula to use for the resistor.

Iout = 39.06 / R (simplified)

with the range of 5mA and 120mA.
I use a 100 Ohm resistor (but I could never light any led!) giving an output of 39mA, with your resistor you should have 0.017mA, way under the lower limit.

Are you sure there are no other components wired to Iref?
Andrea

#31 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 08:16 PM

I've now seen the schematic (at last I could find a sharp reference! :-)): there are TWO resistor, so the formula is different. You can read it directly, and correctly, on that schematic. Wonderful, I try to replicate that schematic right now! :-) Andrea

#32 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 08:22 PM

@nzc: why did you say vprg is not wired out? From the pictures and the schematic, it looks just right there! Andrea

#33 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 09:09 PM

@NZC I thank you really much, because at last I found my problem: one of the wires I use on my breadboard was partially broken, or better, could not make a right contact on the netduino. Since I saw that the led pulsed erratically, I started to change the wires one by one, and I found the faulty one. Once I changed it, everything was ok!!! :-(((((((((( If you didn't gave me all the indications to have a functioning solution (thanks to the schematic on sparkfun too!) I could never think to a faulty wire! :-) Andrea

#34 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 09 May 2012 - 09:10 PM

@nzc: why did you say vprg is not wired out? From the pictures and the schematic, it looks just right there!
Andrea


It's wired, but you cannot set a value directly on it on the Sparkfun board. It's not wired to a terminal. There are a bunch of small holes, I guess I could solder it to one of those if needed. I just hooked it up to a small scope, and the output looks fine to me. I am hooking up an RGB led to it. I see red and blue ok, but somehow the signal collapses quite a bit when the LED is connected. Oh well, that's for tomorrow. Off to bed for me ;)

#35 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 09 May 2012 - 09:14 PM

@NZC
I thank you really much, because at last I found my problem: one of the wires I use on my breadboard was partially broken, or better, could not make a right contact on the netduino. Since I saw that the led pulsed erratically, I started to change the wires one by one, and I found the faulty one. Once I changed it, everything was ok!!! :-((((((((((
If you didn't gave me all the indications to have a functioning solution (thanks to the schematic on sparkfun too!) I could never think to a faulty wire! :-)
Andrea


NP! Happy to help. I'll brush up the code a bit and put it on sourceforge or so. Isn't there a central repo to place modules like this?

#36 Kermit

Kermit

    Advanced Member

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

Posted 09 May 2012 - 09:28 PM

Not that I know of... :-( Good night, and thank you again! Andrea

#37 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 09 May 2012 - 09:30 PM

NP! Happy to help. I'll brush up the code a bit and put it on sourceforge or so. Isn't there a central repo to place modules like this?

Not a central one, I manage a repo myself at www.netmftoolbox.com though. Setting up a codeplex repo isn't difficult at all :)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#38 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 10 May 2012 - 11:31 AM

@Andrea: about the resistor on IREF: yes, page 14 of the datasheet. Good point: I actually see my current being limited to 1.7 mA! I was wondering about that. I should get a smaller resistor to fix that for my setup :) Thanks for the heads-up.

#39 Kermit

Kermit

    Advanced Member

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

Posted 10 May 2012 - 11:37 AM

@Nzc: I'm using your code, but in my case I see a great flicker, when changing values. I'm stepping inside to understand if I can improve it, or at least understand where is the problem, on my side. Andrea

#40 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 10 May 2012 - 04:52 PM

@Andrea: hm, strange... the output looks completely smooth here, even at the lowest level (step 1). Do you see the flicker at low signal levels, or only when switching?




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.