cancel
Showing results for 
Search instead for 
Did you mean: 

SPI communication with accelerometer H3LIS331

ot
Associate
Posted on August 16, 2016 at 12:39

Hi!

I'm trying to read Who Am I register and get 0x32 reply from the accel.

Not sure what SPI mode to use, 3?

I see on the scope: byte 0xF1 come out of master on MOSI, eight clock cycles on SCK and SS line go low, but nothing on MISO line.

Shouldn't slave register bits come out by the mere fact that there is SCK (full-duplex) and SS is low?

I'm not sure what is wrong, comments?

Thanks.

#4-wired-spi
1 REPLY 1
Miroslav BATEK
ST Employee
Posted on August 17, 2016 at 16:07

Yes, SPI mode 3 is correct.

Please refer datasheet page 19-21 for SPI interface.

You should see 0x8F on MOSI at first it means reading of WHO_AM_I register (0x0F) and then response from the sensor 0x32 on the MISO line.

Please see attached screenshot from logic analyzer.

Best regards

Miroslav

________________

Attachments :

H3LIS331_SPI4_WHO_AM_I.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzI4&d=%2Fa%2F0X0000000bK3%2FL_SiqDK_wdEjdyo1OuHhi7VrTT.KhpYD8kz7gbxiWYY&asPdf=false