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

TeeVee
Posts: 13
Joined: Tue Sep 12, 2017 2:00 pm

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

Postby TeeVee » Fri May 10, 2024 8:11 am

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?

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

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

Postby MicroController » Fri May 10, 2024 8:32 am


TeeVee
Posts: 13
Joined: Tue Sep 12, 2017 2:00 pm

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

Postby TeeVee » Fri May 10, 2024 11:03 am

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

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

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

Postby MicroController » Fri May 10, 2024 11:30 am

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.

Who is online

Users browsing this forum: benrank, bfredo123, Majestic-12 [Bot] and 76 guests