-
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
cpu/stm32_common: Bug fixes for stm i2c #10540
Conversation
Still a WIP but I tried to really clean up the i2c_2.c since most things were not working. I think I may have to also do the same for i2c_1.c, at least get it into a state that it can use the standard read/write regs. I can try to setup so the HiL tests it too. |
ce86acb
to
a78e7fe
Compare
a78e7fe
to
4195a66
Compare
This commit fixes configuration problems when trying to use i2c pins that need to be remapped. All B8 and B9 pins for STM32F1 need to be remapped, so a check is done if the remappable pins are selected.
Refactors i2c_2 to match the structure of i2c_1 better. Corrects functionality issues. Allows the common implementation of read_regs and write_regs. Documents contraints of hardware. Matches error messages with API.
Refactor to use common read_regs. Add error reporting and handling for unsupported low level commands. Document hardware constraints.
4195a66
to
e402359
Compare
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.
Very nice work but there are quite some changes. Maybe the pin remapping could be part of a separate PR. Since it's small and it only affect a few boards (only f1 based), it should simpler and faster to review.
I also think the pm_layered change in the i2c1 driver variant could be part of its own PR.
@@ -16,9 +17,9 @@ | |||
* @file | |||
* @brief Low-level I2C driver implementation | |||
* | |||
* This driver supports the STM32 F4 families. | |||
* This driver supports the STM32 F1, L1, and F4 families. |
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.
and F2
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.
Yup thanks, I will split everything out.
Also it's quite unclear to me why this PR would fix #3366 since this issue is not only related to stm32. Can we confirm that it's already fixed for other families (nrf, etc) ? If it's not the case, I suggest to remove the mention in the initial comment if this PR. |
@aabadie True, It only helps the stm, I have not check all the other boards. |
Contribution description
This PR fixes many bugs discovered by the HiL.
Example of bytes saved with build sizes of tests/periph_i2c
Testing procedure
Test on stm32f1, stm32f4 and (stm32f3, f0, l0 or l4)
One can run the robot-test from the HiL branch or run term in tests/periph_i2c/
Or run manually against your favorite i2c device. No everything will be supported but everything should at least give correct error messages and not lock up the bus.
*If nucleo-f103rb is used it needs external pullups.
Issues/PRs references
fixes #10395
helps with stm32 based boards for #3366
checks some boxes in #9518