TLC5916 LED Driver, SPI, and Bitbanging

I wired a TLC5916 LED driver to an Arduino Micro using SPI and two digital I/O pins - one for LE (latch enable) and the other for OE (output enable). I am able to successfully control 8 LEDs.

However, to adjust the current output, I need to enter a special configuration mode. For this, I need to synchronize some bit timing between the SPI clock and the OE and LE. With SPI, I am limited to data only on the MOSI output. If I were to forego SPI and use the ShiftOut command, I would still be limited as I need to simultaneously control the output between the clock and two other data pints - OE and LE.

Are there any good solutions for this? My thoughts:

  1. Bitbang all the outputs I need to handle including the clock, data, LE, and OE.
  2. Connect the TLC clock input signal to the SPI clock pin AND a digital IO pin at the same time. When I need to enter the configuration mode I would bitbang the OE, LE, and digital IO pin. When transmitting data, I would use SPI.

Thoughts? I prefer the 2nd solution, but am not sure if I would hurt my board by wiring SPI clock and digital output pin in parallel. Will they interfere with each other?


For this, I need to synchronize some bit timing between the SPI clock and the OE and LE.

Can you describe what you need to do? Doesn’t sound very likely you need to change LE and OE while a SPI transfer is in progress…

For general operation, I use SPI (clock and data) to shift in the data that determines which outputs (LEDs) are lit.

The TLC5916 chip has another “mode” with which I can program how much current will go through the LEDs. I can program the output current using SPI also. However, to leave normal mode and enter this special mode, I need to manipulate the latch enable (LE) and output enable (OE) pins synchronously with a clock signal. (The clock input on this chip is already wired to the Arduino SPI clock pin - I’d rather not disconnect this as communication via SPI works well.)

For the reason to bitbang my way into special mode, I thought maybe I could wire the clock on the chip to both the SPI clock on the Arduino, and a digital output on the Arduino. For normal communications, I would use SPI. For changing modes, I would bitbang with digital output (and LE and OE).

One new thought I had was to add a wire from the SPI clock to a digital input on the Arduino. I was thinking I could do something with interrupts. When the clock cycles, I could set the LE and OE outputs to the proper levels to enter the special mode. Can I bitbang these LE and OE quickly enough to keep up with a SPI clock? (I read it takes something like 2ms to do a digitalWrite.) How slow can I run the SPI clock? 100Hz? 50Hz? I have attached a file showing the sequence to get into special mode. The MOSI is not shown as it is not used during mode switching.


That's exactly what you already told....

But I did some reading. Indeed a weird operation. But yeah, it's sounds fine to me to do the mode switching by bit banging. But surprise! The SPI pins are just regular pins. No need to connect them to other pins. Simply call SPI.end() do the mode switching magic and start SPI again with SPI.begin().