Skip to main content
mbertoni
Associate II
Jun 4, 2020 6:25 PM UTC
Question

Why wrong sensor answer on SPI bus?

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

Eleon BORLINI
ST Employee
Jun 5, 2020 9:44 AM UTC

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
Jul 16, 2021 6:45 AM UTC

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.