Pages: [1]   Go Down
Author Topic: TLC5940 Unable to interface with Arduino  (Read 791 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I just got my TLC5940's and have been attempting to get them to work with the Arduino, but so far I get a whole lot of nothing.  An overview of what I've done so far:

Breadboarded the TLC5940 and connected up all the arduino, power, ground, and resistor connections per the example.  I double-checked the connections using a multimeter to verify they're connected properly.

Hooked up 16 led's, one to each output.

Loaded both the basicuse and basicanimation sketches from the library examples.

So far I get absolutely nothing from the Arduino.  The lights all flash on momentarily when I first connect power, but they then go off and stay off.  I have noticed, oddly enough, that if I touch the blank pin (pin 23) the lights all come on.  I've tried 5 different tlc5940's, since I bought several, and I get the same results.  I'm pretty sure the arduino is fine since it runs my other sketches without any hiccups.  Am I doing something wrong?
Logged

Lacomb, Oregon
Offline Offline
Sr. Member
****
Karma: 0
Posts: 302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you attach a good picture of the board setup and the code you are loading? It would help us.
Logged

Stephen

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure.  I realize it looks a bit ugly, but it's just an attempt at establishing communication between the Arduino and the tlc5940.



I connected it like the example, although it's a bit hard to follow since I routed the wires away from the chip.  The example below lays out the connections.  I'm totally new to interfacing chips with other chips, so I might very well have done something wrong.  I have, however, redone the circuit a few times and checked it out multiple times.  I can't figure out what I'm doing wrong.

I'm using the library examples written for this chip, which I got from http://www.arduino.cc/playground/Learning/TLC5940.  I haven't toyed with the code as provided in the example yet, but here it is:

/*
 * Basic Pin setup:
 * ------------                                             ---u----
 * ARDUINO   13|-> SCLK (pin 25)                      OUT1 |1     28| OUT channel 0
 *           12|                                      OUT2 |2     27|-> GND (VPRG)
 *           11|-> SIN (pin 26)                       OUT3 |3     26|-> SIN (pin 11)
 *           10|-> BLANK (pin 23)                     OUT4 |4     25|-> SCLK (pin 13)
 *            9|-> XLAT (pin 24)                        .  |5     24|-> XLAT (pin 9)
 *            8|                                        .  |6     23|-> BLANK (pin 10)
 *            7|                                        .  |7     22|-> GND
 *            6|                                        .  |8     21|-> VCC (+5V)
 *            5|                                        .  |9     20|-> 2K Resistor -> GND
 *            4|                                        .  |10    19|-> +5V (DCPRG)
 *            3|-> GSCLK (pin 18)                       .  |11    18|-> GSCLK (pin 3)
 *            2|                                        .  |12    17|-> SOUT (if daisy-chained, this goes to SIN of the next TLC)
 *            1|                                        .  |13    16|-> XERR
 *            0|                                      OUT14|14    15| OUT channel 15
 * ------------                                             --------
 *
 * -  Put the longer leg (anode) of the LEDs in the +5V and the shorter leg (cathode) in OUT(0-15).
 * -  +5V from Arduino -> TLC pin 21 and 19     (VCC and DCPRG)
 * -  GND from Arduino -> TLC pin 22 and 27     (GND and VPRG)
 * -  digital 3        -> TLC pin 18            (GSCLK)
 * -  digital 9        -> TLC pin 24            (XLAT)
 * -  digital 10       -> TLC pin 23            (BLANK)
 * -  digital 11       -> TLC pin 26            (SIN)
 * -  digital 13       -> TLC pin 25            (SCLK)
 * -  The 2K resistor between TLC pin 20 and GND will let ~20mA through each LED.
 *
 * If you are daisy-chaining more than one TLC, connect the SOUT of the first TLC to
 * the SIN of the next.  All the other pins should just be connected together:
 *   BLANK of TLC1 -> BLANK of TLC2 -> ...
 * The one exception is that each TLC needs it's own resistor between pin 20 and GND.
 *
 * Alex Leone <acleone ~AT~ gmail.com>, 2008-11-26
 */

/* These two includes should go at the top of any file that uses the library */
#include "tlc_config.h"
#include "Tlc5940.h"


void setup()
{
  /* Tlc.init() has to be called before using any of the library functions */
  Tlc.init();
}

void loop()
{
  /*
   * This loop will create a Knight Rider-like effect if you have LEDs plugged
   * into all the TLC outputs.  NUM_TLCS is defined in "tlc_config.h"
   */
  int8_t direction = 1;
  for (TLC_CHANNEL_TYPE channel = 0; channel < NUM_TLCS * 16; channel += direction) {
    /*
     * Tlc.clear() sets all the grayscale values to zero, but does not send
     * them to the TLCs.  To actually send the data, call Tlc.update()
     */
    Tlc.clear();

    /*
     * Tlc.set(channel (0-15), value (0-4095)) sets the grayscale value for
     * one channel (15 is OUT15 on the first TLC, if multiple TLCs are daisy-
     * chained, then channel = 16 would be OUT0 of the second TLC, etc.).
     *
     * value goes from off (0) to always on (4095).
     *
     * Like Tlc.clear(), this function only sets up the data, Tlc.update()
     * will send the data.
     */
    Tlc.set(channel, 4095);

    /*
     * Tlc.update() sends the data to the TLCs.  This is when the LEDs will
     * actually change.
     */
    Tlc.update();

    delay(75);
    if (channel == NUM_TLCS * 16 - 1) {
      direction = -1;
    }
  }

}
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So... no ideas?  Anyone?  I can tell you that I've also noticed the lights flash on momentarily when I reset the Arduino.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i don't see a bypass capacitor on the tlc5940? it may work without it, but you should have one on there. .1uf capacitor accross the 5940 vcc/gnd.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tried it, was no help.  I'm beginning to think that my current atmega chip might be damaged... even though it runs sketches fine.  Has anyone else out there had a pwm pin go bad on them?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31483
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You really need an oscilloscope at this stage to see what signals are being delivered to the chip.

However, you can try putting fixed signals in by putting pull ups and dabbing then down to earth. If the clock is not being fed to the chip then I would expect to see the LEDs on all the time not off (see description in the data sheet). So I would concentrate on the blank signal, see if manually pulsing that gives you anything.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You mentioned that when you touch the BLANK pin that the LEDs all light up.  What are you touching that pin with?  If the BLANK pin is being held constantly high for some reason, none of your LEDs will light no matter what else is happening.

Have you tried resetting the Arduino by pressing S1 after the initial power-on. If you're using USB power to power everything, a voltage drop at power-on might be causing a lock-up state.  A USB port is supposed to be able to supply up to 500mA, but you can never be sure.  You could try measuring the current to the tlc5940's breadboard if you haven't already.

Also, just a note that one side of I(ref) resistor on the right side of the tlc5490 looks like it's very close to touching an adjacent pin.

Let us know what you find to give us more clues.

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I finally figured it out - my MCU was actually to blame.  Since I don't have ready access to an oscilloscope, I was planning on taking it to my local electronics shop and borrowing their's.  But yesterday my AVRTinyISP programmer arrived, along with a couple blank MCU's (I ordered them before I was having this problem, for a stand-alone board I'm working on).  I bootloaded one of the new chips right away and connected it - sure enough, the basic use sketch ran just fine.  I'm assuming that one of my pwm pins isn't working right, none of my sketches make use of arduino pins 13 or 3, so I'm betting it's one of those.  Thanks for the help though guys!

Just fyi Winston, I was actually touching the blank pin with my finger.  I'm assuming it's similar to when you touch an unplugged audio jack and you get a humming sound, I was putting a charge on it from my body.  I can't explain the exact mechanics of what was happening, but it did seem to make something happen.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 509
Posts: 31483
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can't explain the exact mechanics of what was happening,

What is happening is that your body (a large mass of water) is acting as a radio antenna and picking up radio frequency (mainly mains electricity). Then as you touch a wire your are injecting that signal into the circuit. You are your own signal generator.
Logged

Pages: [1]   Go Up
Jump to: