TLC5947 w/ Blinka (Pi3) - SPI timeouts?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
combs
 
Posts: 25
Joined: Fri Feb 01, 2013 5:23 pm

TLC5947 w/ Blinka (Pi3) - SPI timeouts?

Post by combs »

Hello! I have three chained Adafruit TLC5947 24-ch LED drivers. I am using them with 12V LEDs and have it all wired up with Python on a Raspberry Pi 3B.

Wiring:
12V to TLC5947 VIN
D5 to LATCH
D11 to CLOCK
D10 to DATA
D15 to OE (UART RX - UART is disabled)
and ofc GND to GND

When I first power everything on, the shift registers initialize with random data and it looks extremely cool. However, no matter my efforts I get SPI timeouts when trying to use Adafruit_TLC4957 with Adafruit Blinka in the auto_write disabled, write-all-at-once pattern.

Kernel output via dmesg:

Code: Select all

[ 2613.533738] spidev spi0.0: SPI transfer timed out
[ 2613.533780] spi_master spi0: failed to transfer one message from queue
Excerpt of application log:

Code: Select all

2023-01-24 14:48:35     self.display.write()
2023-01-24 14:48:35   File "/usr/local/lib/python3.7/dist-packages/adafruit_tlc5947.py", line 161, in write
2023-01-24 14:48:35     self._spi.write(self._shift_reg, start=0, end=_STOREBYTES * self._n + 1)
2023-01-24 14:48:35   File "/usr/local/lib/python3.7/dist-packages/busio.py", line 386, in write
2023-01-24 14:48:35     return self._spi.write(buf, start, end)
2023-01-24 14:48:35   File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 86, in write
2023-01-24 14:48:35     self._spi.writebytes(buf[start:end])
2023-01-24 14:48:35   File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/spi.py", line 376, in writebytes
2023-01-24 14:48:35     "ioctl timeout. Please try a different SPI frequency or less data."
Excerpt of application code:

Code: Select all

                self.bus = busio.SPI(clock=self.pinClock, MOSI=self.pinMOSI)
                self.bus.try_lock()
                self.bus.configure(baudrate=4000000)
                self.bus.unlock()
                self.display = adafruit_tlc5947.TLC5947(self.bus, self.pinLatch, auto_write=False, num_drivers=self.numDisplays)
                
                
                ...
                
                
        if self.useHardware==True:
            for pin in range(indices):
                self.display[pin] = data[pin]
                if pin % 12 == 0:
                    self.display.write()


(Notice my attempt to configure bus speed per PureIO's TimeoutError output. The problem exists without the lock/configure/unlock lines too.)

One thing I'm wrestling with is the idea of SPI timeouts in a system with no MISO connected. With no SPI secondary device acknowledgments possible, how could it time out? I'm guessing it's some BCM-internal DMA timeout?

I don't get a sense that 3 * 24 * 2 bytes should get anywhere near the 4096 byte SPI buffer... right?

Code: Select all

$ cat /sys/module/spidev/parameters/bufsiz
4096
The simple example from Adafruit_TLC5947 doesn't cause similar timeout errors, but it also doesn't output anything, same latch pin and all. So clearly something isn't quite right. I have the hardware SPI device enabled. Anything else to try?

Grateful for any help. Thank you!

User avatar
combs
 
Posts: 25
Joined: Fri Feb 01, 2013 5:23 pm

Re: TLC5947 w/ Blinka (Pi3) - SPI timeouts?

Post by combs »

My problem was silly. Despite looking at it three times, I had CLK and DIN swapped. I still don't really understand how the SPI transactions could time out without a MISO connection, but it is no longer happening.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”