cancel
Showing results for 
Search instead for 
Did you mean: 

SPI COMMUNICATION NOT WORKING

kyle2
Associate
Posted on November 02, 2016 at 23:14

Hello Everyone,

I am having trouble talking to the LSM6DS3 using 4 wire SPI. I have verified the signals to the device as being correct per the datasheet. I am commanding 0x8F to do a WHO_AM_I command but am not seeing anything coming back on MISO. The only problem I can think of is the SCx and SDx pin is left open. I did not tie them to VCC or ground. Could this be the problem? Due to the package, I can't modify it on board. 
3 REPLIES 3
ChrisH
Associate III
Posted on November 03, 2016 at 01:26

Those lines shouldn't be floating for sure but since lsm is a master here it might have pull-ups on those lines maybe you can measure voltage on those pins. Anyway I don't think it would affect your readings. Maybe double check your SPI configuration so speed shouldnt be higher than 10MHz with 8bit Data size. Also if you are using NSS pin maybe switch to software controlled pin. Since at least for me NSS didn't work as it should after switching to software CS pin it worked and I can read the data from LSM6

Alessandro Soncini
Associate II
Posted on December 13, 2016 at 20:37

I don't know if you mistyped the value, but the WHO_AM_I Command is 0x0F and not 0x8F for LSM6DS3.

Seb
ST Employee
Posted on December 14, 2016 at 13:51

By default, most mems use 3 wire mode (don't know this one in details). When NSS is low, the chip is selected. When NSS is high, it uses I2C (so be careful if using multiple SPI slave devices). To activate the 4 wire mode, you may have (in 3 wire mode) to write a bit inside the chip to activate the 4 wire mode. Then reading the WHO_AM_I may work...

Hope this helps. Good luck!