chipKIT® Development Platform

Inspired by Arduino™

TLC5940 Library

Created Wed, 17 Aug 2011 00:45:46 +0000 by laelfrog


laelfrog

Wed, 17 Aug 2011 00:45:46 +0000

I've started working on getting the TLC5940 arduino library working on my Uno32.

Its not working yet, but we're working on it in our spare time. https://github.com/ColinHarrington/TLC5940-Arduino

The first thing that we had to figure out was the alternative includes for <avr/io.h> We had to comment out the XLAT Interrupt for now (will add back in later) Next was to include different Pinouts for the pic32 chips. We are currently in the process of mapping the right pinouts.

The pinout xls document was very helpful in working with the datasheet.


Ddall

Wed, 17 Aug 2011 05:01:08 +0000

I'm also trying to get the Tlc5940 to work for my ChipkitMax32! I think the library is also using <avr/interrupt.h>, that's all I could learn from looking at the library code.

I'm very interrested in this, please keep us informed, i'd be happy to test it :-)


laelfrog

Wed, 17 Aug 2011 07:00:46 +0000

Awesome, We don't have a Max32 yet, so that'll be handy to have a tester to make sure it works for that one too.


laelfrog

Thu, 25 Aug 2011 14:53:03 +0000

So this isn't going to be just a port of the Arduino library. Lots of things have changed - so we are shifting to writing a ChipKIT library for the TLC5940.

