cancel
Showing results for 
Search instead for 
Did you mean: 

Lis2de12 always returning 255 value using SPI communication

RGusa
Associate II

I am interfacing lis2de12 sensor with TI-CC2650 via SPI. When am trying to read the WO_AM_I register, it is returning 255 value when 0X33 is the expected value according to the datasheet. I have analyzed the protocol using analyzer and things seem to be fine there.

Below is the image showing data sent to be 143 i.e. 0X8F in order to read the contents from the WHO_AM_ register. Data received from the master is 255.

0690X00000AQtToQAL.png

6 REPLIES 6
Eleon BORLINI
ST Employee

Hi @RGusa​ , a couple of questions related to the HW of your application: did you follow the schematic suggestion of Lis2de12 related steval-mki175v1? Regards

Hi @Eleon BORLINI​ , yes I have followed the schematic suggestion in order to build the breakout board.And it worked perfectly when tested with Arduino example code for Lis2de12 utilising I2c.

​I'm wondering if the TI-CC2650 SPI configuration are well set (e.g. 16 bit or 32 bit). Did you try TI-CC2650 SPI communication with other chips?

> And it worked perfectly when tested with Arduino example code for Lis2de12 utilising I2c.

Irrelevant.

It seems the sensor does not answer at all, the MISO line is just kept high.

Compare your analyzer result with the SPI signal section of the LIS2DE datasheet.

I am able to establish the communication between the controller and the sensor successfully. I am not able to figure out some other thing though. I am using the sensor in FIFO disabled mode and reading the sensor values of each axis into corresponding 16 bit buffers. In order to convert this raw data into acceleration(in mg), I am right shifting each buffer by 8 bits and multiplying with the sensitivity of the mode.( 15.6 in case of mine as FS is set to 00).

For eg.

int16_t xBuffer (Contains the rawa data fetched from sensor OUT_X register)

xBuffer = xBuffer >> 8;

float acceleration = (int8_t)xBuffer * 15.6

Is this the correct way to do ?

Data is correctly left-justified, cast in two's complement and then multiply for the related FS sensitivity. Please consider that 15.6 is in mg unit. Regards