# Arduino Mega 2560 with 2 x TLC5940

I have these connected up on my breadboard.

Connection of the two TLC5940s is pretty straight forward.

But connection of these to my arduino Mega is giving me problems.

I am using this library in the arduino development environment: https://code.google.com/p/tlc5940arduino/

I have connected up the TLC5940s according to this: Google Code Archive - Long-term storage for Google Code Project Hosting.

However my test LEDs are not lighting up at all.

In tlc_config.h there is this:

/** Determines how long each PWM period should be, in clocks.
\f$\displaystyle f_{PWM} = \frac{f_{osc}}{2 * TLC\_PWM\_PERIOD} Hz \f$
\f$\displaystyle TLC\_PWM\_PERIOD = \frac{f_{osc}}{2 * f_{PWM}} \f$
This is related to TLC_GSCLK_PERIOD:
\f$\displaystyle TLC\_PWM\_PERIOD = \frac{(TLC\_GSCLK\_PERIOD + 1) * 4096}{2} \f$
\note The default of 8192 means the PWM frequency is 976.5625Hz */
#define TLC_PWM_PERIOD    8192


So the pin 18 of the TLC5940 connected to digital pin 9 of my arduino mega should be oscillating at 0.9kHz.

However if I measure digital pin 9 of my arduino mega with my multimeter in frequency mode there is no oscillation.

If however I measure digital pin 12, which is connected to the BLANK pin of the TLC5940, then I find IT is oscillating at 0.9kHz.

So has anyone used this library previously and knows what the proper pin connections for an arduino mega should be.

Clearly the GSCLK pin of the TLC5940 should be connected to digital pin 12 and not digital pin 9 of the arduino.

But what about the other TLC5940 pins? Which are the correct pins on an arduino mega for these?

I have already looked at that file but it tells me exactly the same thing as the other web page which is clearly incorrect, at least with my arduino mega.

/** OC2B (Mega pin 9) -> GSCLK (TLC pin 18) */
Pin 9 on my arduino mega is not the one that is oscillating at 0.9kHz.

Pin 12 is.

Arduino digital pin 12 is connected to BLANK. It is pulsed at the end of a cycle which is why you are able to read a frequency on it.

...with my multimeter in frequency mode...

At a 900 Hz BLANK frequency, GSCLK is running at almost 4 MHz. What is the limit of your multimeter? Is it capable of reading a frequency that high?

Does an LED connected to pin 9 light?

Iam using this configuration on my arduino mega 2560 to tlc5940

## ---u---- OUT1 |1 28| OUT channel 0 OUT2 |2 27|-> GND (pin 50) OUT3 |3 26|-> SIN (pin 51) OUT4 |4 25|-> SCLK (pin 52) . |5 24|-> XLAT (pin 11) . |6 23|-> BLANK (pin 12) . |7 22|-> GND (gnd) . |8 21|-> VCC (+10k -> gnd) . |9 20|-> +5v . |10 19|-> . |11 18|-> GSCLK (pin 9) . |12 17|-> SOUT . |13 16|-> XERR (pin 10) OUT14|14 15| OUT channel 15

and its working..