Skip to main content
Visitor II
June 4, 2020
Question

Why wrong sensor answer on SPI bus?

  • June 4, 2020
  • 2 replies
  • 829 views

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)

    This topic has been closed for replies.

    2 replies

    ST Employee
    June 5, 2020

    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

    Visitor II
    July 16, 2021

    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.