Page 1 of 1

Problem on reading data from LSM9DS0 using SPI

Posted: Mon Apr 17, 2023 12:00 am
by frank20a
Hello all,

I am new to ESP-IDF and I am trying to write a driver for the LSM9DS0 9-DOF IMU sensor from Adafruit. I have read the sensor documentation and Adafruit's driver for Arduino and have implemented pretty much the same thing using the "driver/spi_master" library on IDF but I am receiving incorrect data. Specifically, I can read the sensor IDs from the two chips ok and verify that communication is working on that end. I am not getting any errors when writing on the control registers but the data I receive from the output registers is just wrong. Accelerometer and Magnetometer data are not being updated, Temperature data is always zero and Magnetometer data, even though X and Y axis look somewhat ok, Z axis most significant byte is always 254 instead of 0-2 like X and Y when the sensor is resting on a table.

I have tested the configuration with the Adafruit library using Arduino IDE and it works fine and my connections and pin definitions are correct. So this is definitely a software problem. You can find my code on my GitHub since its too long to include here.

Thanks in advance