2018-03-01 02:24 AM
Hi,
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
Ash
#lsm303agrSolved! Go to Solution.
2018-03-01 02:50 AM
Yes, you cannot connect the CS_XL and CS_MAG together if you want to use SPI interface.
The accelerometer and magnetometer are treated as separate SPI slave devices.
2018-03-01 02:50 AM
Yes, you cannot connect the CS_XL and CS_MAG together if you want to use SPI interface.
The accelerometer and magnetometer are treated as separate SPI slave devices.
2018-03-01 03:25 AM
Okay. Thankyou Miroslav for the quick reply.
I just wanted to be sure there was no way around this, as our hardware team want to minimize the PCB changes to move to the new sensor at late stage of development.
2021-04-22 03:13 AM
LIS2DTW12 I²C/SPI mode selection
I want to read LIS2DTW12 data using SPI which is also shared with another device, can I use the LIS2DTW12 CS pin as chip select and operate devices one by one.
because according to the LIS2DTW12 datasheet:
State of CS
1: SPI idle mode / I²C communication enabled;
0: SPI communication mode / I²C disabled
i.e if cs = 1 --> I2C Enabled, read/write operation on another device will disturb the LIS2DTW12 device.