AnsweredAssumed Answered

LSM303AGR SPI operation

Question asked by ash thorpe on Mar 1, 2018
Latest reply on Mar 1, 2018 by ash thorpe


I am struggling with moving from the obsolete LSM303D sensor to the LSM303AGR sensor.

I had the LSM303D sensor working correctly in continuous mode with the STM32F1 processor using 4 wire SPI mode.

But I cannot get the 3 wire SPI interface to work correctly with either sensor.


Concentrating on the LSM303AGR sensor - Currently I have CS_XL and CS_MAG inputs commoned up and driven from a single output of the STM32F1 master device. I assume this is incorrect and the 2 slave select inputs are mutually exclusive in SPI mode?

I was hoping that the slave select (CS) was irrelevant as SPI 3 wire interface is more like I2C, but I assume the accelerometer and magnetometer are treated as separate SPI slave devices in the LSM303AGR?


I just realized that although all register addresses between the accelerometer and magnetometer are unique, the address for multiple reads are not unique;

 multiple read for XL start address = 0xE8 (0x28 | Read bit | multiple register read bit)

 multiple read for MAG start address = 0xE8 (0x68 | Read bit)


Hopefully someone can confirm this assumption while I modify the hardware. Plus I wanted to start a thread incase other issues arise.


Thanks in advance for your help