Control never returns from stm32_i2c_msg_write(), whe SCL is pulled low permanently (hardware fault occurs) #26975
Labels
area: I2C
bug
The issue is a bug, or the PR is fixing a bug
platform: STM32
ST Micro STM32
priority: low
Low impact/importance bug
Stale
Describe the bug
A clear and concise description of what the bug is.
When there is a faulty hardware sensor connected via I2C interface, the control is not returned from stm32_i2c_msg_write() function even during initialization, I did tests with SHT3xd sensor sample app to conclude to this bug in the software. In order to further confirm the problem, I artificially pulled SCL signal line to low which resulted in the same problem.
I further debugged the stm32_i2c_msg_write(), and found that k_sem_take(&data->device_sync_sem, K_FOREVER); does not return the control, semophore resources are never released by other thread using those resources.
What have you tried to diagnose or workaround this issue?
I tried to reduce timeout value with k_sem_take(,timeout) function and used 5s, the control is returned after 5s but data->current.is_nack is not set which does not return the function with correct error code so that the calling function (driver initialization or sensor read may react appropriately upon such hardware failure).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
stm32_i2c_msg_write() should return error code when I2C finds a faulty hardware on the interface.
Impact
What impact does this issue have on your progress (e.g., annoyance, showstopper)
The main application does not handle faulty hardware line effectively.
Logs and console output
If applicable, add console logs or other types of debug information
e.g Wireshark capture or Logic analyzer capture (upload in zip archive).
copy-and-paste text and put a code fence (```) before and after, to help
explain the issue. (if unable to obtain text log, add a screenshot)
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: