cpu/sam0_common/periph_i2c: reliably unstuck bus#21891
Merged
maribu merged 1 commit intoRIOT-OS:masterfrom Nov 27, 2025
Merged
Conversation
crasbe
reviewed
Nov 17, 2025
Contributor
crasbe
left a comment
There was a problem hiding this comment.
Would it make sense to alter the success variable if the bus-unsticking was successful?
Can't really comment on the function of the code, as I don't have the hardware nor experience with the SAM0 in general.
Member
Author
|
I think there are still some other factors that I do not fully understand yet. |
Member
Author
On a setup I have on my desk I can reliably get the I2C bus stuck. But the current unstuck logic will not get it unstuck. Adding a full reset of the SERCOM does fix the issue, though. Co-authored-by: crasbe <[email protected]>
1b5be2e to
0967c6b
Compare
Member
Author
|
This now reliably unstucks the I2C bus on my very very cursed setup. I'm quite confident that this will also reliably work on much less cursed setups. |
benpicco
approved these changes
Nov 27, 2025
Contributor
benpicco
left a comment
There was a problem hiding this comment.
Changes look nice and small too
Member
Author
|
Thx a lot ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Contribution description
On a setup I have on my desk I can reliably get the I2C bus stuck. But the current unstuck logic will not get unstuck it. Adding a power cycle of the I2C bus to the unstuck logic does fix the issue, so let's do that.
Testing procedure
I2C should still work. E.g. as seen here on the
same54-xpro:In addition, when the bus gets stuck, the current I2C transaction does indeed still fail. But subsequent transactions will work again.
In
masterusing my cursed setup, the bus would stay stuck once it is stuck and never recover.Issues/PRs references
None