Closed chuyec closed 3 months ago
Hi @chuyec,
First things first. Best wishes for this new year 2024.
Thank you for this report. When checking function I2C_IsErrorOccurred()
, I see no change between firmware versions 1.6.1 and 1.6.2. I notice you used the expression "may return an error". Did you actually experienced an error or is it a guess? Thank you in advance for the clarification.
With regards,
Hi @ALABSTM ,
Yes, I actually experienced an error on version 1.6.2. The error occurs sometimes. The error does not occur on version 1.6.1.
Yes, indeed, there are no changes in the I2C_Is Error Occurred()
function. This is just my guess.
But the next code was removed from HAL_I2C_IsDeviceReady()
:
And some code was added to the I2C_WaitOnFlagUntilTimeout()
function: https://github.com/STMicroelectronics/stm32g0xx_hal_driver/blame/e194e5abc3a125ef08434f1ee122a2bc7b3d9af4/Src/stm32g0xx_hal_i2c.c#L6932
The call stack:
HAL_I2C_IsDeviceReady()
I2C_WaitOnFlagUntilTimeout()
I2C_Is Error Occurred()
Hi @ALABSTM
We solved the problem
Our workflow:
HAL_I2C_IsDeviceReady()
may return failHAL_I2C_IsDeviceReady()
was failed at least once then only I2C_Deinit()
folowed by I2C_Init()
can solve the problemNow we executes I2C_Deinit()
/I2C_Init()
on every I2C chip power switching.
Yes, I agree that power switching of I2C chip that result to ground the I2C pins is not normal operation. But the 1.6.1 version handles this case better than 1.6.2. Please close the bug if you think this is ok.
Thank you for your attention
I am seeing this issue also. The above workaround does solve the problem, but this should really be fixed properly.
Hello All,
Actually, I tested an I2C_EEPROM example on STM32G081B_EVAL board with M24LR64-R EEPROM, it just works fine, and I didn't get any kind of error, especially on HAL_I2C_IsDeviceReady()
function that has been called several times.
With regards,
Hello @chuyec,
Please allow me to close this thread as no activity. You may reopen it at any time if you have any details to share with us. Thank you for your comprehension.
Best Regards.
Describe the set-up
Describe the bug
When checking an I2C device, the check function
HAL_I2C_IsDeviceReady()
may return an error, even if the I2C device is OK.The _STM32Cube FWG0 V1.6.1 does not have such problem.
How To Reproduce
Call the
HAL_I2C_IsDeviceReady()
function several times:Additional context
Supposedly, the problem is in
I2C_IsErrorOccurred()
function.If the next condition is true:
the next code will always be executed:
And then the
I2C_IsErrorOccurred()
function will fail.