We are very familiar with the chip, TLC5940arduino library and have written a TLC5940 library for the Propeller platform already([url]https://github.com/ColinHarrington/Propeller-TLC5940-Driver[/url]), so we're just getting used to pic32 - which so far has been way easier and more familiar the C/C++ land.


Ddall

Fri, 26 Aug 2011 14:18:45 +0000

Any idea when you will have a working example that I can test? I'm kinda stuck in the middle of a project because of this :roll: [color=#FF0000](chipkit was supposed to be 100% compatible!!! :evil: )[/color]

Thanks


laelfrog

Fri, 26 Aug 2011 16:02:53 +0000

It'll be a couple weeks at the earliest. Probably about a 4 weeks before we have something working - I'll be sure to update this thread.

I had to RMA my board, so it'll be a little bit until we can test our code. We're are at the point where we've figured out the timers and are making GSCLK, BLANK and XLAT work together.

The next steps after this are writing data to the chip (SCLK and SOUT), Then we'll need to do some Greyscale testing After that, we could work on the dot correction modes, etc.


laelfrog

Mon, 12 Sep 2011 22:02:59 +0000

Made some good progress yesterday. We figured out the timers and a few output compares.

Still haven't figured how to write an interrupt for OC4. We want to disable OC4 after it fires once. We see how to configure the interrupt, but how do you write the actual ISR?

// Start the timer for GSCLK
	OpenTimer2(T2_ON | T2_PS_1_1, 0x3);

	// Start the timer for BLANK/XLAT
	OpenTimer3(T3_ON | T3_PS_1_4, 0x1003); 
  

	// Start the OC for GSCLK
	OpenOC1(OC_ON | OC_TIMER2_SRC | OC_PWM_FAULT_PIN_DISABLE, 0x2, 0x2);
	
	// Start the OC for XLAT and enable the interupt on OC4
	OpenOC4(OC_OFF | OC_TIMER3_SRC | OC_SINGLE_PULSE, 0x1, 0x1);
	ConfigIntOC4(OC_INT_ON | OC_INT_PRIOR_7 | INT_SUB_PRI_3);

	// Start the OC for BLANK
	OpenOC5(OC_ON | OC_TIMER3_SRC | OC_PWM_FAULT_PIN_DISABLE, 0x3, 0x3);

Still left to implement:

  • XLAT Interrupt
  • Writing data to the chip, SOUT & SCLK + triggering XLAT
  • Handy functions to blankAll() and resumeAll()
  • Methods to manipulate Greyscale data on a per-channel and three channel basis (RGB)
  • Ability to change into Dot Correction (DC) mode and write DC data and back again

heathbar

Thu, 15 Sep 2011 06:48:12 +0000

I've been working on this library with laelfrog. This evening we were able to bit bang some values to the TLC chip. It was exciting to see the LEDs light up, but we still have a good amount of work to do before we have something usable.

The task at hand is to push the data to the TLC utilizing the SPI hardware. We couldn't get it working this evening using the macros found in spi.h so I may try to get it to work by reading/writing to the registers directly.

Gene also posted about a bug in the SPI library. I'm too n00b to link to it, but I'm curious to research if that is the issue we're facing.


Ddall

Wed, 05 Oct 2011 13:02:36 +0000

So? Is it working? :roll: I'm waiting on this to finish a school project: A RGB led matrix controlled by a TLC5940 array


laelfrog

Wed, 05 Oct 2011 15:13:46 +0000

So? Is it working?

We were able to Light up LEDs with different colors and control the channels independently, but are having issues getting data clocked to the chip correctly. So this means that the first Chip will work but daisy chaining won't work. SPI was requiring clocking out 8x 32bit words instead of 6 (192 values) and we are not sure why that works.

We just got ahold of an Oscilloscope to figure it out. Once we figure that out and have our set function packing the data correctly we'll put it up on github in an alpha state.


heathbar

Thu, 06 Oct 2011 07:36:34 +0000

We are certainly getting closer. Like laelfrog said, SPI seems to be sending the data correctly, but there still some bugs we have to work out.

Tonight I was able to put the set() function together which will be a great help in testing the update() function. The set() function takes a channel number and a value as parameters and stores them in an array until the update() function is called and sends the data to the TLC chip. It's not exactly straightforward since the values are 12-bits each and need to be packed into a 32-bit integer array.

Give us another week or two and we should have a beta ready.


Ddall

Thu, 06 Oct 2011 15:46:17 +0000

Sounds promising! Will it be as fast as the original code? I need at least 30FPS on my screen, this means: 1 row = 1tlc refresh. (24Rows per image) * 30 images per seconds = 720Hz

Note: My TLC array is made of 6chips (two per colors), and is using (24leds*3colors) = 72 channels

Thanks


heathbar

Thu, 06 Oct 2011 16:23:40 +0000

Absolutely, the chipkit should actually run much faster than the arduino. I haven't done any measurements yet since the code is in constant flux, but just looking at the chipkit's specs, we can expect to see a decent improvement.


laelfrog

Sat, 08 Oct 2011 17:46:00 +0000

Last night we got SPI working flawlessly writing data to the chip - So its pretty solid.

Now we are working on getting the interrupts to work so that we cleanly fire XLAT during the Blank cycle. We're getting closer. Once this is working, we'll release it on Github in an alpha state and continue working on it.


laelfrog

Sun, 09 Oct 2011 20:55:12 +0000

Seems to be solid for us now. Here it is in an alpha state: [url]https://github.com/ColinHarrington/tlc5940chipkit[/url]

We've only tested it on a Uno32, as we don't have a Max32. [url]http://www.youtube.com/watch?v=cnRtK8gVgwU[/url]

Let us know what you find - Github has a place to log issues and we'll be using that.


Ddall

Mon, 10 Oct 2011 18:35:06 +0000

I'll get right on it!


heathbar

Tue, 11 Oct 2011 03:11:08 +0000

Ddall, I've updated the README on github to include some installation/setup instructions. For the most part it should be the same as the setup for the arduino. I've highlighted some of the differences. For instance, the chipkit runs at 3.3V where the arduino runs at 5V.


Ddall

Wed, 12 Oct 2011 09:25:36 +0000

So far so good. -> The wiring is exactly the same as on my arduino duemilanove. (I even used the +5v output) It seem's to be working well on MAX32. I haven't had time to test multiple TLC yet, but I dont see why it wouldn't work. I'll run a benchmark to see how fast it runs with one chip (then with two, three, etc...).


Ddall

Thu, 13 Oct 2011 20:44:47 +0000

So far so good. -> The wiring is exactly the same as on my arduino duemilanove. (I even used the +5v output) It seems to be working well on MAX32. I haven't had time to test multiple TLC yet, but I don't see why it wouldn't work. I'll run a benchmark to see how fast it runs with one chip (then with two, three, etc...).

I'm so sorry but... I completely screwed up my testing: it DOESN'T work.... I thought my wiring was a bit glitchy and screwed up with my color correction, but I re-did all the wiring, and here's what actually happens on my MAX32:

Whatever I do, all the outputs of the first TLC are lighted up at about 30% power. It happens after Tlc.init(); I tried Tlc.init(SOMEVALUE); and it doesn't change anything. And Tlc.set() has no effect at all...


laelfrog

Fri, 14 Oct 2011 04:21:44 +0000

I'm so sorry but... I completely screwed up my testing: it DOESN'T work.... I thought my wiring was a bit glitchy and screwed up with my color correction, but I re-did all the wiring, and here's what actually happens on my MAX32: Whatever I do, all the outputs of the first TLC are lighted up at about 30% power. It happens after Tlc.init(); I tried Tlc.init(SOMEVALUE); and it doesn't change anything. And Tlc.set() has no effect at all...

If you are trying to drive 2 TLCs off of just USB power, you are going to have power issues. If your LEDs are 20mA then 16 channels will be 320mA, 32 channels would be 640mA, etc. USB is only supposed to support 500mA and your LEDs + ChipKIT + TLCs will put you over that. If you are using more than 1 TLC you are going to need an external Power source. We've also noticed that we've had seen issues with the 5v power on the Uno32. We are still working on power issues too. Our best success has been running everything at 3.3v on an external power supply.


laelfrog

Fri, 14 Oct 2011 04:50:22 +0000

We were able to do 2466 frames (updates) per second with some Color conversions every loop with 2 TLC5940s. That ought to be fast enough :-)


