Skip to main content
Visitor II
May 20, 2021
Question

SPI with LIS3DH Accelerometer is not working

  • May 20, 2021
  • 4 replies
  • 5293 views

I am using a PIC32MX250F128B . I am trying to communicate with LIS3DH through SPI connection. I have several other devices like ADC, DAC working with SPI protocol perfectly fine. However the Accelerometer does not.

With the scope my CS, Clock and SDA matches the diagram from datasheet (its sending the correct address of WHO_AM_I register ) but SDO output remains silent. Cant see anything coming out of accelerometer.

I am trying to get the who_am_i register value but the output i am getting is zero.

I have attached a scoped picture of my SPI. I have tried rest of the 3 mode other than the mode mentioned in the datasheet.

Any suggestions or solution from the community would be much appreciated. I have gone through several posts with the same problem but with no solution.

I hope I can get one.

N.B: All my connections are perfectly fine and other SPI connections are also working fine (ADC, DAC). I've also purchased several breakout boards (Adafruit, seedstudio) but that does not work either.

Here in this picture

yellow line : CLK

Pink waveform : SDO

Cyan waveform: SDA

CS is working fine.

0693W00000AOzvGQAT.jpg 

    This topic has been closed for replies.

    4 replies

    ST Employee
    May 24, 2021

    Hi @Zahme.1​ ,

    it seems to me that you are reading the wrong address.

    judging by the picture, I see on SDA 0xAF (10101111) that is a read of register 2F, while you should be reading 0x0F for the WHO_AM_I.

    can you check that?

    also, can I ask you which Vdd and Vdd_IO levels are you using?

    Niccolò

    Explorer
    June 3, 2021

    Hi,

    I also have this problem with my LIS3DH. CS is always driven low, MISO is pulled up and I receive 0xFF when I try to read WHO_AM_I register, been stuck on this bug for days now and i need your help.

    The signals measured are SCK and MOSI, MISO is always 1.

    0693W00000BZxipQAD.jpg

    ST Employee
    June 3, 2021

    Hi @Community member​ ,

    here you are reading 0x1F, that is not the WHO_AM_I register.

    Can you try to modify the bytes you are sending?

    also, it would be clearer to show every signal (MOSI MISO CLK CS) in the picture, if need further help.

    Let me know if you manage to solve the issue

    Niccolò

    Explorer
    June 3, 2021

    Hi,

    Thanks for your answer. I modified the bytes to be sent but still, I am not getting the value holded in WHO_AM_I register.

    Here is my configuration :

    CS : always low (tied to GND)

    CLK : Yellow

    MOSI : Pink

    MISO : Blue0693W00000BZyU5QAL.jpg

    Visitor II
    June 15, 2021

    I am posting as regards the main. I really don't understand wats wrong i have verified everything verifiable, the sensor still doesn't respond.

    The hard ware connections are fine. please advise what to do

    ST Employee
    June 15, 2021

    Hi @CDuru.1​ ,

    the communication seems fine, In my opionion it shoul be something regarding connections.

    can you check that every pin is connected in the right way?

    Niccolò

    Visitor II
    June 16, 2021

    I have double and also swapped in all possible permutations. just to give a brief overview I am now using the seed studio breakout board found in the link attached. connection's stated below. its the second breakout i have opted to use and same response all I get is 0xFF.

    Please advise thanks.

    LISbrkout pic32

    CS -> CS

    SCK -> SCK

    SDO -> SDI

    SDI -> SDO

    Visitor II
    June 17, 2021

    I additionally have this hassle with my LIS3DH. CS is constantly pushed low, MISO is pulled up and I obtain 0xFF when I attempt to study page WHO_AM_I register, been caught on this malicious program for days now and I want your help.

    ST Employee
    June 18, 2021

    Hi @Ffdhb.1​ ,

    are you using the same setup as @Community member​ ?

    Niccolò

    Visitor II
    June 18, 2021

    My setup is different but i am using the PIC32 though. maybe its a compatibility issue ?