cancel
Showing results for 
Search instead for 
Did you mean: 

F407 and lis3dsh

Konstantin Maslennikov
Associate II
Posted on February 23, 2018 at 15:01

I'm try use only registers for lis3dsh.

https://community.st.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2Fmas-kon%2FF407-LIS3DSH

- my code. This code sometimes is worked, but sometimes it stopped. Can any help my?

#cmsis #registers #lis3dsh

Note: this post was migrated and contained many threaded conversations, some content may be missing.
11 REPLIES 11
Andrew Neil
Evangelist III
Posted on February 23, 2018 at 15:17

So what debugging have you done?

Posted on February 23, 2018 at 16:08

Anytime funtion 

uint8_t SPI1SendData(uint8_t data)

{

while (!(SPI1->SR & SPI_SR_TXE)){};

SPI1->DR = data;

while (!(SPI1->SR & SPI_SR_RXNE)){};

data = SPI1->DR;

return data;

}

return 0xFF.

:(

Why, I don,t know...

Posted on February 23, 2018 at 16:12

Looks like CS (chip select) is not enabled or sensor internal register address embedded in data sent to the sensor is wrong

Posted on February 23, 2018 at 16:58

Have you actually looked at the SPI lines on an oscilloscope to see what's happening ?

Posted on February 23, 2018 at 17:01

I'm have not oscilloscope..

:(

Andrew Neil
Evangelist III
Posted on February 23, 2018 at 19:22

Similar question just posted:

https://community.st.com/0D50X00009XkgQkSAJ

Posted on February 23, 2018 at 19:21

You're pretty much stuck when it comes to hardware debugging, then.

Posted on February 23, 2018 at 20:13

http://www.st.com/content/ccc/resource/technical/document/datasheet/23/c3/ea/bf/8f/d9/41/df/DM00040962.pdf/files/DM00040962.pdf/jcr:content/translations/en.DM00040962.pdf

 

Check wiring. CS needs to be set to 0 when want to read / write through SPI.

Posted on February 23, 2018 at 20:20

It's stm32f4-disco..