Pages: [1]   Go Down
Author Topic: controlling a TLC5940 with an ATTINY?  (Read 1063 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,

I just successfully hooked up a TLC5940 to my Arduino Uno (rev3) and have the Knight Rider effect with 16 LEDs going on in front of me. As the chips are going to be installed in a very small space when I am done, I would like to avoid using an Arduino to control the TLC5940 and am looking for a way to use an ATTINY (best would be an Attiny85) to do this. Searching the forum and Googling did not really produce any results that helped me.. at least the ones that I understood.

In addition to power and GND, the tlc5940 is connected to the Pin13 (SCLK), Pin11 (SIN), Pin10 (BLANK), Pin9 (XLAT), and Pin3 (GSCLK). Am I correct in assuming that whatever microcontroller I take to do the job of Arduino it needs to have these types of pins? Meaning the ATtiny85 would NOT work as the attiny85 has a SCK pin but none of the others? correct?

Does anyone know if there are resources out there that are "newbie-friendly"? or failing that able to describe how to configure an ATtiny or other microcontroller so that it can control a tlc5940?

Thanks alot in advance,
Opal_1970
« Last Edit: April 15, 2012, 03:44:49 pm by opal_1970 » Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6106
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If the processor doesn't have SPI, you'll have to rewrite the library to bit bang the TLC.

I don't know if the 85 does or not.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Offline Offline
Edison Member
*
Karma: 64
Posts: 2450
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the shrinkification essential?
Why not make a minimal arduino and keep all the functionality you're familiar with already?
http://arduino.cc/en/Tutorial/ArduinoToBreadboard
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You CAN use the 'USI' module in the ATtiny chips to send SPI data out fast, but I wouldn't consider it newbie-friendly.

On an ATtiny24 this looks like that:

Code:
uint8_t spi_transfer(uint8_t data)
{
    USIDR = data;
    USISR = _BV(USIOIF);    // clear flag

    while ((USISR & _BV(USIOIF)) == 0) {
        USICR = (1 << USIWM0) | (1 << USICS1) | (1 << USICLK) | (1 << USITC);
    }
    return USIDR;
}

You'll still have to consult the datasheet to make sure you get what you want.
Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 197
Posts: 12741
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If the processor doesn't have SPI

It does have hardware support for SPI but the hardware is considerably different from the ATmega processors.  It has a "Universal Serial Interface (USI)" that can be configured for SPI or I2C.  But, that's all I know about it.

Google searching was productive...
http://arduino.cc/playground/Code/USI-SPI
https://www.google.com/search?q=attiny85+spi
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thankyou very much for the Input and thankyou Coding Badly for the links, SPI was not a term for me which is probably why I did not find them. smiley

I think I may be biting off more than I can chew with this, so I will probably try to do Pancake's minimal Arduino suggestion first and see where my journey takes me.

Thanks
Logged

Pages: [1]   Go Up
Jump to: