ESP I2C: Read a specific byte in ESP32 slave inner buffer?

zhaozhaozhao
Posts: 21
Joined: Tue Apr 13, 2021 8:43 am

ESP I2C: Read a specific byte in ESP32 slave inner buffer?

Postby zhaozhaozhao » Mon Sep 20, 2021 1:19 pm

Hello all,

I want to transfer data between two ESP32 through I2C instead of ESP-NOW.
When the ESP32 is set as a slave device, it maintans a slave address and an internal ring buffer. The protocol used by ESP is: after receiving the slave address, the slave device will immediately send N bytes to the I2C bus from the very first byte in the ring buffer.

Is it possible to specify the start address to be read from? I feel it would be more natrual if the slave device can maintain a fixed-size buffer and refresh it perodically. The protocol should also be modified so that the master can specify the start address to be read in the buffer. By this way the ESP slave device would look like an I2C device with 128 registers if the buffer length is set to 128 for example.

Best Regards
Zhao

Victoria Nope
Posts: 75
Joined: Fri Dec 04, 2020 9:56 pm

Re: ESP I2C: Read a specific byte in ESP32 slave inner buffer?

Postby Victoria Nope » Tue Sep 21, 2021 6:40 am

I would quote myself from this post, including the part about sense of getting such buffer access. But most likely I just did not understand your aim.

zhaozhaozhao
Posts: 21
Joined: Tue Apr 13, 2021 8:43 am

Re: ESP I2C: Read a specific byte in ESP32 slave inner buffer?

Postby zhaozhaozhao » Tue Sep 21, 2021 8:59 am

Yeah maybe few people have the same demand.

From the master side I want to read an arbitary byte, say the second byte in the slave ring buffer. Or from the 5th to the 10th byte in the salve ring buffer.
From the slave side I want to clear the ring buffer before writing new content into it, so that there is only one message in the ring buffer, instead of appending the new message after the old message that has not yet been read by master.

Best Regards
Zhao

Who is online

Users browsing this forum: Bing [Bot] and 108 guests