Skip to content
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

Chip_I2C_MasterTransfer hangs out forever if the slave doesn't respond #16

Open
henrique-silva opened this issue Oct 1, 2015 · 1 comment

Comments

@henrique-silva
Copy link
Contributor

This mostly happens when the selected address is wrong, making the LPCOpen function hangs in the following loop:

while (Chip_I2C_MasterTransfer(id, &xfer) == I2C_STATUS_ARBLOST) {}

A solution would be to implement a timeout on this function

@qermit
Copy link
Contributor

qermit commented Oct 2, 2015

Not a timeout but correct i2c bus handling, In this case NAK (SLA+W/SLA+R) should be triggered.
xfer.status = I2C_STATUS_NAK will be returned and xfer.txSz should be not changed.

A code may hang in this state only if i2c interface has no pullup resistors or something is disturbing lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants