mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 02:37:19 +02:00
fix(lp_i2c): Fixed a bug where LP I2C write got stuck
This commit fixes a bug where an I2C write got stuck when using the lp_core_i2c_master_write_read_device() API. This was because the LP I2C HW was not programmed with an END condition and therefore did not know the end of a transaction. Closes: https://github.com/espressif/esp-idf/issues/11958
This commit is contained in:
@ -382,11 +382,9 @@ esp_err_t lp_core_i2c_master_write_read_device(i2c_port_t lp_i2c_num, uint16_t d
|
||||
i2c_ll_write_txfifo(dev, &data_wr[data_idx], fifo_size);
|
||||
lp_core_i2c_format_cmd(cmd_idx++, I2C_LL_CMD_WRITE, 0, LP_I2C_ACK, s_ack_check_en, fifo_size);
|
||||
|
||||
if (remaining_bytes) {
|
||||
/* This means we have to send more than what can fit in the Tx FIFO. Insert an End command. */
|
||||
lp_core_i2c_format_cmd(cmd_idx++, I2C_LL_CMD_END, 0, 0, 0, 0);
|
||||
cmd_idx = 0;
|
||||
}
|
||||
/* Insert an End command to signal the end of the write transaction to the HW */
|
||||
lp_core_i2c_format_cmd(cmd_idx++, I2C_LL_CMD_END, 0, 0, 0, 0);
|
||||
cmd_idx = 0;
|
||||
|
||||
/* Initiate I2C transfer */
|
||||
i2c_ll_update(dev);
|
||||
|
Reference in New Issue
Block a user