Ddall

Fri, 14 Oct 2011 07:32:36 +0000

I've had this result with this configuration:

  • My MAX32 powered by USB,
  • One TLC driving ONE color channel on ONE row of my led matrix.
  • I tried 5V and 3.3V with the same result... Using the same code, it works fine with my arduino powered by USB

I'll try an external +5V power supply tonight: GND --> common ground VPRG --> +3.3V (chipkit) VCC --> +5v external 5V


Ddall

Fri, 14 Oct 2011 18:30:18 +0000

I've tested the code using my external power supply on different configurations and the chip still isn't responding to any commands. Right after I call Tlc.init(), all outputs are lighting up and stay still. To be safe, I've tried with another chip (a fresh one, taken right out of the package). Do you have any clue where the problem comes from?


heathbar

Sun, 16 Oct 2011 06:15:38 +0000

I was planning on drawing up a wiring diagram, perhaps I should get on that. My first guess is that VPRG should be connected to GND, not Vcc. This is how I have mine wired:

Going down the pins on the TLC

Pin 28: Out 0 - connected to the first LED Pin 27: VPRG - connected to GND unless you are programming Dot Correction (but this pin needs to be connected to GND to send any data to the TLC) Pin 26: SIN - connected to chipkit pin 11 Pin 25: SCLK - connected to chipkit pin 13 Pin 24: XLAT - connected to chipkit pin 9 Pin 23: BLANK - connected to chipkit pin 10 (optionally, also connect this pin through a 10K resistor to Vcc (3.3v) - this will blank all LEDs anytime the chipkit looses power) Pin 22: GND connected to chipkit GND Pin 21: Vcc connected to chipkit 3.3v Pin 20 IREF - connected through a 2.2K resistor to GND Pin 19: DCPRG - connected to Vcc (3.3v) Pin 18: GSCLK - connected to chipkit pin 3 Pin 17: SOUT - connected to the pin 26 of the next TLC (if applicable) Pin 16: XERR - not implemented, not connected Pin 15: OUT 15 - connected to the last LED

