2018-03-07 05:03 AM
Hi Sir,
I am using ST accelerometer Sensor LIS3DH (adapter board STEVAL-MKI105V1) with I2C interface.
I can now read the registers
. But for the registers which doesn't have default value, for example,
OUT_X_L (0x28),
OUT_
X
_H(0x29),
OUT_Y_L
(0x2A),
OUT_Y_H
(0x2B),
OUT_Z_L
(0x2C),
OUT_Z_H
(0x2D),
the value read are all zero.
My questions:
1. How to get the correct accelerometer value for the registers which doesn't have default value? Any configurations needed before reading the registers?
2. “AN3308� chapter 4 Startup sequence to write the registers, but what values should be written? Could you help to advice?
Thanks,
Arna Lee
2018-03-07 05:52 AM
Or course you have to configure the sensor first, there are several modes and features which needs to be configured.
Please read carefully the datasheet and the application note.You have to at lease set the Output Data Rate in CTRL_REG1.
2018-03-07 08:41 PM
Hello
Batek.Miroslav
Thank you for the comment.
I tried to configure
CTRL_REG1
then read OUT_X_/OUT_Y_/OUT_Z_, for example,OUT_Y
_L, but I got different/changing value even though I didn't move it. It is normal?Could you be kindly to review my log if anything wrong?
Thanks a lot.
--- Logs ---
START...
call LIS3DH_GetWHO_AM_I read LIS3DH_WHO_AM_I(0x0F) reg: 0x33--- UART2 RX HEX: ---
7E 20 03 33 20 4E Cal_Checksum: 0x4E call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x20, Response: 0x57--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x80--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x80--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x40--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0xC0--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x40--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x40--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0xC0--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x40--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x80--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x00--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0x40--- UART2 RX HEX: ---
7E 20 04 33 2A 43 Cal_Checksum: 0x43 call HAL_I2C_Mem_Read Read I2C device addr: 0x33, register addr 0x2A, Response: 0xC0---
Thanks,
Arna Lee
2018-03-10 08:15 AM
It is absolutly normal, there is always some small noise, caused by the sensor itself or by vibration of the enviroment.
2018-03-12 07:35 PM
Hi Sir,
I am confused.
I just keep the sensor on the desk. But it looks like the XYZ data change a little big?
Any other register needed to be configured before using XYZ register/data?
**************************************
START...
call LIS3DH_GetWHO_AM_I
read LIS3DH_WHO_AM_I(0x0F) reg: 0x33
--- UART2 RX HEX: ---
7E 20 03 33 20 4E
Cal_Checksum: 0x4E
call HAL_I2C_Mem_Read
Read I2C device addr: 0x33, register addr 0x20, Response: 0x57
--- UART2 RX HEX: ---
7E 24 01 5B
Cal_Checksum: 0x5B
X= -128 Y= -1856 Z=-16064
--- UART2 RX HEX: ---
7E 24 01 5B
Cal_Checksum: 0x5B
X= -128 Y= -1664 Z=-16000
--- UART2 RX HEX: ---
7E 24 01 5B
Cal_Checksum: 0x5B
X= -704 Y= -1536 Z=-16192
**************************************
Thanks,
Arna
2018-03-15 09:46 AM
I would help if you convert the data into g unit, you would see the change is small and is caused by noise.
It depends which mode you are using, according to the mode the output is 8, 10, 12 bit left adjusted in 16 bit output register.
2018-03-22 10:49 PM
Hi Miroslav,
Thank you for the reply.
It makes me more clear to understand.
BTW, how to
convert the raw XYZ data into g unit?
Any reference?
Thanks,
Arna
2018-03-23 02:26 AM
Hello,
Here is a section from the datasheet:
If you select a range, this gives you sensitivity.
The output registers store a signed number in a second complement format.
David