-
Notifications
You must be signed in to change notification settings - Fork 101
fix(PeriphDrivers): Issue #1293: MAX32670 I2C Driver causes a Double-Read #1359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(PeriphDrivers): Issue #1293: MAX32670 I2C Driver causes a Double-Read #1359
Conversation
Hello, as I mentioned in the issue #1293, I recommend changing the first while loop to an if statement. This will prevent the possibility of infinite loops if the I2C peripheral is busy / hanging. Returning an error indicating the I2C controller is busy is sufficient in this case, and a while loop should not be needed. I tested this as well and left screenshots in the issue linked. I would propose changing this: while(i2c->status & MXC_F_I2C_REVA_STATUS_BUSY) {}
// Wait until last transaction finished and bus ready to this: // If there is an active transaction, return a BUSY error
if (i2c->status & MXC_F_I2C_REVA_STATUS_BUSY) {
return E_BUSY;
} |
Hello, is there any response to my request above or info on when this change could be merged? |
Sorry, I've been away from MSDK support for a while because of other pending tasks. I agree with this too; we should avoid an infinite loop without a timeout or any way to exit. |
e6554a7
to
15a1fbd
Compare
I too faced the same Problem of I2C hanging in infinite loop due to sudden transaction , while interfacing MAX78000 with ADXL382 accelerometer and the above proposed solution of making I2C bus wait till end of transaction has helped me fix it. |
…#1293) Signed-off-by: Dung Nguyen <[email protected]>
15a1fbd
to
3b22558
Compare
@AlbertFrancis07, you could also try with the solution not using the while-loop. |
Description
In the Master Transaction function, add a checking to return BUSY if the I2C bus is not ready.