Additionally, I have an external 5V power source. The GND lead from this is connected to the TLC & the chipkit GND so that everything is safe. The +5V lead is connected to the LEDs only. The +5V lead never touches the TLC, except through the LEDs. However, it should work just fine if you connect the LEDs to 3.3v like everything else. The power from USB --> chipkit --> LEDs should be enough to power 1 board full of LEDs

I'll see if I can figure out how to draw a picture.


heathbar

Sun, 16 Oct 2011 08:43:06 +0000

Wiring Diagram: https://github.com/ColinHarrington/tlc5940chipkit/blob/master/breadboard-chipkit-tlc5940.png


Ddall

Sun, 16 Oct 2011 11:41:43 +0000

I was already using a similar wiring for the external power supply. Connecting VPRG to the common GND seems to be turning the chip off. All leds are turned off, and the chip is still not responding to anything (not Tlc.init(VALUE); or Tlc.set(1, VALUE); ) ... I've also tried to leave VPRG unplugged: the chip behaves like VPRG is connected to chipkit +3.3v


heathbar

Sun, 16 Oct 2011 15:06:31 +0000

First, thanks for your patience, we really appreciate it as we do not have a max32 to test. I did some digging this morning and found that like the arduino uno/mega, the pins you need to use on the uno32/max32 differ. Since you are using the max, you should be connecting to the following pins:

SCLK connect to chipkit 52 SIN connect to chipkit 43 GLSCLK connect to chipkit 3 XLAT connect to chipkit pin 9. BLANK connect to chipkit 10 VPRG connect to chipkit 46 (or GND; the only time you need this connected to a digital pin is when you are trying to program dot correction)

Additionally, we have our SPI jumpers set to MASTER. I'm not sure if that's important, but I just thought I'd throw it out there.

EDIT: I'm not 100% sure the pins I posted are correct. The reason I'm doubting myself is because they are different than the pins that the Arduino Mega uses. I need to do a deeper dive in to the Mega/Max to be sure, but you're welcome to try both the configuration I posted here as well as the configuration that is recommended for the Mega (link).


Ddall

Mon, 17 Oct 2011 16:44:15 +0000

The arduino mega style is not working (the one from the link) You forgot XLAT... :roll: But I think your on to something here: I wired it like you proposed, and pulled XLAT to GND... the corrects leds are flickering for a very very small amount of time before they turning off


heathbar

Mon, 17 Oct 2011 19:12:05 +0000

XLAT should be connected to chipkit pin 9.


Ddall

Tue, 18 Oct 2011 19:14:18 +0000

You're going to like this one...

IT WORKS!

I think Tlc.setAll() has a few problems, but the most important for me Tlc.set() is here :roll:. If I have more time tonight I'll try the code with multiple TLCs.


heathbar

Tue, 18 Oct 2011 20:19:23 +0000

Awesome! We have been noticing some flickering when we connect multiple TLCs, but I think we already have a fix for it. We need to do a little more testing and then we will post the fix to github.


Ddall

Wed, 19 Oct 2011 19:53:44 +0000

Multiple TLCs are working nicely on my MAX32 I can drive my RGB leds and get colors that look pretty wright. Thanks again!

Now that we figured out the correct wiring, i was wondering if it could be possible to change it... By this I mean trying to regroup wires to one side of the board, this would make my life easier when I'll make this thing into an actual object. If it's not simple, don't bother, it's not a big deal ;)


heathbar

Wed, 19 Oct 2011 20:03:39 +0000

It may be possible to change some of them, but in general we chose the pins that we did because we had to because they are tied to specific functions on the pic32. Not all pins are created equal. :)


laelfrog

Thu, 20 Oct 2011 05:55:37 +0000

I wired up 3x TLC5940 chips with 15 LEDs and the library was quite stable. I'm happy with the library so far and I'd say that its ready for more use: [url]http://www.youtube.com/watch?v=T4yQsR4f1qw[/url]

