Other Parts Discussed in Thread: HALCOGEN
Dear TI,
I have a problem with I2C communication on Hercules RM57L843 microcontroller.
I try to communicate with an ST accelerometer LIS2DW12.
The following communication method is used.
The address of the slave is the following:
So for example to read a register from the sensor, with SAD[0] = 0 I need the following method:
-send start START - from master to slave
-send SAD+W (30H) - from master from master to slave
-receive SAK - from slave to master
-send SUB (register address which I want to read) - from master to slave
-receive SAK - from slave to master
-send start START again - from master to slave
-send SAD+R (31H) - from master from master to slave
-receive SAK - from slave to master
-receive the DATA from the register I want to read - from slave to master
-send NMAK (No Master Acknowledge) - from master to slave (guess I don't need to send anything since No master acknowledge needed)
-send STOP - from master to slave
MEMS digital output motion sensor: high-performance ultra-low-power 3-axis "femto" accelerometer (farnell.com) this is the documentation of the sensor, 6.1.1 I2C operation section is where I found these information.
I tried to implement this communication using the HalCoGen generated I2C driver, but I'm not able to make it work.
I tried the example code from this thread (HALCOGEN: i2C example with repeated START condition, using HALCoGen api - Hercules safety microcontrollers forum - Hercules safety microcontrollers - TI E2E support forums) The read looked like it is working, but I had issues with it. The write was not working at all.
Please can you provide me any example code for this repeated start condition I2C communication, for this sensor.
Thank you.