cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DS12 wrong output data

Attila
Associate II
Posted on November 22, 2017 at 18:47

Hi everyone!

I'm working with the LIS2DS12 accelerometer chip with STM32F4xx via SPI. I could make the sensor alive, configure it (configuration is checked by an SPI read back) to operate in FIFO mode with threshold interrupt on INT1 pin which works properly (checked on scope). My problem is that somehow the read values are not correct. During the configuration I have set the IF_ADD_INC bit in CTRL2  register, so if I make a read request onto the OUT_X_L (0x28), then I could read out the all the bytes from the FIFO (256x6 bytes) in one read sequence in the repeating order of X_LSB;X_MSB;Y_LSB;Y_MSB;Z_LSB;Z_MSB. Then I have made the scaling onto [mg], which showed good results at the Y and Z axis. I could measure the Earth's 1g 'force' correctly. But all of my x axis values are corrupted. They show ~10.000 mg values. Also on oscilloscope I have tracked the communication and I could see they are all wrong. As a side movement I have tested the device in bypass mode and I have only read the x axis values, but it was still corrupted. I have changed the eval board (

http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mems-motion-sensor-eval-boards/steval-mki175v1.html

), but it didn't help. Unfortunatelly I don't have the code with me, but I'm using the official HAL SPI functions. Does anybody had this type of miscellaneous error earlier?

Thank you in advance for any kind of help!

5 REPLIES 5
Miroslav BATEK
ST Employee
Posted on November 22, 2017 at 21:20

I have never seen this issue before, but can you please share your sensor configuration, when you will have the code available. I can check the configuration as firts step.

Attila
Associate II
Posted on November 22, 2017 at 21:31

Thanks in advance! I will share it, but I can work on the problem soonest on the next Monday only.

Attila
Associate II
Posted on November 27, 2017 at 20:50

I have finally found the source of this misterious error. I had to perform a software reset and a boot before I started the configuration and the data read-out.

Posted on November 28, 2017 at 10:21

Software reset and boot and valid functions. After software reset you have to configure you device, because software reset resets all registers to default values.

So from your explanation, I guess the timing is not correct, anyway it is good you solved the issue.
Posted on November 28, 2017 at 13:52

Yes, I do a configuration after sw reset. The steps are the followings: Sw reset->boot (with enough wait)->configuration to operate with continuous FIFO at the desired ODR with INT1 pin threshold interrupt->Read out the content of the FIFO when needed.

I have checked the SPI lines many times. There were no timing issue and in addition every X value was corrupted in the FIFO, not just the first one. I think the (re)boot was the option which solved my problem. Before the boot, my x values were also sensitive to the mechanical rotation in the range of -12.000 to -14.000 mg range. It was an offset error which was compensated with the boot sequence internally.

Really hank you for your help and remarks!