cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3MDL selftest and calibration

marziano
Associate
Posted on June 16, 2016 at 13:24

Hi,

the self test procedure described in AN4602 starts automatically by setting bit 0 to '1' in CTRL_REG1 register, but it is not well explained how to check if the self test passes or fails.

If the self test passes, the device performs the calibration by itself?

#lis3mdl #selftest #lis3mdl #self-test #lis3mdl-temperature-calibration #calibration
2 REPLIES 2
Martin B
ST Employee
Posted on June 30, 2016 at 17:50

Hello,

How to check if self test passed. According to AN4602 page 19 (see: Figure 6):
  • ... (Follow the Figure 6 from the beginning down-to the bottom of left column.)
  • Set

    Self-test enable

    bit and wait 60 ms.
  • Check

    ZYXDA

    bit in

    STATUS_REG

    and then read all axes - do it once and discard it.
  • Check

    ZYXDA

    bit in

    STATUS_REG

    and then read all axes - do it 5 times and calculate average value for each axis.
  • Check if calculated average values (converted to absolute value) for each axis is within limits (see: Table 17), i.e.:
    • ST_min(X-axis) <= abs( OUT_X_AVERAGE ) <= ST_max(X-axis)

    • ST_min(Y-axis) <= abs( OUT_Y_AVERAGE ) <= ST_max(Y-axis)

    • ST_min(Z-axis) <= abs( OUT_Z_AVERAGE ) <= ST_max(Z-axis)

  • If averaged values (converted to absolute value) for all axes fit into limits, then self test passed.
  • ... (Finish the Figure 6 flow)
After self test passes, no calibration is performed.
marziano
Associate
Posted on July 03, 2016 at 18:55

Hi Martin,

thanks for your reply. I've successfully performed the self test feature by following the procedure described in the AN4602 as you wrote in your post.

I'm testing the device but I noticed a remarkable drift of the magnetic values respect to temperature. According to the AN4602 and the device datasheet, the magnetometer should have a built-in digital compensation block to avoid the magnetic drift in temperature...isn't it?

It seems do not work properly...

I think to calibrate the device with an external algorithm, perhaps by using the self test feature to obtain known values of the magnetic data...any ideas to help me?