cancel
Showing results for 
Search instead for 
Did you mean: 

SPI with LIS3DH Accelerometer is not working

Zahme.1
Associate

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 

23 REPLIES 23

Hi,

Yes, SDA and SCK goes over 2.64v, SPI configuration is as follow :

CLK polarity : High

CLK phase : 2 Edges

Prescaler 128 (937.5 Kbits/s)

Hi @Community member​ ,

thank you for checking all info.

I'm starting to think this is a connection issue.

can you confirm that the sensor is well soldered and positioned?

did you follow the application hints of the datasheet regarding the schematic?

Niccolò

Hi,

I used a HW-664 that contains a LIS3DH in SPI mode and i still have same results, now i am sure that the problem is software but i have no idea where it is.

Hi @Community member​ ,

I'm sorry but how can you be sure that the problem is software if the software runs well on your other components?

Niccolò

Hi,

The LIS3DH is the only slave on the SPI bus, I cannot be sure that SPI software can run it.

As for the CS line, I'm gonna add it in the next design because it's the only thing unsure in the hardware design.

Thanks a lot for your support,

CDuru.1
Associate II

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

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ò

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

Ffdhb.1
Associate

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.

Hi @CDuru.1​ 

I'm sorry, but is your problem the same as @Community member​ 's?

his response was 0x00.

if your response is 0xFF, can I see a picture from the oscilloscope?

Niccolò