AnsweredAssumed Answered

LPC4337 I2C - Write to Slave Register?

Question asked by Andrew Murfin on Jun 21, 2018
Latest reply on Jun 26, 2018 by Kerry Zhou

Hello

 

I am using the LPC4337 to manipulate the LSM9DS1 IMU.  I have found success using the "Chip_I2C_MasterCmdRead" function to read data from the sensor's registers, however I can't figure out how to write data to those subaddress' registers.  

 

For example, if I want to read data from the accelerometer's control register 8, I do this:

 

uint8_t buffer;

Chip_I2C_MasterCmdRead(i2cDev, 0x6B/*address of slave*/, 0x22/*subaddress of ctrl_reg8*/, &buffer, 1);

 

That will put the data onto "buffer" for me to view.  However, if I want to WRITE onto this register (in order to change settings), I can't find any functions which will allow me to do this.  The "Chip_I2C_MasterSend" function only has an option for the slave's main address, without any option to send to a specific subaddress.  I guess what I'm looking for might look like this:

 

Chip_I2C_MasterCmdWrite(I2CModule, slave_address, subaddress, cmd, *buffer, length);

 

Is there a provided function which I have looked over, and if not can you help me create a function which will work for my needs?

 

Thanks!

-Andy 

Outcomes