Skip to content

don't use i2c_master_transmit_receive in SCCB driver (IDFGH-16798) #823

@yunlong12

Description

@yunlong12

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

with this function, it writes data and then read data. in the write operation the R/W bit is 0, which is correct. But in the read phase, the R/W bit is still 0, which is wrong.

I found this bug, when use SCCB_Read in the procedure of configuring a camera.

I replace the i2c_master_transmit_receive with the code below and then I can get what I want.
// Write register address (this issues START + address with R/W=0)
esp_err_t ret = i2c_master_transmit(dev_handle, tx_buffer, 1, TIMEOUT_MS);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "SCCB_Read addr phase failed addr:0x%02x, reg:0x%02x, ret:%d", slv_addr, reg, ret);
return 0;
}
// Read the register value (this issues a new START + address with R/W=1)
ret = i2c_master_receive(dev_handle, rx_buffer, 1, TIMEOUT_MS);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions