TLC5940 - Arduino Due - Communication via SPI (16x12bit) needs extra SCK-Pulse

Madeline Usher wrote a very good library for TLC5940/DUE (thank you for this) but her idea to go via USART does not fit my needs, because USART was to slow to drive my planned 2x8x8 RGB matrixs with 2xTLC5940 in a row. So i decided to go on with 12bit SPI.

I´m trying to send data (array of 16 words with 12bit width) via SPI to my TLC5940. Sending this data (for a test) of 12 bit via SPI is not a problem with 74HC595 but with TLC5940, because TLC5940 needs an extra pulse of SCK after the XLAT-pulses when latching the data.

I have no idea how i can generate this extra SCK-Pulse on the SCK-pin? Can anybody help?

Thank you for support


circuit.txt (970 Bytes)

BLANK_TC_IRQ_HANDLER.txt (973 Bytes)

Can you just digitalWrite() it high and low? When the SPI hardware is not actively driving the pin, it will probably allow you to overrule it. This approach may kick the SPI off that pin, because digitalWrite() does do a lot of checking when it takes command of a pin. If that's the case, a direct port write should work.

The standard SPI library and the hardware work best with whole bytes and they don't have any mechanism to send odd numbers of bits.

Thanks for your answer. Direct port Access is a good idea with SCK and i will test it asap. I already do it with the SPI-Hardware which works fine (on 74hc595 :wink: ) even with 12 bit per transfer.