Contributions on github are welcome! [url]https://github.com/ColinHarrington/tlc5940chipkit[/url]

Let us know of any issues! We are tracking issues via github issues [url]https://github.com/ColinHarrington/tlc5940chipkit/issues?sort=created&direction=desc&state=open[/url]


slayer1991

Thu, 01 Dec 2011 23:55:14 +0000

how do you wire a single tlc?

LE: and can you give me a sample code?


heathbar

Fri, 02 Dec 2011 01:53:39 +0000

Connecting just one TLC is the same as connecting many. Just skip the wires that go to the second TLC. There is some sample code included on github, but if you need a different example, just let is know what you'd ike to see.


slayer1991

Fri, 02 Dec 2011 02:06:37 +0000

Is this good for Uno or it's for Arduino? [url]https://github.com/ColinHarrington/tlc5940chipkit/blob/master/breadboard-chipkit-tlc5940.png[/url]

Here is a code I tried, but the LEDs would just not light up

#include &lt;Tlc5940.h&gt;
#include &lt;tlc_config.h&gt;
int x=0, y=0;
void setup()
{Tlc.init(0);}
void loop()
{Tlc.set(x,y);
x++;y++;
if(x==15) x=0;
if(y==2095) y=0;
Tlc.update();
delay(15);}

LE:

#include &lt;Tlc5940.h&gt;
#include &lt;tlc_config.h&gt;


void setup()
{Tlc.init(0);
}
void loop()
{int x, y;
for(x=0;x&lt;=15;x++)
for(y=0;y&lt;=15;y++)
{Tlc.set(x,y);
Tlc.update();
delay(100);}}

does nothing too. I'm hoping the wiring's bad. 3 different chips, so the tlc's can't be broken, right? unless they send us sample of broken stuff..


Ddall

Fri, 02 Dec 2011 12:32:02 +0000

The power value you are sending to the led might be too low to see anything. Tlc5940 takes a value betwin 0 and 4095 (4095 being the highest value). Does this work?

#include &lt;Tlc5940.h&gt;

void setup(){
  Tlc.init(0);
}
void loop(){
  // Tlc.set(LED, VALUE);
  Tlc.set(1, 4000);
  Tlc.update();
  while(true);
}

slayer1991

Fri, 02 Dec 2011 22:41:57 +0000

The power value you are sending to the led might be too low to see anything. Tlc5940 takes a value betwin 0 and 4095 (4095 being the highest value). Does this work?

#include &lt;Tlc5940.h&gt;
void setup(){
Tlc.init(0);
}
void loop(){
// Tlc.set(LED, VALUE);
Tlc.set(1, 4000);
Tlc.update();
while(true);
}

Sorry, it doesn't. Should be working, right?


slayer1991

Tue, 06 Dec 2011 22:27:37 +0000

Can you check the wiring please? Is it like this?[url]https://github.com/ColinHarrington/tlc5940chipkit/blob/master/breadboard-chipkit-tlc5940.png[/url]

with purple and orange wire not existing for a single TLC (the upper ones, not the ones from the chipkit)? also, what version of MPIDE are you using?

LE: what forward voltage does the leds need to be? am i missing anything? LE2: my TLC does not sink any current! put an ampermeter instead of an led and it stays at 0.. LE3: if I take out the pull-up resistor I can make the LEDs flicker by touching the chipkit pins with my hand.


heathbar

Wed, 14 Dec 2011 19:18:25 +0000

Is this good for Uno or it's for Arduino?

This library is designed for the chipKIT Uno and (with some slight modifications) the chipKIT Max.

Your code looks good, so I'm guessing that you have something wired incorrectly. If you could post a picture of your setup, I'd be happy to take a look.

To answer your questions: I am using mpide version: mpide-0022-linux32-20110822. The LEDs I'm using have between 2.0V and 2.4V forward voltage drop.

Some things to check:

