cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Communicate on SPI with LIS3DH Accelerometer

stlite
Associate
Posted on September 23, 2013 at 13:20

I am using a PIC32MX795F512H which has a number of peripherals (EEPROM, ADC, DDS, and POT) to which I communicate with via SPI. All these work.

However the Accelerometer does not.

As one reason could be the PIC setup, I've tried bit-bashing. With the scope my CS, Clock and data output match the diagrams. The LIS3DH will not reply.

I've moved the chip lines to use the eeprom lines and still no joy.

I've bought an evaluation board and that does not work.

There is probably a fundamental problem in my understanding of how the LIS3DH works, either the commands, (0x8f should read WHO_I_AM?) or some aspect of how it handles SPI.

I would be grateful if anyone could post either:

a) working bit-bashing code (preferably in C or pseudo-code) that I can use to debug/prove my code.

b) PIC32MX795F512H SPI set-up and code

Thank you

John

#lis3dh-spi
6 REPLIES 6
Thiago REIS
Associate II
Posted on September 24, 2013 at 19:00

Hello,

In order to solve your issue,I suggest that you check the attached file with the STM32 low level driver, this canactually aid yourquestionas a reference.

Would you be able to provide waveforms sowe can better understand your situation?

Thank you,

Thiago

________________

Attachments :

LIS3DH.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzKc&d=%2Fa%2F0X0000000bK0%2F.sGvMiXomB_h5COxWpvDM_ZuUPxGxpjRry2wtZACHmU&asPdf=false
Mikhail Polyakov
Associate II
Posted on September 30, 2013 at 23:18

I have the problem with LIS3DH in SPI mode too.

Whichever register I try to read, the answer of LIS3DH is 0xFF. 

The line SDO  is everytime in high state.

Here is a picture with try to read register WHO_AM_I  on adress 0x0F

What am i do wrong ?

0690X00000603QBQAY.jpg

Mikhail Polyakov
Associate II
Posted on October 03, 2013 at 08:28

The problem was in bed soldering of IC.  The same way on two board, that led me astray.

Thiago REIS
Associate II
Posted on October 09, 2013 at 14:59

Hello Mikhail,

that is great news, please do let me know if there is anything that I can do to support you.

Thank you very much,

Thiago

rangineni34
Associate II
Posted on December 24, 2013 at 05:49

hi mikhail, i am also getting the same problem while reading data through SPI, every time i am getting 0xff only, what may be the cause, and what is the problem of bed shouldering as you mentioned? could you elaborate it? and how to overcome it?

balaji2
Associate
Posted on May 07, 2014 at 08:26

Hi,

I too face same problem, any update on this issue?