2023-10-12 02:47 PM
LIS3MDL issues.
Issue #1 - There are two 8-bit registers for temperature, and the datasheet says it's two complement, but I don't see any further description of the contents. Is it fixed point 8.8 or is there some division or offset that needs to be done to get it into degrees Celsius?
Issue #2 - I'm using I2C. When I read all the magnetic registers and the temperature registers (registers 0x28-0x2F) one byte at a time I get a set of magnetic and temperature readings. If I split it into an a 6-byte I2C operation to get the magnetic numbers (registers 0x28-0x2D) and a 2-byte I2C operation to get the temperature (registers 0x2E-0x2F), I get the same numbers, good so far. However, if I read those 8 registers in one I2C operation the temperature bytes come out the same as the X-axis magnetic bytes. If there some type of roll-over that I can't read the magnetic data and the temperature at the same time?
2023-10-13 12:13 AM
Hi @hwsw ,
As described at page 20 of AN4602, LIS3MDL temperature data are generated with a frequency equal to the
ODR and are stored inside the TEMP_OUT_L/TEMP_OUT_H registers: these values are 16-bit, 2’s complement.
The sensitivity is 8 LSB/°C and 0 output means T=25 °C.
I confirm that you should read both offset and temperature registers at the same time. Can you share your code?