Page 1 of 1

Writing to a memory address using I2C

Posted: Sat Sep 23, 2023 12:52 pm
by benedito821
Is there a way of writing to a specific memory address using the ESP32 I2C driver? I could find the functions i2c_master_write_to_device and i2c_master_read_from_device but they don't take into consideration the memory address of the device.

Re: Writing to a memory address using I2C

Posted: Sat Sep 23, 2023 5:08 pm
by savages
Every I2C device needs a driver. The ESP I2C APi just write data to the device.
For memory read or write there is a register on the memory device that holds the memory address you want accessed.

Look at the I2C device, find the part number and then find the documentation for that part . that should tell you how to access the memory of the part.

Re: Writing to a memory address using I2C

Posted: Sat Sep 23, 2023 6:55 pm
by MicroController
The protocol used for accessing certain functions/addresses/... of an I2C slave is specific to the slave device and not part of the I2C protocol layer.
If you can't find a driver for your specific device, you'll have to implement that device's protocol youself, using the IDF's I2C driver API to build and execute transactions conforming to that protocol. The datasheet of the slave device will give you all the specifics as to what an I2C master needs to do to perform the desired operations on the slave.