-
Notifications
You must be signed in to change notification settings - Fork 2k
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
stm32_common/i2c_2: Fix repeated read condition #12571
stm32_common/i2c_2: Fix repeated read condition #12571
Conversation
Fix the condition to return -ENOPNOTSUPP when i2c repeated read attempted. Currently the error occures even if a read after write is attempted. This is the standard way to i2c_read_reg which should be supported. The -EOPNOTSUPP requires the previous R/W state to be reading. This means a `I2C_SR2_TRA` must be checked to be 0.
@aabadie ya, I don't know what I was thinking... Sorry. Also weird that the CI didn't catch that. I will have to look into that. |
I confirm #12564 is fixed by this PR. Thanks for tackling it so quick. |
Thanks for finding it, silly mistake on my part. |
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.
Reasoning for the fix is OK and comment is explaining it.
Before approving, it would be great to verify other affected STMs are also working (F2, L1, F4). But maybe this is not mandatory ?
They typically have the same base register map... |
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.
Then let's go.
ACK
❤️ |
Contribution description
Fix the condition to return -ENOPNOTSUPP when i2c repeated read attempted.
Currently the error occures even if a read after write is attempted.
This is the standard way to i2c_read_reg which should be supported.
The -EOPNOTSUPP requires the previous R/W state to be reading.
This means a
I2C_SR2_TRA
must be checked to be 0.This bug was caught by @aabadie with and using saul in iotlabs testbed.
Testing procedure
To test you can use the iotlab-m3 and test the lps331ap driver:
BOARD=iotlab-m3 IOTLAB_NODE=<my_iotlab_node> make flash term -C tests/driver_lpsxxx/
To ensure the no support error is correctly working:
BOARD=iotlab-m3 IOTLAB_NODE=<my_iotlab_node> make flash term -C tests/periph_i2c/
Also testing procedure is documented in #12564
Issues/PRs references
Fixes #12564
Request to add test for CI RIOT-OS/RobotFW-tests#39