-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix for i2c_t object not being initialized to 0 causing timeout #9895
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
Conversation
@mrcoulter45, thank you for your changes. |
b31576d
to
9eb7a01
Compare
@@ -261,6 +261,7 @@ void i2c_sw_reset(i2c_t *obj) | |||
void i2c_init(i2c_t *obj, PinName sda, PinName scl) | |||
{ | |||
|
|||
memset(obj, 0, sizeof(*obj)); |
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.
sorry but i2c_init is also used internally in several places in this file in order to reset the IP in case of communication issues. When resetting the IP, we don't want to lose the current frequency.
That's why we actually check the value of obj_s->hz
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.
Ok yes good catch, I'll post an alternate fix
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.
updated PR
6ce43f5
to
8f06cb6
Compare
@mrcoulter45 looks good to me. |
|
||
void i2c_init_internal(i2c_t *obj, PinName sda, PinName scl) |
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.
Actually I think you may need to declare this function at the beginning of the file (might be a static one).
Seems to fail building with a few toolchains
0988beb
to
66e8e05
Compare
66e8e05
to
c59c1cb
Compare
Updated PR |
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.
ST CI OK:
target | platform_name | test suite | result | elapsed_time (sec) | copy_method |
---|---|---|---|---|---|
NUCLEO_F091RC-ARM | NUCLEO_F091RC | tests-api-i2c | OK | 19.9 | default |
NUCLEO_F091RC-ARM | NUCLEO_F091RC | tests-assumptions-i2c | OK | 17.39 | default |
NUCLEO_F091RC-GCC_ARM | NUCLEO_F091RC | tests-api-i2c | OK | 22.37 | default |
NUCLEO_F091RC-GCC_ARM | NUCLEO_F091RC | tests-assumptions-i2c | OK | 17.8 | default |
NUCLEO_F091RC-IAR | NUCLEO_F091RC | tests-api-i2c | OK | 19.78 | default |
NUCLEO_F091RC-IAR | NUCLEO_F091RC | tests-assumptions-i2c | OK | 16.69 | default |
NUCLEO_F103RB-ARM | NUCLEO_F103RB | tests-api-i2c | OK | 20.51 | default |
NUCLEO_F103RB-ARM | NUCLEO_F103RB | tests-assumptions-i2c | OK | 17.35 | default |
NUCLEO_F103RB-GCC_ARM | NUCLEO_F103RB | tests-api-i2c | OK | 21.48 | default |
NUCLEO_F103RB-GCC_ARM | NUCLEO_F103RB | tests-assumptions-i2c | OK | 17.99 | default |
NUCLEO_F103RB-IAR | NUCLEO_F103RB | tests-api-i2c | OK | 20.28 | default |
NUCLEO_F103RB-IAR | NUCLEO_F103RB | tests-assumptions-i2c | OK | 16.82 | default |
NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-api-i2c | OK | 19.22 | default |
NUCLEO_F207ZG-ARM | NUCLEO_F207ZG | tests-assumptions-i2c | OK | 16.55 | default |
NUCLEO_F207ZG-GCC_ARM | NUCLEO_F207ZG | tests-api-i2c | OK | 20.8 | default |
NUCLEO_F207ZG-GCC_ARM | NUCLEO_F207ZG | tests-assumptions-i2c | OK | 17.67 | default |
NUCLEO_F207ZG-IAR | NUCLEO_F207ZG | tests-api-i2c | OK | 18.61 | default |
NUCLEO_F207ZG-IAR | NUCLEO_F207ZG | tests-assumptions-i2c | OK | 16.05 | default |
NUCLEO_F303ZE-ARM | NUCLEO_F303ZE | tests-api-i2c | OK | 19.95 | default |
NUCLEO_F303ZE-ARM | NUCLEO_F303ZE | tests-assumptions-i2c | OK | 16.82 | default |
NUCLEO_F303ZE-GCC_ARM | NUCLEO_F303ZE | tests-api-i2c | OK | 20.81 | default |
NUCLEO_F303ZE-GCC_ARM | NUCLEO_F303ZE | tests-assumptions-i2c | OK | 18.3 | default |
NUCLEO_F303ZE-IAR | NUCLEO_F303ZE | tests-api-i2c | OK | 19.49 | default |
NUCLEO_F303ZE-IAR | NUCLEO_F303ZE | tests-assumptions-i2c | OK | 16.27 | default |
NUCLEO_F446RE-ARM | NUCLEO_F446RE | tests-api-i2c | OK | 18.36 | default |
NUCLEO_F446RE-ARM | NUCLEO_F446RE | tests-assumptions-i2c | OK | 15.77 | default |
NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-api-i2c | OK | 19.31 | default |
NUCLEO_F446RE-GCC_ARM | NUCLEO_F446RE | tests-assumptions-i2c | OK | 16.41 | default |
NUCLEO_F446RE-IAR | NUCLEO_F446RE | tests-api-i2c | OK | 18.66 | default |
NUCLEO_F446RE-IAR | NUCLEO_F446RE | tests-assumptions-i2c | OK | 15.66 | default |
NUCLEO_F767ZI-ARM | NUCLEO_F767ZI | tests-api-i2c | OK | 18.5 | default |
NUCLEO_F767ZI-ARM | NUCLEO_F767ZI | tests-assumptions-i2c | OK | 15.69 | default |
NUCLEO_F767ZI-GCC_ARM | NUCLEO_F767ZI | tests-api-i2c | OK | 18.91 | default |
NUCLEO_F767ZI-GCC_ARM | NUCLEO_F767ZI | tests-assumptions-i2c | OK | 16.26 | default |
NUCLEO_F767ZI-IAR | NUCLEO_F767ZI | tests-api-i2c | OK | 18.06 | default |
NUCLEO_F767ZI-IAR | NUCLEO_F767ZI | tests-assumptions-i2c | OK | 15.52 | default |
NUCLEO_H743ZI-ARM | NUCLEO_H743ZI | tests-api-i2c | OK | 22.29 | default |
NUCLEO_H743ZI-ARM | NUCLEO_H743ZI | tests-assumptions-i2c | OK | 15.72 | default |
NUCLEO_H743ZI-GCC_ARM | NUCLEO_H743ZI | tests-api-i2c | OK | 18.5 | default |
NUCLEO_H743ZI-GCC_ARM | NUCLEO_H743ZI | tests-assumptions-i2c | OK | 16.05 | default |
NUCLEO_H743ZI-IAR | NUCLEO_H743ZI | tests-api-i2c | OK | 18.22 | default |
NUCLEO_H743ZI-IAR | NUCLEO_H743ZI | tests-assumptions-i2c | OK | 15.62 | default |
NUCLEO_L073RZ-ARM | NUCLEO_L073RZ | tests-api-i2c | OK | 21.87 | default |
NUCLEO_L073RZ-ARM | NUCLEO_L073RZ | tests-assumptions-i2c | OK | 19.09 | default |
NUCLEO_L073RZ-GCC_ARM | NUCLEO_L073RZ | tests-api-i2c | OK | 24.69 | default |
NUCLEO_L073RZ-GCC_ARM | NUCLEO_L073RZ | tests-assumptions-i2c | OK | 20.76 | default |
NUCLEO_L073RZ-IAR | NUCLEO_L073RZ | tests-api-i2c | OK | 23.9 | default |
NUCLEO_L073RZ-IAR | NUCLEO_L073RZ | tests-assumptions-i2c | OK | 23.9 | default |
NUCLEO_L152RE-ARM | NUCLEO_L152RE | tests-api-i2c | OK | 19.53 | default |
NUCLEO_L152RE-ARM | NUCLEO_L152RE | tests-assumptions-i2c | OK | 16.44 | default |
NUCLEO_L152RE-GCC_ARM | NUCLEO_L152RE | tests-api-i2c | OK | 20.44 | default |
NUCLEO_L152RE-GCC_ARM | NUCLEO_L152RE | tests-assumptions-i2c | OK | 17.46 | default |
NUCLEO_L152RE-IAR | NUCLEO_L152RE | tests-api-i2c | OK | 19.58 | default |
NUCLEO_L152RE-IAR | NUCLEO_L152RE | tests-assumptions-i2c | OK | 16.6 | default |
NUCLEO_L476RG-ARM | NUCLEO_L476RG | tests-api-i2c | OK | 19.47 | default |
NUCLEO_L476RG-ARM | NUCLEO_L476RG | tests-assumptions-i2c | OK | 16.22 | default |
NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | tests-api-i2c | OK | 19.73 | default |
NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | tests-assumptions-i2c | OK | 16.8 | default |
NUCLEO_L476RG-IAR | NUCLEO_L476RG | tests-api-i2c | OK | 19.0 | default |
NUCLEO_L476RG-IAR | NUCLEO_L476RG | tests-assumptions-i2c | OK | 16.13 | default |
60 OK
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.
thanks @mrcoulter45
CI started |
Test run: SUCCESSSummary: 13 of 13 test jobs passed |
Fix for issue #9890
Description
Fix problem where i2c_t not being initialized was causing i2c_init timeout.
Tested locally with two targets and with GCC_ARM and ARM toolchains.
Pull request type
Reviewers
@jeromecoutant
@LMESTM