cancel
Showing results for 
Search instead for 
Did you mean: 

LSM9DS1 I2C Write to r/w registers

JFand.1
Associate

I have an LSM9DS1 IMU/Magnetometer and I am having difficulty in writing a value to the control registers and reading it back after.

I am using the I2C protocol with my MCU device set up as the master and the LSM9DS1 setup as the slave.

1.      I am able to read correctly the WHO_AM_I and WHO_AM_I_M registers.

2.      CTRL_REG1_M from the manual when reading this register is expected to return by default 0x10, when I read this register it returns 0x18

3.      INT_CFG_M from the manual when reading this register is expected to return by default 0x08, when I read this register it returns 0xE8

4.      Writing to CTRL_REG6_XL the value 0x20. When I read it back, I read 0x00.

5.      Writing to CTRL_REG1_G the value 0x20. When I read it back, I read 0x00.

6.      Writing to CTRL_REG3_G the value 0x80. When I read it back, I read 0x00.

7.      Writing to CTRL_REG1_M the value 0x90. When I read it back, I read 0x00.

The schematic how the LSM9DS1 is connected is attached.

Once again I believe the I2C connection is correct since I am able to read the WHO_AM_I and WHO_AM_I_M registers.

1.      Is there something special that needs to be done before writing to the control registers?

2.      Why do CTRL_REG1_M and INT_CFG_M come out with values that are different from the default values documented in the datasheet of the LSM9DS1?

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @JFand.1​ , do you think you are only able to read I2C but you cannot write I2C? Did you correctly set the R/W bit of the I2C communication (p.29 of LSM9DS1 datasheet)?

0693W000000UzEiQAK.png

Are you able to read the dataout registers (for example the OUT_X_XL (28h - 29h))? Regards