fix(i2c): Fix lose byte during data reading in i2c master on esp32,

Closes https://github.com/espressif/esp-idf/issues/12860
This commit is contained in:
C.S.M
2024-07-05 12:12:32 +08:00
parent 2803aed082
commit 2ab0921a80

View File

@ -575,7 +575,9 @@ __attribute__((always_inline))
static inline void i2c_ll_read_rxfifo(i2c_dev_t *hw, uint8_t *ptr, uint8_t len)
{
for(int i = 0; i < len; i++) {
ptr[i] = HAL_FORCE_READ_U32_REG_FIELD(hw->fifo_data, data);
// Known issue that hardware read fifo will cause data lose, (fifo pointer jump over a random address)
// use `DPORT_REG_READ` can avoid this issue.
ptr[i] = DPORT_REG_READ((uint32_t)&hw->fifo_data);
}
}