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

#41 Kermit

Kermit

    Advanced Member

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

Posted 10 May 2012 - 05:55 PM

Each time that a duty changes, small or big increment, it looks like there is a black hole, where the led doesn't receive current. If I make a cycle stepping by 1 very quickly, it's really flickering on and off. I didn't have the time to test it thoroughly, I'm sorry: I try to step into the code (and the datasheet) when I have some time for me... :-( Andrea

#42 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 10 May 2012 - 06:42 PM

The way the PWM cycle is controlled, all LEDs are blanked out briefly to restart the cycle (that is the pulse on BLANK). In lines 257 and 258, the clocking periods are explicitly restarted after every GS vector write. In line 244, I first pulled up BLANK, since in the datasheet is mentions this: BLANK should be high when writing the GS data. Some things to try: - Uncomment line 244, maybe on your setup it is somehow more critical to blank the LEDs before writing new data? - Comment out lines 257 and 258. This will keep the GS clock and blank cycles running uninterrupted. I don't see any difference on the output when I look at it. I borrowed an oscilloscope from a collegue at work, all the signals coming from the Netduino look what I expect them to be, inclusing the timing. Do you have any means to check the timing of the signal? If on low levels the LEDs light up smoothly, the timing _should_ be ok, but would be nice to check it on a scope.

#43 Kermit

Kermit

    Advanced Member

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

Posted 10 May 2012 - 08:45 PM

No, I don't have an oscilloscope: with my friend, we are thinking to buy one half and half, just to have it available, but not at the moment. Tonight I'm busy, but thanks for your suggestions: I'll try them tomorrow morning, and yes, I would follow Texas flowchart as strictly as I can. Andrea

#44 Kermit

Kermit

    Advanced Member

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

Posted 11 May 2012 - 10:10 AM

Ok, it looks my problem is just on the electric side of things... :-( To give a +5VDC to the TLC5940 I use and old power supply (variable) that gives a NON stabilized output: so I put a big capacitor between + and - before feeding an L7805 to get the right output. If I check with the voltmeter the positive where I wire a LED and the ground, I see a strange (at least for me) phenomenon: the voltage is something between 4.8 and 5.02, with a period of 10/15 seconds (the program is running, fading on and off a couple of leds). Is it normal, or really I have to find another source of input voltage? Leds are fading with a visible flickering... Andrea

#45 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 11 May 2012 - 11:31 AM

How do you have the LEDs connected to the PWM output? I use Vcc and signal, not signal and ground.

#46 Kermit

Kermit

    Advanced Member

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

Posted 11 May 2012 - 12:33 PM

Sorry, I didn't write the right thing, of course I have the LEDs, and I checked with the voltmeter, between Vcc and signal.

#47 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 11 May 2012 - 12:44 PM

I use the 5V from the Netduino to feed the Vcc. If you only run a few LEDs, that should be sufficient. The 5V should be stable, so if that is visibly flickering, probably better to find a different PSU.

#48 Nevyn

Nevyn

    Advanced Member

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

Posted 11 May 2012 - 02:17 PM

To give a +5VDC to the TLC5940 I use and old power supply (variable) that gives a NON stabilized output: so I put a big capacitor between + and - before feeding an L7805 to get the right output.

Just a thought but I think if you check the data sheet you will find that the high logic level is 0.7 * Vcc. So if you are powering the chip with 5V makes a minimum high signal of 3.5V. The Netduino uses 3.3V for high out but can read 3.3-5V as a high input.

I think you can actually power the chip on 3.3V.

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


#49 Kermit

Kermit

    Advanced Member

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

Posted 11 May 2012 - 03:55 PM

Brilliant idea: it made me think. But, when I tried, I got no output on the leds: even on pins that should be high, voltage difference was very close to zero... Nzc: can you confirm you go on external 5VDC? Andrea

#50 Kermit

Kermit

    Advanced Member

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

Posted 11 May 2012 - 06:29 PM

I made another test: I took an ATX PSU from a computer I don't use, opened it and taken +5VDC and ground. Moreover, before using this power, I put a big big capacitor (100uF, 400VDC), to be sure the voltage is really stabilized. I don't have an oscilloscope, but with a voltmeter I measure 5.01 VDC (constant, for what I can see). Led is still flashing very very quickly (I tried to lower SPI frequency too). The strange thing is that if I check again between VCC and one of the pin, when set to 4000 (fixed, the program stopped at a breakpoint), voltage is floating between about 2.00 and 2.50 (and this explains maybe why the led is flashing). So it looks like (again) it's not a software problem, but an electric problem. I clarify that I'm not pinning VPRG and DCPRG to anything (they are free to float): could this be a problem? Andrea

#51 Nevyn

Nevyn

    Advanced Member

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

Posted 11 May 2012 - 06:39 PM

I clarify that I'm not pinning VPRG and DCPRG to anything (they are free to float): could this be a problem?

VPRG is used to determine if you are programming the DC or the GS registers. If you just want to program the GS registers then tie VPRG to ground.

DCPRG is used to determine if you are using the DC registers or the EEPROM. You should use the DC registers and so need to tie this to Vcc.

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


#52 Kermit

Kermit

    Advanced Member

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

Posted 11 May 2012 - 07:17 PM

@nzc: I tried commenting and uncommenting, but the problem still remains... led is flashing, as I said, even with the program stopped in the debugger. Andrea

#53 Kermit

Kermit

    Advanced Member

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

Posted 11 May 2012 - 09:42 PM

Ok, it looks I have to excuse myself (again!) for the trouble I caused in this thread! :-( I finally found the *REAL* problem I'm having. One of the connectors of my Netduino is faulty ! :-((((((( The block from D8 to Aref is loose, in the sense that I put the wires inside, but it makes a strange contact (I suppose). I don't know how to explain it well in English, but if I put a finger on the wires, not on the connector itself, and push them left (or right, it's the same thing) the contact becomes perfect, and everything is ok (LEDs fade on and off really smoothly!). If only I relax the push (without even taking out the finger completely) and all becomes flashy and flickering. What do I have to do, in a case like this? First option is of course to throw it away, and buy another... but is there anything else to do? I don't think that desoldering it can be the right thing to do... Andrea

#54 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 12 May 2012 - 06:53 PM

Aw.... bad luck for you :( Sounds like a loose connection indeed. If the entire header is loose, resoldering may help. Be sure to check on the borrom of the boards to see whether it is loose. Do you have some soldering wick? It looks like a braided strip. With this, you can properly remove the old solder, then redo the entire header. If the contacts are only a bit loose, just reflowing the existing solder may be sufficient. Be sure to try with some alternative wires to make sure the cables aren't the real culprit! Hope you manage to fix it... I keep my fingers crossed.

#55 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 12 May 2012 - 09:08 PM

One small remarks about the code I posted: when setting up the SPI port, keep the communication speed down to 20 MHz (20000 in the constructor) or so. When I set this to 40 MHz, I see a noticeable flicker when switching. At 20 MHz, all is smooth.

#56 Kermit

Kermit

    Advanced Member

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

Posted 12 May 2012 - 10:08 PM

No, it's really stranger than what I said: if I use directly led+resistor, all is smooth and soft... when using the TLC5940 all changes... :-((( Mario was right, when he said that this is a very strange chip... :-((( I don't know what to do: I changed the breadboard, the wires, and the netduino is perfect, using for example a motor with an L293D, but when I use the TLC, I have to touch the wires, and not always it behaves well... :-( I have three of them, and all show this behaviour! Bewitched chip... I'm sure... :-) Andrea

#57 Kermit

Kermit

    Advanced Member

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

Posted 14 May 2012 - 02:19 PM

Ok, since I didn't give up, and made again all the steps suggested in this, as in other, thread, I finally found (I must have made something wrong on the first trial) what the problem really is: NEVYN was totally right, in the high level limit for the 5VDC used as Vcc. The datasheet is clear, even if I didn't pay too much attention on this: the high level limit is 0.8 * Vcc, so Netduino pins cannot drive the signal high (Nevyn says 0.7, but I think he hadn't the datasheet just in front). When powered by a 3.3 signal, all is smooth and good, under any condition, so I think this is the right solution to have. My only remaining problem is now that some of the pins are always off, some are partially powered, and so on. Now, there are two alternatives... one is that the source code I'm using (by NZC) still has some bug :-))) (no critics, here: you've done a wonderful work!) OR there is some dot correction on the chip (but this looks a little improbable... I never gave it the 20more VCC to write it! Some other test will solve (I hope) the situation! :-) I'll prepare a Fritzing commented diagram for the solution... Andrea

#58 Nzc

Nzc

    Member

  • Members
  • PipPip
  • 17 posts
  • LocationNetherlands

Posted 14 May 2012 - 03:12 PM

If you find any bugs, please send them through, I'm still working on it ;) My current target is the daisy chaining of multiple Tlc-s. The code is very minimal, I'll post an update here when I get it to work. Just a side note: I was discussing this with a colleague here at work, and he told me that these type of PWM drivers usually aren't designed to provide a lot of power to external components. He usually inserts a transistor of FET driven by a high power source. For me, I drive the LEDs from the 5V from the power supply, and then I see a nice 5V block on the scope. If I drive the LEDs from the Tlc, the voltage collapses and I get a block of only ~2V (depending on the exact components of course) About the dot correction: I think it mentions in the datasheet somewhere that by default, the correction factors are 1.0, stored in the Tlc-s EEPROM. You need to explicitly overwrite them by using DCPRG and VPRG. Maybe you hit that accidentally?

#59 Kermit

Kermit

    Advanced Member

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

Posted 14 May 2012 - 03:20 PM

Hi, Nzc, nice to hear from you again, thanks! No, of course I'm not looking for a power output, maybe I already said I'm to use the outputs to feed some L293Ds to control DC motors, so a few milliAmpere are more than enough. But on my side, if I feed (an external and stabilized) 5V I get erratic behaviour from the TLC5940, while with 3.3V (and coming from the Netduino!!!) it's all really perfect and smooth. Dot correction: in the datasheet it's said that to override it I have to give a more than 20VDC, and I'm pretty sure that I don't have such a supply! :-) So each time I turn on the chip, it should have just the factory set (1.0). In your code you don't set the values, so it should be all normal. ...I'm going on with my tests... A

#60 Kermit

Kermit

    Advanced Member

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

Posted 14 May 2012 - 03:31 PM

QUICK UPDATE: I changed the chip (I got 6 of them :-)), and all the outputs (minus one!) are uniform and smooth, so the code, for what I can see, is perfect. One output is kind of flickering, something like 10 20 times a second, but never going completely off, for what I see. The strange thing is that if I move the wires, in some position the flickering goes away. Can it be some sort of interference? Andrea




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.