Skip to content

fails intermittently on raspberry pi #3

Closed
@brennen

Description

@brennen

Testing on Pi with latest version of the library. Reads roughly every other attempt.

Tried with 10k and 1k resistors and with none at all, no difference. Not sure if I'm missing something there.

$ python am2320.py 
Humidity: 46.8%
Temperature: 25.4C
Traceback (most recent call last):
  File "am2320.py", line 10, in <module>
    print('Humidity: {0}%'.format(sensor.relative_humidity))
  File "/home/pi/blinkenlight/lib/python3.5/site-packages/adafruit_am2320.py", line 125, in relative_humidity
    humidity = struct.unpack(">H", self._read_register(AM2320_REG_HUM_H, 2))[0]
  File "/home/pi/blinkenlight/lib/python3.5/site-packages/adafruit_am2320.py", line 93, in _read_register
    i2c.write(bytes([0x00]))
  File "/home/pi/blinkenlight/lib/python3.5/site-packages/adafruit_bus_device/i2c_device.py", line 102, in write
    self.i2c.writeto(self.device_address, buf, **kwargs)
  File "/home/pi/blinkenlight/lib/python3.5/site-packages/busio.py", line 61, in writeto
    return self._i2c.writeto(address, buffer, stop)
  File "/home/pi/blinkenlight/lib/python3.5/site-packages/adafruit_blinka/microcontroller/raspi_23/i2c.py", line 36, in writeto
    self._i2c_bus.write_bytes(address, buffer)
  File "/home/pi/blinkenlight/lib/python3.5/site-packages/Adafruit_PureIO/smbus.py", line 244, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

Checking with i2cdetect twice in a row:

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- 5c -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

cc: @kattni, @ladyada

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