Skip to content
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

Fix for i2c_t object not being initialized to 0 causing timeout #9895

Merged
merged 1 commit into from Mar 14, 2019

Conversation

Projects
None yet
7 participants
@mrcoulter45
Copy link
Contributor

commented Feb 28, 2019

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

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@jeromecoutant
@LMESTM

@ciarmcom ciarmcom requested review from screamerbg and ARMmbed/mbed-os-maintainers Feb 28, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

commented Feb 28, 2019

@mrcoulter45, thank you for your changes.
@screamerbg @ARMmbed/mbed-os-maintainers please review.

@cmonr

cmonr approved these changes Feb 28, 2019

@@ -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));

This comment has been minimized.

Copy link
@LMESTM

LMESTM Mar 1, 2019

Contributor

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

This comment has been minimized.

Copy link
@mrcoulter45

mrcoulter45 Mar 1, 2019

Author Contributor

Ok yes good catch, I'll post an alternate fix

This comment has been minimized.

Copy link
@mrcoulter45

mrcoulter45 Mar 4, 2019

Author Contributor

updated PR

@0xc0170 0xc0170 added needs: work and removed needs: review labels Mar 1, 2019

@mrcoulter45 mrcoulter45 force-pushed the mrcoulter45:issue-9890-fix branch 2 times, most recently Mar 1, 2019

@LMESTM

LMESTM approved these changes Mar 5, 2019

@LMESTM

This comment has been minimized.

Copy link
Contributor

commented Mar 5, 2019

@mrcoulter45 looks good to me.
@jeromecoutant - could we start a test non regression session around CI test shield / I2C ?


void i2c_init_internal(i2c_t *obj, PinName sda, PinName scl)

This comment has been minimized.

Copy link
@LMESTM

LMESTM Mar 5, 2019

Contributor

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

@mrcoulter45 mrcoulter45 force-pushed the mrcoulter45:issue-9890-fix branch 2 times, most recently Mar 5, 2019

@mrcoulter45 mrcoulter45 force-pushed the mrcoulter45:issue-9890-fix branch to c59c1cb Mar 5, 2019

@mrcoulter45

This comment has been minimized.

Copy link
Contributor Author

commented Mar 7, 2019

Updated PR

@jeromecoutant
Copy link
Contributor

left a comment

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

@cmonr cmonr added needs: CI and removed needs: work labels Mar 7, 2019

@LMESTM

LMESTM approved these changes Mar 8, 2019

Copy link
Contributor

left a comment

thanks @mrcoulter45

@0xc0170

0xc0170 approved these changes Mar 8, 2019

@0xc0170

This comment has been minimized.

Copy link
Member

commented Mar 8, 2019

CI started

@mbed-ci

This comment has been minimized.

Copy link

commented Mar 9, 2019

Test run: SUCCESS

Summary: 13 of 13 test jobs passed
Build number : 1
Build artifacts

@cmonr cmonr added ready for merge and removed needs: CI labels Mar 13, 2019

@0xc0170 0xc0170 merged commit 897d15a into ARMmbed:master Mar 14, 2019

28 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARMC5 Success
Details
jenkins-ci/build-ARMC6 Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR8 Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(-52 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARMC5 Success
Details
jenkins-ci/mbed2-build-ARMC6 Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR8 Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Local astyle testing has passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/doxy-spellcheck Local doxy-spellcheck testing has passed
Details
travis-ci/events Passed, runtime is 9281 cycles (-881 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/include_check Local include_check testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8408B (+0.00%)
Details
travis-ci/psa-autogen Local psa-autogen testing has passed
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
travis-ci/tools-py3.5 Local tools-py3.5 testing has passed
Details
travis-ci/tools-py3.6 Local tools-py3.6 testing has passed
Details
travis-ci/tools-py3.7 Local tools-py3.7 testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.