2022-12-23 03:02 AM
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??
As 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.
The 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.
Can you explain the above unusual behavior?
Thank you,
BR,
Konstantinos
2022-12-23 03:21 AM
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
2022-12-23 03:41 AM
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
2022-12-27 06:24 AM
Hello @Eleon BORLINI
I noticed that after resetting (sleep) my device it starts to send invalid data.
Do you know why?
BR,
Konstantinos