LIS3MDL pololu, bad readings via SPI.

Discussion in 'Embedded Systems and Microcontrollers' started by eejam, Aug 26, 2016.

  1. eejam

    Thread Starter New Member

    Aug 26, 2016
    1
    0
    Hi, is there any one with experience with the LIS3MDL sensor, and SPI !?

    I've implemented, some code to read from the LIS3MDL via SPI, and it works, except that values are always noisy and extremely high.

    I know that, because, reading from the same device via I2C, gives-me stable (low noise) values, with accurate behavior. E.g. if I bring a magnet near the sensor, the sensor modulus of the magnetic vector, behaves accordingly to the distance of the magnet, as for in SPI it doesn't ...

    I've checked, the SPI clock mode, and from the data sheet (http://www.st.com/content/ccc/resou...df/jcr:content/translations/en.DM00075867.pdf) seems to be MODE3. I'm using a low clock speed (100kHz), and tried other combinations with same result.

    Somehow it seems I have a misbehavior in the sensor via SPI ...

    Any one with experience in this sensor, and SPI to give-me some hint?

    See, charts of SPI and I2C readings attached...

    Thanks,
    BR,
    mc
     
    • I2C.png
      I2C.png
      File size:
      10.5 KB
      Views:
      3
    • SPI.png
      SPI.png
      File size:
      51.3 KB
      Views:
      3
Loading...