-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add ACKSTAT to I2C return status #183
Conversation
Reviewer's Guide by SourceryThis pull request adds the ACKSTAT bit to the return status of several I2C functions to improve hardware debugging capabilities. This change allows users to identify and diagnose issues related to I2C acknowledgements more effectively. Sequence diagram for I2C Command Start with ACKSTATsequenceDiagram
participant Client
participant I2C_CommandStart
participant I2C_Hardware
Client->>I2C_CommandStart: Call with address
I2C_CommandStart->>I2C_Hardware: Initialize if needed
I2C_CommandStart->>I2C_Hardware: Send Start Signal
I2C_CommandStart->>I2C_Hardware: Transmit address
I2C_Hardware-->>I2C_CommandStart: ACKSTAT status
alt ACKSTAT set or Bus Collision
I2C_CommandStart-->>Client: FAILED | (ACKSTAT << 4)
else Success
I2C_CommandStart-->>Client: SUCCESS | (ACKSTAT << 4)
end
State diagram for I2C Command Response StatusstateDiagram-v2
[*] --> CheckStatus
CheckStatus --> Failed: ACKSTAT set or
Bus Collision
CheckStatus --> Success: ACKSTAT clear and
no Bus Collision
Failed --> [*]: Return FAILED |
(ACKSTAT << 4)
Success --> [*]: Return SUCCESS |
(ACKSTAT << 4)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @bessman - I've reviewed your changes - here's some feedback:
Overall Comments:
- Please explain why this fix only works on legacy hardware and what prevents it from working on current hardware. Understanding the root cause will help evaluate if this is the right approach.
- This change modifies return values by adding ACKSTAT bits. Please confirm that all callers of these functions are prepared to handle the modified return values.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Unknown. Further analysis required.
A previous version of the firmware used to include ACKSTAT in the return status. This was removes during a refactorization of the i2c driver, probably by mistake. Both PC and Android drivers expect ACKSTAT to be present in the return status; its omission breaks i2c device scanning. |
This solves #182 on legacy hardware, but NOT on current hardware. Further troubleshooting required.
Summary by Sourcery
Bug Fixes: