OSError: [Errno 5] EIO.
Now I've looked up what it means and apparently it's an Input/Output error (I/O error). I found a thread of a few months ago where someone had a similar problem, and it was solved by adding a small delay after the writing operation. However, I have added up to 100ms delay without succesfully mitigating the error. The error happens semi-regularly after calling the read_byte function inside a for loop, but it never happens when I read it with putty.
Code: Select all
def read_byte(addr, nr_of_bytes, i2cobj):
bytes_read = bytearray(nr_of_bytes)
bytes_read[:] = i2cobj.mem_read(nr_of_bytes, MPU_address, addr)
return bytes(bytes_read)