Page 1 of 1

How to Rd/Wr data from I2C device with extra opcode (ADS7142)

Posted: Fri May 10, 2024 8:11 am
by TeeVee
We have an ESP32-S3 design using ADS7142 device from TI controlled by I2C bus.
To write or read data to or from ADS7142 registers you do not only have to transmit device address and register address but
also an Opcode for read/block read/write etc. which is an 8bit byte.

Simply spoken to read a register you need to do this sequence (acks not shown)
1. Access
Start - device address - Write bit - Wr/Rd OpCode - Register address - Stop
2. Access
Start - device address - Read bit - register data from device - Stop

We do not see a way how this can be implemented with I2C API of esp-idf (latest mater 5.2.x)
Does anybody have an idea how this can be implemented?

Re: How to Rd/Wr data from I2C device with extra opcode (ADS7142)

Posted: Fri May 10, 2024 8:32 am
by MicroController

Re: How to Rd/Wr data from I2C device with extra opcode (ADS7142)

Posted: Fri May 10, 2024 11:03 am
by TeeVee
Hi Microcontroller,

thanx for your proposal - unfortunately this does not work due to the issue in I2C API, see
https://github.com/espressif/esp-idf/issues/13400
With i2c_master_transmit the buffer data are sent in a row so if you have e.g. 24bit in the buffer
all 24 bits are sent without interrupting.
The ADS71242 however expects that after every byte (8bits) I2C host waits for ACK

Re: How to Rd/Wr data from I2C device with extra opcode (ADS7142)

Posted: Fri May 10, 2024 11:30 am
by MicroController
TeeVee wrote:
Fri May 10, 2024 11:03 am
unfortunately this does not work due to the issue in I2C API, see
https://github.com/espressif/esp-idf/issues/13400
That issue seems to not be relevant to your case.
With i2c_master_transmit the buffer data are sent in a row so if you have e.g. 24bit in the buffer
all 24 bits are sent without interrupting.
The ADS71242 however expects that after every byte (8bits) I2C host waits for ACK
Sounds like standard I2C. Haven't checked the ADS's datasheet, but I guess it's also I2C standard compliant, so both the ESP and the ADS should be able to properly handle standard I2C ACKs without you doing anything.