mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-08 01:55:23 +00:00
Make sure to retry at least once after the timeout elapses. Sample the current time before starting the i2c transaction, and only give up if the polling occurred after the timeout. The timeout exists to allow the eeprom time to complete a write, during which time it will nack transactions (at24) or the status register will report busy (at25). If a transaction fails legitimately, but the 1ms sleep overshoots the timeout expiration, we will not try again, which fails to give the part the full grace period before declaring failure. This is likely to happen in the last 1ms interval but also possible if the eeprom thread is preempted. It is possible to only try once and give up if the sleep lasts longer than the timeout, which fails to give the part an adequate period to complete the write. Waiting until the current time is after (not equal to) the timeout is also important because we don't want to round up partial milliseconds if the start time was sampled near the end of a millisecond boundary. The timeouts of eeproms can be ~5ms. Signed-off-by: Tyler Hall <tylerwhall@gmail.com> |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
eeprom_at2x.c | ||
eeprom_handlers.c | ||
eeprom_shell.c | ||
eeprom_simulator.c | ||
eeprom_stm32.c | ||
Kconfig | ||
Kconfig.stm32 |