Are you using an external power source to power the LEDs? If so, you could try eliminating it and just using the chipKIT's 3.3V to power the LEDs. They won't get as bright, but it makes the circuit simpler to troubleshoot.

Do you have the LEDs facing the right way? I know this is dumb question, but I can't tell you how many times I've made this mistake. :)

What size resistor are you using for IREF on the TLC? It should be ~2.2K for normal 20mA LEDs

The chipKIT actually has 2 rows of headers, unlike the picture on github, are you plugging into the outside row? i.e. the one closer to the edge of the board?


slayer1991

Fri, 16 Dec 2011 02:15:13 +0000

To answer your questions: I am using mpide version: mpide-0022-linux32-20110822. The LEDs I'm using have between 2.0V and 2.4V forward voltage drop.

I'll try it with that win32 one.

Some things to check: Are you using an external power source to power the LEDs? If so, you could try eliminating it and just using the chipKIT's 3.3V to power the LEDs. They won't get as bright, but it makes the circuit simpler to troubleshoot.

First I was using the 5V from it. Then I put on a 5 V regulator and some AAs. Nothing. Now I tried with chipkits 3.3, nothing again.

Do you have the LEDs facing the right way? I know this is dumb question, but I can't tell you how many times I've made this mistake. :)

It's not a dumb quiestion actually. I asked that myself too. Some LEDs were in place from the LM3914 (current sink, doesn't matter LED voltage). So I just added some more.

What size resistor are you using for IREF on the TLC? It should be ~2.2K for normal 20mA LEDs

I'm using 2x1k. I'll try something a little bigger.

The chipKIT actually has 2 rows of headers, unlike the picture on github, are you plugging into the outside row? i.e. the one closer to the edge of the board?

I tried the inner rows and then applied some voltage to the leds and burned one and another one exploded. It was dumb to do it while connected to the tlc and that to the chipkit.

All my wires are yellow. I will post some pictures and a video tomorrow. But I checked the wiring for like 10 times. And redone it twice. Unless something's wrong with me, I'm pretty sure my rig is bugged. I have output from the pins selected on the board. I checked it with a voltmeter. Also without the pullup resistor the leds won't light up when the board resets. That could lead to something.


heathbar

Fri, 16 Dec 2011 09:34:13 +0000

The chipkit runs at 3.3V so if you connect 5V to the TLC's Vcc, you're likely to get sporadic results, so definitely stick with 3.3V to the TLC.

One very important thing I forgot to mention: JUMPERS! Did you check your jumper settings? Probably not because it looks like I forgot to include those in the README file. JP5 and JP7 need to be set to MASTER, and JP4 needs to be set to RD4.


slayer1991

Fri, 16 Dec 2011 13:43:17 +0000

The chipkit runs at 3.3V so if you connect 5V to the TLC's Vcc, you're likely to get sporadic results, so definitely stick with 3.3V to the TLC. One very important thing I forgot to mention: JUMPERS! Did you check your jumper settings? Probably not because it looks like I forgot to include those in the README file. JP5 and JP7 need to be set to MASTER, and JP4 needs to be set to RD4.

I'm sure the jumpers are set to master from factory. I'll check it out later today.


slayer1991

Fri, 16 Dec 2011 19:05:45 +0000

Moved the JP4 to RD4, changed the tlc to 5V and it worked! Maybe my uno32 can't supply enough current when powered from usb. Maybe add that too in the tutorial, if 3.3v doesn't work, try 5V.


slayer1991

Thu, 05 Jan 2012 00:56:53 +0000

Also, I couldn't use analogWrite on pins 5 or 6. It made the LED's flicker. It was like that pwm was interfering with the TLC somehow. SoftPWM didn't work either. I am curious wether digitalRead/Write works on the other pins, not PWM capable. Or wether the analogRead works. I will test them as soon as I have the chance.


heathbar

Thu, 05 Jan 2012 04:05:18 +0000

