2023-10-10 06:15 PM
I've been trying to read data from the OUT_X register of the LIS3MDL using a NUCLEO-L412KB, but I'm not getting any meaningful data output. When I move the device around, the output data doesn't change. I've connected CS to 3.3V and SDO to ground. What am I doing wrong?
Solved! Go to Solution.
2023-10-11 06:29 PM
OK, you confirm that I2C communication is functional.
You need to pay attention to CTRL_REG3 (22h). If I understand correctly, conversion is off by default (Power-down mode), so the value is invalid as you said.
2023-10-10 11:33 PM
My experience with such digital sensor is:
1) check and ensure communication (I2C or SPI or others) is OK, by checking WHO_AM_I or ID register. LIS3MDL WHO_AM_I register (address = 0x0F) value is 0x3D (00111101).
2023-10-11 10:15 AM
I can confirm that my I2C communication is functioning correctly because I successfully read the expected value from the WHO_AM_I register. However, when I attempt to read from the output registers, I encounter an issue – I do not receive any meaningful output. Strangely, the data I retrieve from these output registers remains static and unchanging until I physically unplug the device. After reconnecting and rerunning the code, the output values change to entirely other number. I looked through the documentation and I am pretty sure there is no initialization I need todo to read the output register. Also, I am using a steval-mki137 that has a lis3mdl on it and it says it needs a 100nF capacitor. Could this be the problem?
2023-10-11 06:29 PM
OK, you confirm that I2C communication is functional.
You need to pay attention to CTRL_REG3 (22h). If I understand correctly, conversion is off by default (Power-down mode), so the value is invalid as you said.
2024-01-16 11:43 PM
You need to pay attention to CTRL_REG3 (22h). MD0 and MD1. For continous messurement you need "00"