Skip to content

"OSError: [Errno 121] Remote I/O error" on subsequent runs #1

Closed
@aurimasv

Description

@aurimasv

I'm trying to run the code from Adafruit documentation as well as a slight modification below (to try and deinit the I2C /shrug) on a Raspberry Pi.

import busio
import board
import adafruit_shtc3

with busio.I2C(board.SCL, board.SDA) as i2c:
    sht = adafruit_shtc3.SHTC3(i2c)
    print("Temperature: %0.1f C Humidity: %0.1f %%rH" % sht.measurements)

The first time I run this after the sensor is connected it works fine:

$ ./shtc3.py
Temperature: 28.1 C Humidity: 47.0 %rH

However all subsequent runs throw OSError: [Errno 121] Remote I/O error until the sensor is disconnected and reconnected.

 $ ./shtc3.py
Traceback (most recent call last):
  File "./shtc3.py", line 12, in <module>
    sht = adafruit_shtc3.SHTC3(i2c)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_shtc3.py", line 93, in __init__
    self.reset()
  File "/usr/local/lib/python3.7/dist-packages/adafruit_shtc3.py", line 120, in reset
    self._write_command(_SHTC3_SOFTRESET)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_shtc3.py", line 103, in _write_command
    i2c.write(self._buffer, start=0, end=2)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 102, in write
    self.i2c.writeto(self.device_address, buf, start=start, end=end)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 115, in writeto
    return self._i2c.writeto(address, memoryview(buffer)[start:end], stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/smbus.py", line 308, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

This seems like a similar issue for a different sensor: adafruit/Adafruit_CircuitPython_MLX90393#8

Metadata

Metadata

Assignees

Labels

wontfixThis will not be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions