I'm having an issue with bringing up an ST IMU (LSM6DSM on an MKI189V1 eval board). I am using SPI to connect my host micro to the IMU and trying to read back the device ID.

The issue I'm facing is that the response from the IMU is sometimes correct and sometimes incorrect. I'm speaking to ST directly and exploring the firmware side of things, but I am seeing very similar behaviour on two separate micro controllers from two different vendors, so I'm trying to see if anyone has some suggestion as to a potential hardware issue. Here are some more detailed symptoms:

  1. Microcontroller, IMU, Logic Analyzer, Oscilloscope are all on the bus.
  2. IMU is powered from host micro VDD
  3. Removing scope or logic analyzer from the bus does not fix issue
  4. However if I am consistently reading the incorrect value, and remove the logic analyzer then while removing it the correct value will be read fairly consistently
  5. If I disconnect the MISO from the host micro (logic analyzer, oscilloscope still connected) the output is consistent and correct
  6. When the incorrect value is read it often looks close to the correct value in that I see pulses where the MISO should be toggling, but they are very short
  7. I've tried both supported SPI modes (and both unsupported), and tried clocking as low as 10kHz to no avail
  8. If I use I2C everything works fine.

All this is leading me to believe there is some sort of hardware drive strength or contention issue.

Item 4 seems to indicate the micro is holding the line somehow, however I'd be surprised if the same issue existed on two entirely different platforms.

Item 3 is very consistently able to get the correct value, however it does not stay consistent once the analyzer is removed.

Any suggestions would be appreciated.

  • \$\begingroup\$ My initial guess is that you've tried the wrong 2 SPI modes (of the 4 possibilities), and that you're clocking data on the wrong edge while reading in to your micro. \$\endgroup\$ – brhans May 2 at 17:49
  • \$\begingroup\$ The datasheet specifies mode 0 or 3 which are the ones I've been testing with but I have in fact tried 1 and 2 as well just to rule this out. Also there are times I'm able to read the correct data which I would think shouldn't be possible if I'm using the wrong mode. Also, the logic analyzer confirms the data is completely wrong not just being clocked incorrectly. \$\endgroup\$ – Otus May 2 at 17:51
  • 1
    \$\begingroup\$ Show a schematic of your system. \$\endgroup\$ – Voltage Spike May 2 at 20:13
  • \$\begingroup\$ I don't have a schematic, but it's an ST Nucleo eval board connected to the MKI189V1 eval board using a breadboard. 6 connections total: VDD, GND, CLK, MISO, MOSI, SS \$\endgroup\$ – Otus May 3 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.