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

Driver: I2C: STM32F2/STM32F4/STM32L1: Fix alternate i2c read. #14668

Merged
merged 1 commit into from May 24, 2021

Conversation

ikmdani
Copy link
Contributor

@ikmdani ikmdani commented May 17, 2021

This commit fixes the i2c driver issue reported in #13967 on STM32F2xx, STM32F4xx & STM32L1xx series.
fix #13967

Signed-off-by: Krishna Mohan Dani krishnamohan.d@hcl.com

Summary of changes

As issue describes, every alternate i2c read was failing. On the bus side there was no transaction of alternate i2c read, the state machine (PreviousState) prevented to trigger START condition of second transaction as the first transaction did not end it cleanly, the PreviousState was still set as I2C_STATE_MASTER_BUSY_RX although the first transaction was complete. In the second transaction as START condition did not occur, the second transaction timesout followed by a reset of the entire i2c hal which also resets the state machine PreviouState, due to this the third transaction is successful and this cycle repeats.

Impact of changes

So this PR sets PreviousState = I2C_STATE_NONE in the master receive complete callback function to indicate completion of receive and that bus is idle.

The data type of XferOperation has been changed from uint8_t to uint32_t
so that it can hold a 32bit value (for example: I2C_OTHER_FRAME or
I2C_OTHER_AND_LAST_FRAME).

Migration actions required

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


… F4 & L1 families.

This commit fixes the i2c driver issue reported in the below link:
ARMmbed#13967 on STM32F4xx platform.

The data type of XferOperation has been changed from uint8_t to uint32_t
so that it can hold a 32bit value (for example: I2C_OTHER_FRAME or
I2C_OTHER_AND_LAST_FRAME).

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
@ikmdani ikmdani changed the title Driver: I2C: STM32F4: Fix for every alternate i2c read failure in F2,… Driver: I2C: STM32F2/STM32F4/STM32L1: Fix alternate i2c read. May 17, 2021
@mergify mergify bot added the needs: CI label May 17, 2021
@0xc0170 0xc0170 added the release-type: patch Indentifies a PR as containing just a patch label May 18, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented May 18, 2021

CI started

@mbed-ci
Copy link

mbed-ci commented May 18, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@rotu
Copy link
Contributor

rotu commented May 20, 2021

Where are the existing tests that cover this? I can’t find any for i2c that would run on the target platforms

@0xc0170
Copy link
Contributor

0xc0170 commented May 21, 2021

Where are the existing tests that cover this? I can’t find any for i2c that would run on the target platforms

@ikmdani did you use fpga or ci shields to verify this or ?

@jeromecoutant
Copy link
Collaborator

I have tested CI test shield and FPGA!

@adbridge adbridge merged commit 10a2da9 into ARMmbed:master May 24, 2021
@mergify mergify bot removed the ready for merge label May 24, 2021
@mbedmain mbedmain added release-version: 6.12.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STM32 I2C read - every second fails (OS6)
7 participants