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

Imx9 i2c fixes #284

Merged
merged 3 commits into from
Sep 20, 2024
Merged

Imx9 i2c fixes #284

merged 3 commits into from
Sep 20, 2024

Conversation

jlaitine
Copy link

This adds some more robust error handling to the imx9 i2c

  • Added cleanup in case of timeout
  • Irq:s are enabled at once

Both RX and TX interrupts can be enabled after the setup of the transfer; the TX interrupt
must be enabled after queuing the first byte as done before. It is not possible to miss the
RX interrupts, as it pends as long as the byte gets read from the FIFO

When starting the TX, the first byte can be queued instantly, it won't be sent out to the
bus if there is NACK to the address. This also prevents spurious TX interrupts in error
cases, since the TX queue is not empty after initiating a transfer.

In some error cases controller sends STOP by itself even if AUTOSTOP is disabled.
It is better to tell the controller to ABORT, which will also generate STOP only when needed.

Signed-off-by: Jukka Laitinen <[email protected]>
@jlaitine
Copy link
Author

Now I have tested this as good as I possibly can.

The driver may still fail due to nuttx tick timer being broken, made a new JIRA about that. Increasing the timeout to min 2 ticks removes all the issues, but I didn't do that. Let's fix the tick timer instead.

Verfifed with logic analyzer that there are no timing issues and made a several hours test with all the sensors running.

Also made some testing with tampering with GPS module cable causing a load of errors on the bus. The driver seems to also recover quite nicely.

@jlaitine jlaitine merged commit 16ae11f into master Sep 20, 2024
11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants