For transparency, I am trying to make a inkypi setup to work and using AI assistant as a I am not familiar with this domain but I am with codomg in general. The report seems sensible (adjusted a bit) and I am using the workaround successfully. I prefer not to open a pull-request unless someone suggests as I am not the best judget to decide if the workaround is the real fix or if there is a better solution.
If I understand we are trying to exceeding the threshold of the channel and we should instead send in chunks.
Every call to show() fails with TimeoutError: [Errno 110] Connection timed out. The timeout is ~6 seconds regardless of SPI clock speed.
_send_command in inky_e673.py sends the full frame buffer (~384 KB) via a single xfer3() call, which hits the kernel SPI DMA timeout on recent kernels.
_spi_write in the same file already handles this correctly by chunking large transfers into 4 KB xfer calls using _SPI_CHUNK_SIZE, but _send_command doesn't.
Traceback
File ".../inky/inky_e673.py", line 295, in show
self._update(buf.astype("uint8").tolist())
File ".../inky/inky_e673.py", line 251, in _update
self._send_command(EL673_DTM1, buf)
File ".../inky/inky_e673.py", line 377, in _send_command
self._spi_bus.xfer3(data)
TimeoutError: [Errno 110] Connection timed out
Kernel dmesg:
spidev spi0.0: SPI transfer timed out
spi_master spi0: failed to transfer one message from queue
Workaround
Patching _send_command to use chunked xfer calls fixes the issue:
if data is not None:
self._gpio.set_value(self.dc_pin, Value.ACTIVE)
- self._spi_bus.xfer3(data)
+ for x in range(((len(data) - 1) // _SPI_CHUNK_SIZE) + 1):
+ offset = x * _SPI_CHUNK_SIZE
+ self._spi_bus.xfer(data[offset:offset + _SPI_CHUNK_SIZE])
Environment
- Inky Impression 7.3" (Spectra 6)
- Raspberry Pi Zero 2W
- Kernel 6.12.75+rpt-rpi-v8
- inky 2.3.0
spidev.bufsiz=131072
For transparency, I am trying to make a inkypi setup to work and using AI assistant as a I am not familiar with this domain but I am with codomg in general. The report seems sensible (adjusted a bit) and I am using the workaround successfully. I prefer not to open a pull-request unless someone suggests as I am not the best judget to decide if the workaround is the real fix or if there is a better solution.
If I understand we are trying to exceeding the threshold of the channel and we should instead send in chunks.
Every call to
show()fails withTimeoutError: [Errno 110] Connection timed out. The timeout is ~6 seconds regardless of SPI clock speed._send_commandininky_e673.pysends the full frame buffer (~384 KB) via a singlexfer3()call, which hits the kernel SPI DMA timeout on recent kernels._spi_writein the same file already handles this correctly by chunking large transfers into 4 KBxfercalls using_SPI_CHUNK_SIZE, but_send_commanddoesn't.Traceback
Kernel dmesg:
Workaround
Patching
_send_commandto use chunkedxfercalls fixes the issue:if data is not None: self._gpio.set_value(self.dc_pin, Value.ACTIVE) - self._spi_bus.xfer3(data) + for x in range(((len(data) - 1) // _SPI_CHUNK_SIZE) + 1): + offset = x * _SPI_CHUNK_SIZE + self._spi_bus.xfer(data[offset:offset + _SPI_CHUNK_SIZE])Environment
spidev.bufsiz=131072