Open xpeedster opened 4 years ago
What kind of device and platform you script are running at ?
It does not work, could u describe more specifically. An error occurred or write data and read data does not matched or other ? Probably because of device internal address alignment issue.Reference i2c device technical documents it will helpful.
Please refer i2c_tool.c it read and write both in the same context, it works fine. Set the fifth arg as ioctl it will using "i2c_ioctl_write" and "i2c_ioctl_read" read/write I2C EEROM.
Here is my test on RPi3 Write/Read 24C02 using ioctl API:
I am having trouble using "i2c_ioctl_write" and "i2c_ioctl_read" in the same script.
If I use only one of them, does not matter which one, it was great. It reads when I aske it to do so, and it writes when I want it to do.
However, if I try to write and read (both in the same script), it does not work as it has to do. I have tried opening a bus, writing and closing it and afterwards opening the bus again to read the data, but it does not work either.
Can it be an interference of the read command over the write one? Or the other way around?
Thanks for the help.