cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSO issues with SPI

KShar.4
Associate II

Hi ST community,

Currently we are trying to use the LSM6DSO (6 Axis MEMS sensor) in our project.

We were able to successfully test the LSM9DS1 (9 Axis MEMS sensor) using the ST Adapter board STEVAL-MKI159V1 and we had no issues communicating with it and were also getting very good results.

For this adapter board, we connected:

-Vdd = 3.3v

-VddIO = 3.3v

-SDO = SPI MISO

-SDA = SPI MOSI

-SCL = SPI clock

-CS = SPI chip select (Negated)

And ofcourse the Ground pin as well

And whenever we send the command 0x8F to read the WHO_AM_I register (Register address 0x0F) via SPI we get the correct response back which was 0x68 from the accelerometer/gyroscope module and 0x3D from the magnetometer. And these are the correct values that are described the LSM9DS1 datasheet.

Now we trying to communicate with the LSM6DSO (using ST Adapter board STEVAL-MKI196V1), by doing the same exact connections like the LSM9DS1.

-Vdd = 3.3v

-VddIO = 3.3v

-SDO = SPI MISO

-SDA = SPI MOSI

-SCL = SPI clock

-CS = SPI chip select (Negated)

And the Ground pin as well

But whenever we send the SPI command 0x8F to read the WHO_AM_I register (register address: 0x0F) we always receive back 0x50 - we attached a digital analyzer screenshot. According to the LSM6DSO datasheet the expected result should be 0x6C (and not 0x50)

  

Now we tested the WHO_AM_I command on the following boards:

1- STEVAL-MKI197V1 (based on the LSM6DSO sensor)

2-STEVAL-MKI215V1 (based on the LSM6DSO32 sensor)

3-STEVA:-MKI196V1 (based on the LSM6DSO sensor)

And all of these 3 boards are returning 0x50 when we send the WHO_AM_I command. Knowing that the expected result should be 0x6C.

One thing to mention is: We did a similar test using the LSM6DS3 (using the STEVAL-MKI160V1 adapter board) and we were getting the correct value 0x69 for the WHO_AM_I command.

We also noticed, that on the forum, there was another colleague who also had a similar issue with this sensor.

Link to the thread: https://community.st.com/s/question/0D50X0000AFqjrRSQR/lsm6dso-spi-communication-problem

For him, it seems that he had a different voltages for Vdd and VddIO. But in our case we are having 3.3v for both Vdd and VddIO. And our microcontroller DIO voltages are at 3.3v.

We wanted to know, if we are missing something to communicate via SPI with the LSM6DSO and the LSM6DSO32? If not, then what is the issue in this case.

Thank you!

14 REPLIES 14
paul19
Associate III

I have a similar issue: my LSM6DSOX (from a STEVAL-MKI197V1) always returns 0x00 as WHOI_AM_I instead of 0x6C.

If I ignore this issue, though, it seems to work correctly, i.e. I seem to get reliable acceleration, gyro and temperature data (polling mode).

Connected pins:

-Vdd = 3.3v

-VddIO = 3.3v

-SDO = SPI MISO

-SDA = SPI MOSI

-SCL = SPI clock

-CS = SPI chip select (Negated)

-SCx = 3.3v

-SDx = 3.3v

-GND = ground

Your issue is a little better than mine, since for me the SPI bus did not work at all. The best I could tell from working on this before is that the SPI bus was glitching out for me because the transmission line was "bad" for some reason. you could try improving the connection (solder vs breadboard), adding termination resistors, or series resistors.

But based on your description it almost sounds like it might be some kind of software problem since it is strange to have one bad read at the very beginning on a SPI bus which is clocked by the master.. what happens if you try to read the same register twice? Maybe the bus is not initialized properly or something

Yes, you're absolutely right, it's a software problem. The SPI bus is not initialized properly. If I call __HAL_SPI_ENABLE() at the very beginning, it works perfectly. I'm currently investigating how this is possible, since my SPI init is supposed to be generated by STM32CubeMX...

UPDATE: my issue was due to a bad SPI setup, I forgot to set a pull-up on SPI SCK.

jovijuan
Associate II

I know the thread is pretty old but I'm having a similar issue.

I'm trying to communicate with an LSMDSO on STEVAL-MKI196V1 and they always return 0x50 or 0x51 to the read of the WHO_AM_I register.

Connection is similar to many others:

-Vdd = 3.3v

-VddIO = 3.3v (tried also with 3.05V as the voltage in the microcontroller board is ~3.05V)

-SDO = SPI MISO

-SDA = SPI MOSI

-SCL = SPI clock

-CS = SPI chip select (Negated, 270kOhm pull-up)

-SCx = GND

-SDx = GND

-GND = GND

-OCS = floating

-OSDO = floating

The scope shows clean edges.

If I ignore the WHO_AM_I, I can configure the registers. I can configure resolution, frequency, interrupts, etc. To be honest, I have another issue as INT1 is triggered with accelerometer data, but when I try to check STATUS_REG, the flag XLDA is always 0, but that might be an issue with the configuration.

This is a capture of the logic analyzer in the WHO_AM_I register reading:

0693W00000YAA1UQAX.png 

What I found weird is that this behavior is consistent when the supply is stable, but then I realized that if I turned off the LDO, VCC didn't really go to 0V due to leakage from logic analyzer and microcontroller, it stayed at ~2.4V and at that voltage, WHO_I_AM returns 0x6C!!!

The behavior is exactly the same on both STEVAL-MKI196V1 I have.

Is there any explanation for the error in the WHO_AM_I register???

TBern.2
Associate II

IIRC my own problems went away when I switched to a PCB from a breadboard. You may want to look at the signal with a fast, calibrated scope to see how far it differs from an ideal square; if its gnarly your logic analyzer might see different bits than the ST part does anyways

Check out the thread here, and then the other thread it links to in the main question for some scope traces and further discussion

https://electronics.stackexchange.com/questions/33372/spi-bus-termination-considerations