cancel
Showing results for 
Search instead for 
Did you mean: 

LSM9DS1, the received Data from the accelerometer are swapped. Expected sequence MSB-LSB but I receive LSB-MSB

KDeli.2
Associate II

Hello,

I am working on a project with nRF52832 MCU and LSM9DS1TR IMU sensor with I2C connectivity. 

The code is written on Keil

The driver is according to the datasheet but was observed that the data from IMU received exchanged LSB with MSB. 

Regarding Datasheet "the value is expressed as a 

16-bit word", the 1st 8 bits are the LSB and the 2nd 8bits are the MSB. 

The driver is built according to the datasheet but was observed that the data from IMU received exchanged LSB with MSB. 

The Datasheet mentions "the value is expressed as a 

16-bit word", the 1st 8 bits are the LSB and the 2nd 8bits are the MSB. 

e.g. OUT_X_XL (28h - 29h). 

The data from the register 28h are the LSB and from 29h are the MSB, right??

0693W00000Y6nWnQAJ.pngAs you can see in the attached files, the address of the registers and the reading from I2C is correct, but my data looks like they are swapped.

0693W00000Y6nXHQAZ.pngThe correct order of data is MSB and LSB.

So first we are reading the MSB byte (29h) and then the LSB byte (28h). As we expected the order of the data should be MSB - LSB but when we are printing and sending the data the order is LSB - MSB.

i.e. the MSB changed continuously and the LSB stay constant.

0693W00000Y6nXRQAZ.pngCan you explain the above unusual behavior?

Thank you,

BR,

Konstantinos ​

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi Kostantinos @Community member​ ,

you can refer to the C drivers on Github for the LSM9DS1 --> lsm9ds1_reg.c and lsm9ds1_read_data_polling.c

Please make sure you have well configured the device and the settings you are using for the data acquisition (multiple I2C reading etc...)

-Eleon

KDeli.2
Associate II

Hi @Eleon BORLINI​ 

Thank you, for your quick response.

Yeah, I have already checked them.

We were reading individual reg and with the multiple reading, the accelerometer returns invalid data (FF FF).

BR,

Konstantinos ​

KDeli.2
Associate II

Hello @Eleon BORLINI​ 

I noticed that after resetting (sleep) my device it starts to send invalid data.

Do you know why?

BR,

Konstantinos ​