cancel
Showing results for 
Search instead for 
Did you mean: 

nRF52 LIS2DE12 SPI READ Failed

EL KHABLI AHMED
Associate II
Posted on December 19, 2017 at 17:50

Hello,

I am using nRF SDK 12.2.0 , with nRF52832 on pca10040 hardware, and working with the example in examples/peripheral/spi/main.c to develop a driver for LIS2DE12. When I write a hexadecimal value I find a problem. I checked with the scope that CS, MOSI and SCK are correct, but I get 0xFF on MISO line .

Any ideas what to check?

#lis2de12 #miso #spi #nrf52
4 REPLIES 4
Miroslav BATEK
ST Employee
Posted on December 20, 2017 at 10:43

You didn't attach the screenshot from logic analyzer, but from you personal message I see that the communication is OK, I see that the LIS2DE12 responds correctly (0x33) to the who_am_i read request (0x8F). Firts 8 clock cycles the SPI master sends the request and next 8 clock cycles slave sends the respond. Please check the SPI communication diagrams in the datasheet.

Posted on December 21, 2017 at 10:58

Thank you !

the problem is that I can read the default values of the registers, but when I try to write and read the register at the same time but I encounter a problem (a byte of ORC bits which is added during the write)

this a example CTRL_REG1

Write funcion

0690X00000609HUQAY.png

read function

0690X00000609HZQAY.png
Posted on December 21, 2017 at 14:40

The problems are caused by your SPI master (the microcontroller). I'm sorry I can't help you because I don't know

nRF52832

device.
Posted on December 28, 2017 at 15:05

Thank you ,

I solved the problem