ESP32-S3 I2C Slave no end transaction

dan_esp32
Posts: 1
Joined: Wed Nov 15, 2023 2:34 am

ESP32-S3 I2C Slave no end transaction

Postby dan_esp32 » Wed Nov 15, 2023 2:49 am

arduino-esp32: v2.0.9, Arduino IDE v2.0.4.
MCU: ESP32-S3

I have had some success getting I2C slave comms working in the ESP32-S3 using the Wire library with an NXP2132 MCU
as a master and it's working perfectly.

Here's a summary of my I2C comms:
[M - S] Master (NXP) writes the slave address (W) followed by 21 bytes to the slave (ESP32-S3).
Restart bit sent and then the slave address (R) and 100 bytes are read from the slave.
Last byte is NACKed by the master and then stop bit is sent by the master.

The trouble is that there is existing firmware which I need to support for the NXP2132 master MCU which does not fully conform to the i2c specs. The last byte read is not NACKed by the NXP and the stop bit is not sent.

As a work around, in place of the stop bit, I am currently trying to reset the i2c peripheral following a timeout after reading the last byte (I'm using the SCL_MAIN_FSM timeout interrupt for timing of sending the stop bit). I'm not having much luck getting this to work though.

On the first read the slave sends the 100 bytes as expected, but on the next read, following the i2c peripheral reset, the first byte read is incorrect (always 0x45), following this byte the message data is correct. I'm not sure how the tx fifo is getting a garbage byte added in there on the second read message.

Just wondering if anyone could help to think of a possible work around for this? I though it should have a decent chance of working as the first read request is always working correctly.

Who is online

Users browsing this forum: No registered users and 146 guests