This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLC5940: Controlling TLC5940 with Raspberry Pi (3b): inconsistent behaviour

Part Number: TLC5940

Hello

I try to drive a TLC5940 with a Raspberry Pi 3b in ARM assembly (bare metal, so no OS installed).

I use 3 cores out of 4. Core 0, after managing the initializations (GPIO, screen framebuffer, etc...), is modifying the buffer where the led colors are stored, core 1 is managing BLANK, XLAT and GSCLK while core 2 is transfering data from LED color buffer to the input shift registers (SIN and SCLK). There is 1 var called "BufferFilled" in memory that allow synchronization between core1 and core 2. Initially, this var is 0 (LED color buffer not empty).

I've read comprehensively the datasheet and my loops are:

For Core 1:

- Set BLANK to H(igh)

- MainLoop1:

- While BufferFilled=0 go to MainLoop1

- Set BLANK to H

- Set XLAT to H

- Set XLAT to L(ow)

- Set BufferFilled=1 (core 2 may start again to filled the input shift registers)

- Set BLANK  to L

- GSLKLoop:

- Using the internal timer to set GSLK to H then to L at a regular interval (every 4 µs for me then I have around 60 cycles per second )

- While we don't have 4096 pulses, go back to GSLKLoop

- Return to MainLoop1

For core2:

- MainLoop2:

- While BufferFilled=1 go to MainLoop2

- ByteLoop2:

- Read a byte in the buffer (from the last to the first to respect MSB to LSB)

- BitLoop2:

- Check the most significant bit and set SIN accordingly

- Set SCLK to H then to L

- Shift the data byte to the left

- If we don't have check the full byte, go back to BitLoop2

- To shift from 8 bit value to 12 bit value, add 4 more SIN=L then SCLK=H then SCLK=L

- Check if we have done with all the bytes, if not go back to ByteLoop2

- Set BufferFilled=1

- Go back to MainLoop2

It works well, but not for long, I have a video that shows it there:

And that is about the longest time it ever worked... As you see, at the end, it stops.

I have check with values written on the screen and there is no memory leak (stack pointers are constant, displaying the memory where the vars are shows that it behaves normally), so what?

Do you have any idea why this does not work indefinitely?

Thanks for your help.

Cathy L.

  • Hi, Cathy,

    Do you send the BLANK pulse every 4096 GSCLK to reset the GSCLK counter:

    Can you also share your schematic for reference?

    Thanks.

    Regards,

    Kenneth

  • Hello Kenneth

    Sorry I found the answer yesterday and I didn't post immediately here.

    Yes I sent the BLANK at the right time.

    The problem was that the output pins of the Raspberry Pi 3 are either giving 0V or 3.3V and I supplied power to the TLC5940 with the +5V not with the +3.3V. As soon as I change, it was working. A problem with the power dissipation?

    Anyway, thanks a lot for helping

    CAthy L.