AnsweredAssumed Answered

LIS2DH12 SPI Communication: Device answers alternately with "FF"

Question asked by Pascal Wielsch on Feb 28, 2018
Latest reply on Mar 7, 2018 by Pascal Wielsch

Hello,

 

I'm currently testing the LIS2DH12 accelerometer, which is mounted on the MKI151V1. The board is connected to a SPI/I2C device from National Instruments because I want to integrate the sensor in a LabVIEW measurement software. First of all, I would like to mention, that I'm a beginner in working with SPI, so it is possible that I make a simple mistake.

 

In LabVIEW, I first open a SPI configuration (Set Chip Select, Clock Rate, Clock Polarity, Clock Phase) followed by the Read/Write Command. At the end of the communication, I close the SPI configuration again. The corresponding R/W LabVIEW-VI needs an hex-array as input and returns the answer of the SPI-Slave, if necessary, in an hex-array output.

Every command of the LIS2DH12 consists of 8bit. Thus every array index represents one byte (hex format).

In case of a reading, the first array index represents the read command (RW bit; MS bit; register address). The following array indices have to be an optional hex-number for the number of register data I want to receive.

In case of a writing, the first index represents the write command and the following indices represent the data I want to write in the register/s.

As an example, when I want to read register "WHO_AM_I" (0Fh): I send the input array "8Fh;00h" (index 0; index 1) and receive the output array "8Fh;33h", which is the right answer for this register. So far, everything works fine.

 

Finally I will come to the actual problem. If I repeat this read command the accelerometer answers with "FFh". This problem occurs with every R/W-command from any register, no matter what time is in between multiple R/W-commands. When I connect the sensor for the first time, it also responds with "FFh".

 

Do you have any ideas what the reason for this behavior is?

Does anyone have some experience in working with the SPI/I2C device from National Instruments?

 

I would like to thank you in advance.

 

Best Regards,

Pascal

Outcomes