Skip to content

TCA library deadlocks when i2c device fails  #29

@WouterSchols

Description

@WouterSchols

When the TCA is connected to the i2c device and the device throws an OSError then the TCA library has a chance to deadlock. I am unable to reproduce this error without the TCA library.

Traceback (most recent call last):
  File "RowTest1.py", line 32, in <module>
    res += "|O" if square.value == False else "|X"  # Reads value of sensor square over i2c
  File "/home/pi/SmartChessboard/env/lib/python3.7/site-packages/adafruit_mcp230xx/digital_inout.py", line 80, in value
    return _get_bit(self._mcp.gpio, self._pin)
  File "/home/pi/SmartChessboard/env/lib/python3.7/site-packages/adafruit_mcp230xx/mcp23017.py", line 63, in gpio
    return self._read_u16le(_MCP23017_GPIOA)
  File "/home/pi/SmartChessboard/env/lib/python3.7/site-packages/adafruit_mcp230xx/mcp230xx.py", line 36, in _read_u16le
    with self._device as i2c:
  File "/home/pi/SmartChessboard/env/lib/python3.7/site-packages/adafruit_bus_device/i2c_device.py", line 137, in __enter__
    while not self.i2c.try_lock():
  File "/home/pi/SmartChessboard/env/lib/python3.7/site-packages/adafruit_tca9548a.py", line 47, in try_lock
    while not self.tca.i2c.try_lock():
KeyboardInterrupt

The issue: #8 describes the exact same issue. This issue was resolved by the user by simply not using the TCA. Unfortunately this is not an option for me. Furthermore simply adding a sleep time before the next i2c request does not avoid the deadlock

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