nonNoise / PyMCP2221A

MCP2221 & MCP2221A work in Python.
MIT License
36 stars 21 forks source link

_i2c_read function sets external device's SDA to low indefinitely until reboot #21

Open MembrilloAmarillo opened 2 years ago

MembrilloAmarillo commented 2 years ago

Working with your module and a ADM00559 that features a MCP2221A, I had a problem where I make a read request several times in a loop (independently of the time passed between requests) and after some requests it sets the SDA of one of the devices connected through I2C to low, and the only way to restore I2C communication is to reboot the external device. And came to the conclusion that part of the problem was on function _i2c_read( self, addrs, size, buf ) line 576 - 580 and 591-595. I thought it could be because of a bad read request, then enter the if statement and both, cancels and inits I2C communication and then returns -1. I commented that part and the problem was gone, so I wonder if cancel and init functions are needed when a bad request arrives.