cancel
Showing results for 
Search instead for 
Did you mean: 

Why wrong sensor answer on SPI bus?

mbertoni
Associate II

Hi to all.

I correctly set SPI bus as reported on LIS3DSH datasheet:

  • Figure 3. SPI slave timing diagram (page 14)
  • Figure 7. Read and write protocol (page 25)

Here waveforms:

0693W000001q4wMQAQ.jpg

As first operation I detect sensor reading WHO_AM_I register and getting 0 as output value.

I set wrong SPI bus settings (CLOCK idle value low) and it works.

Why?

0693W000001q4wbQAA.jpg

Yellow = CS

Green = SDI (data to sensor)

Blue = SCK

Red = SDO (data from sensor)

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @mbertoni​ , may it be related to the SPI mode timing you have selected at master level for the decoding of the SPI pattern? Regards

0693W000001q7L9QAI.jpg

bmak
Senior

You need to set data word size to 16 bit, so you would have constant 16 clock cycles on SCLK line, now you have 8.