Skip to content

SPI timeout in _send_command on Inky Impression 7.3" #258

@bphenriques

Description

@bphenriques

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions