AnsweredAssumed Answered

LSM303C communication to microcontroller via 3-wire SPI

Question asked by ljushev.petar on Jun 19, 2015
Latest reply on Mar 30, 2018 by Nandakumar Lingaraj

I am interfacing LSM303C magnetometer and accelerometer to microcontroller via 3-wire SPI, where SIMO and SOMI from uC are connected together via R 10k to allow the slave LSM303C to drive this single signal line when responding.

Clock SCK polarity is set to high and the right phase for LSM303C is selected in microcontroller USART configuration registers. I am actively pulling down CS pins on LSM303C to enable SPI communication with the particular part. Measuring with oscilloscope on the shared SDI/O line, SCK and CS it seems that LSM303C is receiving the right input according to datasheet.

However I didn't have success to get a reply from LSM303C on simple "WHO_AM_I_A/M" address readings - LSM303C does not pull the communication line. I have tried enabling the SPI operation, disabling I2C, turning to continuous operation and enabling reading of registers in the control registers of accelerometer and magnetometer. MSB of the register address is changed to "1" to enable reading of the Who_am_I_ID, but doesn't seem to have an effect.

Has anybody here in the forum had success communicating with LSM303C via 3-wire SPI and can share the initialization code (setting up 3-wire SPI operation in control registers, enabling continuous operation, reading a single data register etc)?

Outcomes