Great! I'm glad to hear that you have made some progress. However, I'm not surprised that you are seeing some unpredictable results. We had a lot of issues related to insufficient power that manifested in odd ways. My guess is that you're having similar issues. If you can get an external power source setup to power the LEDs, I'd be surprised if those issues didn't go away.


slayer1991

Thu, 05 Jan 2012 23:28:08 +0000

I have tried with an external supply too. You just cant output pwm on pins 4-6 (these I tested) and run the TLC at the same time.

analogRead(0) and digitalRead(32) work together with the TLC (those are the pins i tested).

I'm curious wether an SD card works with the TLC. I don't have one to test but I would like to.


heathbar

Fri, 06 Jan 2012 09:37:57 +0000

I haven't tested using the TLC with anything else, but I did a little reading and I noticed a couple things. Analog pins 4 and 5 are controlled by jumpers 6 and 8. So if those weren't working, you may have a jumper issue. Also, digital pin 4 can never have pwm - that is just how the chipkit is designed. As for pins 5 and 6, they should work with pwm, but as I said, I haven't tested anything myself. I'd be happy to give your sketch a try if you wanted to upload it to pastebin.


heathbar

Fri, 06 Jan 2012 09:46:55 +0000

I just thought of something: in the TLC library, we are using the timers in the pic32 directly to make the magic happen. It is very possible that one of the timers we are using was the timer that drove pwm on digital pins 5 and 6. I'll have to do some investigating on that when I have some more time. But that brings me to a question: why do you need pwm on those pins when you have virtually unlimited pwm pins on the TLCs?


slayer1991

Fri, 06 Jan 2012 15:01:34 +0000

The timers are probably the same. I wouldn't need more pwm pins, but the TLC is a current sink. So it gives negative pwm. Oh wait.. 4095 means 0% duty cycle and 0 means 100% duty but at what voltage? I had a little misunderstanding. And it appears that digital and analog read are working. I wonder if digitalWrite is working. Of course I can use the TLC again to do digitalWrite, could I?

LE: Do you have an SD card? Can you try and see if it works at the same time with the TLCs?


slayer1991

Wed, 11 Jan 2012 15:53:32 +0000

From what I've read, Arduino can work with the Ethernet shield and TLC in bit bang mode. Any status on bitbanging?


Cloee81

Wed, 11 Jan 2012 23:04:47 +0000

Link isn't working, so... Usage: Tlc.init(); 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.update(); updates all pins Tlc.set(channel, value); channel is pin number. As of December 7, 2011, pin number just keeps going up as you go to more and more daisy-chained chips. So, if you have two chips, and you want to talk to the last pin on the second chip, you address it to channel 32. Like so: Tlc.set(32, x); x can be from zero to 4095. It appears that you have to tell the library how many chips you are using.


slayer1991

Thu, 12 Jan 2012 06:46:22 +0000

I used the chip successfully alone. what does the XLAT/pin 9 do? can't I just Low/High it to select the sd?

LE: after some research the TLC has no SS pin. So I definitely need bitbanging it to work with other spi devices. I am looking into changing the libraries to enable bit banging. Are those the only lines of code? I can't see anything about OC and timers in the library files.

LE2: stupid stupid.. It is working in bit banging right now. I just have to go through the cpp file and make something of it. If you can help me have both SPI and TLC bit bang, I'd appreciate it! Also, could I pack the data to make a LED be either HIGH or LOW? Would it be faster (in microseconds, i know, but still)?

LE3: are there any interrupts and/or timers left for me to use?


slayer1991

Wed, 18 Jan 2012 22:28:48 +0000

So.. I am trying to use SPI1 to communicate with the TLC. I managed to turn it on using this cpp file. And the chip is connected the following way:

SIN to pin 1 SCLK to pin 38 XLAT to pin 9 BLANK to pin 5.

LE: after some more modifications, I think it is ok. I will test it tomorrow.

LE2: also, why did you use in your library

#define BLANK 0x20

this would refer to pin RD5. But you connect the Blank to RD4, right? So instead of 0x20, shouldn't it be 0x10?