controlling a TLC5940 with an ATTINY?

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

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.

Is the shrinkification essential?
Why not make a minimal arduino and keep all the functionality you're familiar with already?

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:

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.

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

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. :slight_smile:

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