Writing to a memory address using I2C

benedito821
Posts: 15
Joined: Fri Mar 19, 2021 9:58 pm

Writing to a memory address using I2C

Postby benedito821 » Sat Sep 23, 2023 12:52 pm

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.

savages
Posts: 3
Joined: Thu Sep 21, 2023 5:44 pm

Re: Writing to a memory address using I2C

Postby savages » Sat Sep 23, 2023 5:08 pm

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.

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

Re: Writing to a memory address using I2C

Postby MicroController » Sat Sep 23, 2023 6:55 pm

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.

Who is online

Users browsing this forum: ok-home and 109 guests