English
Language : 

LSM303AH Datasheet, PDF (25/82 Pages) –
LSM303AH
Functionality
4.1.4
4.1.5
Magnetometer hard-iron compensation
Hard-iron distortion occurs when a magnetic object is placed near the magnetometer and
appears as a permanent bias in the sensor’s outputs.
The hard-iron correction consists of compensating magnetic data from hard-iron distortion.
The operation is defined as follows:
Hout = Hread – HHI
where:
 Hread is the generic uncompensated magnetic field data, as read by the sensor;
 HHI is the hard-iron distortion field;
 Hout is the compensated magnetic data.
The computation of the hard-iron distortion field should be performed by an external
processor. After the computation of the hard iron-distortion field has been performed, the
measured magnetic data can be compensated.
The LSM303AH offers the possibility of storing hard-iron data inside six dedicated registers
from 45h to 4Ah.
Each register contains eight bits so that the hard-iron data can be expressed as a 16-bit
two’s complement number. The OFFSET_axis_REG_H registers contain the MSBs of the
hard-iron data, while the OFFSET_axis_REG_L registers contain the LSBs.
Hard-iron data have the same format and weight of the magnetic output data. The hard-iron
values stored in dedicated registers are automatically subtracted from the output data.
Magnetometer self-test
The self-test function is available for the magnetic sensor. When the magnetic self-test is
enabled, a current is forced into a coil inside the device. This current will generate a
magnetic field that will produce a variation of the magnetometer output signals. If the output
signals change within the amplitude limits specified in Table 3 then the sensor is working
properly and the parameters of the interface chip are within the defined specifications.
The self-test procedure is described in the following figure.
DocID027766 Rev 6
25/82
82