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

i2c.c anomalies (IDFGH-7991) #9501

Closed
ammaree opened this issue Aug 5, 2022 · 5 comments
Closed

i2c.c anomalies (IDFGH-7991) #9501

ammaree opened this issue Aug 5, 2022 · 5 comments
Labels
Status: Opened Issue is new

Comments

@ammaree
Copy link

ammaree commented Aug 5, 2022

I have tried to understand the logic relating to the 'clear_bus_cnt' variable but so far have failed completely.
The lines listed below are all the references related in/directly to this variable.

90     #define I2C_ACKERR_CNT_MAX             (10)
1492   static uint8_t clear_bus_cnt = 0;
1507        clear_bus_cnt = 0;
1553                    clear_bus_cnt = 0;
1556                    clear_bus_cnt++;
 	                    if (clear_bus_cnt >= I2C_ACKERR_CNT_MAX) {
 	                        clear_bus_cnt = 0;
 	                    }
 1573            clear_bus_cnt = 0;

I have commented out all the lines, recompiled with no errors and the application has been running for months?
Am I missing something, does this variable and the related code actually do anything useful?

@espressif-bot espressif-bot added the Status: Opened Issue is new label Aug 5, 2022
@github-actions github-actions bot changed the title i2c.c anomalies i2c.c anomalies (IDFGH-7991) Aug 5, 2022
@o-marshmallow
Copy link
Collaborator

Hi @ammaree ,

You are right, that's an issue that we've found recently. Indeed, in the if (clear_bus_cnt >= I2C_ACKERR_CNT_MAX) statement, we must manually call the fsm reset function, else, the variable is useless.

An internal merge request is already on-going.

@AxelLin
Copy link
Contributor

AxelLin commented Nov 17, 2022

fixed in master: 75ede16
But v5.0 and v4.x still need fix.

@AxelLin
Copy link
Contributor

AxelLin commented Dec 17, 2022

v5.0: 4ef2ba2
v4.4: 3ec5041

@AxelLin
Copy link
Contributor

AxelLin commented May 5, 2023

@o-marshmallow
Looks like v4.3 branch needs the backport fix. (Missing i2c_hw_fsm_reset() call)
https://github.com/espressif/esp-idf/blob/release/v4.3/components/driver/i2c.c#L1245-L1247

@ammaree
Copy link
Author

ammaree commented Feb 14, 2024

Have moved on to IDF v5.3 and the new master driver so guess this issue is not relevant any more

@ammaree ammaree closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

4 participants