MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
CONFIDENTIAL & PROPRIETARY
1 of 14
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
Revision
Date
Revision Description
5/30/2013 1.0
Initial release
Revision History
CONTENTS
1. PURPOSE .................................................................................................................................................. 3
2. SELF-TEST CONCEPT ............................................................................................................................. 3
3. GYROSCOPE/ACCELEROMETER SELF-TEST DETAILED PROCEDURE .......................................... 5
4. COMPASS DETAILED SELF-TEST PROCEDURE ................................................................................. 7
5. SELF-TEST REGISTER DEFINITIONS .................................................................................................... 8
CONFIDENTIAL & PROPRIETARY
2 of 14
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
1. Purpose
This document explains the gyroscope, accelerometer and compass Self-Test implementation for the MPU-
9250.
2. Self-Test Concept
Gyroscope and accelerometer Self-Test enables customers to perform a functional test of the mechanical
and electrical integrity of InvenSense sensors without requiring physical device movement.
When the Self-Test is activated, on-board electronics actuate the MEMS device. This actuation moves the
sensor masses equivalent to a pre-defined motion. This proof mass displacement results in a change of
sensor output and is reflected in the output signal.
A customer runs Self-Test software in their factory and compares the output value against the value stored
on chip during InvenSense’s component production test. If the customer’s gyroscope Self-Test response is
>50% of the the value stored on chip during InvenSense product test, and the customer’s accelerometer
Self-Test response is between 50% and 150% of the value stored on chip during InvenSense product test,
then Self-Test has passed and the component is deemed functional.
Passing Self-Test limits were derived by comparing the Self-Test results of 90k MPU-6500 parts against the
values stored during production component testing. The MPU-6500 die is used within the MPU-9250 as the
gyroscope and accelerometer. The results are shown in the table below.
Gyroscope Delta
Axis Average Δ (%)
Standard Deviation (%) 5σ (%)
X
Y
Z
0.37
0.37
0.11
0.39
0.65
0.31
2.3
3.6
1.7
Accelerometer Delta
Axis Average Δ (%)
Standard Deviation (%) 5σ (%)
X
Y
Z
0.027
0.015
0.02
0.48
0.57
0.46
2.4
2.9
2.3
For the gyroscope the highest delta is 3.6%. Additionally, the MPU-9250 product spec has gyro ZRO of
±20dps min/max, which at an FSR of 250dps results in an additional 8% deviation. After these two
contributors, 38.4% of margin is available to account for noise, unintended movements, and other unwanted
offsets created on the customer’s production line. With 250dps FSR (the FSR used during self-test), the
50% limit results in 96dps of margin that is available after accounting for the standard deviation and ZRO.
Similarly for the accelerometer, the highest delta for the X/Y axis is 2.9%. The MPU-9250 product
specification has a board-level X/Y accelerometer offset of ±120mg, which at an FSR of 2g (the FSR used
during self-test) results in an additional 6% deviation. After these two contributors, 41.1% to 141.1% is
available to account for noise, unintended movements and other unwanted offsets created on the customer’s
production line. With 2g FSR, the 50% to 150% limit results in 0.82g of margin available after accounting for
the standard deviation and accelerometer offset.
InvenSense does not expect that noise and other unintended movements on the customer’s production line
will exceed these margins, making the Self-Test procedure robust.
In greater detail, the gyroscope Self-Test response (STR) is defined as follows:
CONFIDENTIAL & PROPRIETARY
3 of 14
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
This Self-Test-response is used to determine whether the part has passed or failed Self-Test by finding the
change from factory trim of the Self-Test response as follows:
This change from factory trim of the Self-Test response must be within the limits provided in section 3 of this
document for the part to pass Self-Test. Otherwise, the part is deemed to have failed Self-Test.
Similarly, when the accelerometer’s Self-Test is activated, the on-board electronics will actuate the
appropriate sensor. This actuation simulates an external force. The actuated sensor, in turn, will produce a
corresponding output signal.
The Self-Test response (STR) is defined as follows:
This Self-Test-response is used to determine whether the part has passed or failed Self-Test by finding the
change from factory trim of the Self-Test response as follows:
This change from factory trim of the Self-Test response must be within the limits shown in section 3 of this
document for the part to pass Self-Test. Otherwise, the part is deemed to have failed accelerometer Self-
Test.
Code for operating Self-Test is included within the MotionApps™ software provided by InvenSense. The
software routine starts by measuring the digital output of the 3 gyroscopes and records them as GX_OS,
GY_OS, and GZ_OS.
In order to enable the Self-Test mode for all gyroscopes, first the SW measures the digital output of each
gyroscope and records them as GX_ST_OS, GY_ST_OS, and GZ_ST_OS. The Self-Test values are then
reported as:
o GXST = GX_ST_OS - GX_OS
o GYST = GY_ST_OS - GY_OS
o GZST = GZ_ST_OS - GZ_OS
Similarly for the accelerometer, the reported Self-Test values are:
o AXST = AX_ST_OS - AX_OS
o AYST = AY_ST_OS - AY_OS
o AZST = AZ_ST_OS - AZ_OS
In compass Self-Test mode, a magnetic field is generated by an internal magnetic source. The compass
then measures the field and compares it to a Self-Test measurement that was done at the factory. If the
CONFIDENTIAL & PROPRIETARY
4 of 14
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
comparison is within the values shown in section 4.1, then the Self-Test is deemed to have passed. If Self-
Test does not pass, the device is deemed to be defective.
3. Gyroscope/Accelerometer Self-Test Detailed Procedure
The rotation of the component being tested should vary less than 5 degrees during the Self-Test
measurement. The device will fail gyroscope Self-Test if it rotates by more than ±2.5 deg during the test. A
good part would however pass gyro Self-Test if it experiences a constant rotation during the two
measurements.
Similarly, in order to maintain accuracy during the accelerometer Self-Test, changes in linear velocity should
be less than 0.2m/s and changes in tilt angle should be less than 6 degree during the measurement.
The specific steps implemented in InvenSense’s Self-Test software are:
1) The routine starts by measuring the digital output of all three gyroscopes. In order to do
this, the following registers are modified:
Gyroscope: Change the digital low pass filter (DLPF) code to 2 (Register Address: 26 (1Ah)
Bit [2:0] – USR). The following table details the configuration of the component when the
DLPF is configured to 2.
DLPF Config
LPF BW
Sampling Rate
Filter Delay
2
92Hz
1kHz
3.9ms
Accelerometer: Change the DLPF Code to 2 (Register Address: 29 (1Dh) Bit [2:0] – USR).
The following table details the configuration of the component when the DLPF is configured
to 2.
DLPF Config
LPF BW
Sampling Rate
Filter Delay
2
92Hz
1kHz
7.8ms
Gyroscope: Store the existing full scale range select code (Register Address: 27 (1Bh) Bit
[4:3] – USR) as Old_FS, then select a full scale range of 250dps by setting the
ACCEL_FS_SEL bits to 00.
Accelerometer: Store the existing full scale range select code (Register Address: 28 (1Ch)
Bit [4:3] – USR) as Old_FS, then select a full scale range of ±2g by setting the
ACCEL_FS_SEL bits to 00.
2) Read the gyroscope and accelerometer output at a 1kHz rate and average 200 readings.
The averaged values will be the LSB of GX_OS, GY_OS, GZ_OS, AX_OS, AY_OS and
AZ_OS in the software.
3) Set USR_Reg: (1Bh) Gyro_Config, gdrive_axisCTST [0-2] to b111 to enable Self-Test.
Set USR_Reg: (1Ch) Accel_Config, AX/Y/Z_ST_EN [0-2] to b111 to enable Self-Test.
4) Wait 20ms for oscillations to stabilize
5) Read the gyroscope and accelerometer output at a 1kHz rate and average 200 readings.
The averaged values will be the LSB of GX_ST_OS, GY_ST_OS, GZ_ST_OS,
AX_ST_OS, AY_ST_OS and AZ_ST_OS in the software.
6) Calculate the Self-Test response as follows:
CONFIDENTIAL & PROPRIETARY
5 of 14
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
GXST = GX_ST_OS - GX_OS
GYST = GY_ST_OS - GY_OS
GZST = GZ_ST_OS - GZ_OS
AXST = AX_ST_OS - AX_OS
AYST = AY_ST_OS - AY_OS
AZST = AZ_ST_OS - AZ_OS
3.1. External Configuration Cleanup
To cleanup the configuration after the test:
1) Set USR_Reg: (1Bh) Gyro_Config, gdrive_axisCTST [0-2] to b000.
Set USR_Reg: (1Ch) Accel_Config, AX/Y/Z_ST_EN [0-2] to b000.
2) Wait 20ms.
3) Restore previous FS code (Old_FS).
3.2. Self-Test Pass/Fail Criteria
1) Retrieve factory Self-Test code (ST_Code) from USR_Reg in the software:
X-gyro: selftest1 (00): xg_st_data [0-7]
Y-gyro: selftest1 (01): yg_st_data [0-7]
Z-gyro: selftest1 (02): zg_st_data [0-7]
X-Accel: selftest1 (0D): xa_st_data [0-7]
Y-Accel: selftest1 (0E): ya_st_data [0-7]
Z-Accel: selftest1 (0F): za_st_data [0-7]
2) Calculate factory Self-Test value (ST_OTP) based on the following equation:
The ST_Code is based on the Self-Test value (ST_ FAC) determined in InvenSense’s
factory final test and calculated based on the following equation
The factory Self-Test value (ST_OTP) is calculated based on ST_Code and is calculated
based on the following equation, where “FS” is the full scale value:
ST_OTP is then the value that is stored in OTP of the device.
3) Determine passing or failing Self-Test
a.
If factory Self-Test values ST_OTP≠0, compare the current Self-Test response
(GXST, GYST, GZST, AXST, AYST and AZST) to the factory Self-Test values
(ST_OTP) and report Self-Test is passing if all the following criteria are fulfilled:
Axis
Pass criteria
X-gyro
(GXST / GXST_OTP) > 0.5
Y-gyro
(GYST / GYST_OTP) > 0.5
CONFIDENTIAL & PROPRIETARY
6 of 14
1))01.1log())2/2620/(_log((_FSFACSTroundcodeST (lsb) 01.1*)2/2620(_)1_(codeSTFSOTPST
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
Z-gyro
(GZST / GZST_OTP) > 0.5
X-Accel
Y-Accel
0.5 < (AXST / AXST_OTP) < 1.5
0.5 < (AYST / AYST_OTP) < 1.5
Z-Accel
0.5 < (AZST / AZST_OTP) < 1.5
b.
If factory Self-Test values ST_OTP=0, compare the current Self-Test response
(GXST, GYST, GZST, AXST, AYST and AZST) to the ST absolute limits (ST_AL)
and report Self-Test is passing if all the following criteria are fulfilled.
Axis
X-gyro
Y-gyro
Z-gyro
Pass criteria
|GXST| ≥ 60dps
|GYST| ≥ 60dps
|GZST| ≥ 60dps
X-Accel
225mgee ≤ |AXST| ≤ 675mgee
Y-Accel
225mgee ≤ |AXST| ≤ 675mgee
Z-Accel
225mgee ≤ |AXST| ≤ 675mgee
If the Self-Test passes criteria (a) and (b), it’s necessary to check gyro offset values.
c.
Report passing Self-Test if the following criteria fulfilled.
Axis
Pass criteria
X-gyro
|GXOFFSET| ≤ 20dps
Y-gyro
|GYOFFSET| ≤ 20dps
Z-gyro
|GZOFFSET| ≤ 20dps
4. Compass Detailed Self-Test Procedure
The specific steps required to implement compass Self-Test are:
1. Set the compass into power-down mode.
2. Write “1” to the SELF bit of the ASTC register. Other bits in this register should be set to zero.
3. Set the self test mode in the “Mode” register.
4. Check if data is ready or not by polling the DRDY bit of the ST1 register. When the data is ready,
proceed to step 5.
5. Read the measurement data in the compass measurement data registers.
6. Write “0” to SELF bit of the ASTC register.
7. Set the compass to power-down mode.
CONFIDENTIAL & PROPRIETARY
7 of 14
MPU-9250 Accelerometer, Gyroscope and
Compass Self-Test Implementation
Document Number: AN-MPU-9250A-03
Revision: 1.0
Release Date: 5/30/2013
4.1. Set Pass/Fail Criteria
When measurement data read by the above sequence is in the range of following tables after sensitivity adjustment
(refer to the ASAX, ASAY, ASAZ: Sensitivity Adjustment values register) the Self-Test is deemed to have
passed.
14-bit Mode
HX[15:0]
HY[15:0]
HZ[15:0]
Criteria
-50 ≤ HX ≤ 50
-50 ≤ HY ≤ 50
-800 ≤ HZ ≤ -200
16-bit Mode
HX[15:0]
HY[15:0]
HZ[15:0]
Criteria
-200 ≤ HX ≤ 200
-200 ≤ HY ≤ 200
-3200 ≤ HZ ≤ -800
5. Self-Test Register Definitions
Below are the definitions for all registers related to Self-Test.
5.1. Registers 0 to 2 – Gyroscope Self-Test Registers
Serial IF: R/W
Reset value: 0x00
Register BIT
NAME
FUNCTION
[7:0]
xg_st_data
The value in this register is loaded via OTP to indicate the Self-Test output
generated during manufacturing tests. This value is to be used to check against
subsequent Self-Test outputs performed by the end user.
[7:0]
yg_st_data
The value in this register is loaded via OTP to indicate the Self-Test output
generated during manufacturing tests. This value is to be used to check against
subsequent Self-Test outputs performed by the end user.
[7:0]
zg_st_data
The value in this register is loaded via OTP to indicate the Self-Test output
generated during manufacturing tests. This value is to be used to check against
subsequent Self-Test outputs performed by the end user.
0
1
2
5.2. Registers 13 to 15 – Accelerometer Self-Test Registers
Serial IF: R/W
Reset value: 0x00
Register BIT
NAME
FUNCTION
13
14
[7:0]
XA_ST_DATA[7:0]
[7:0]
YA_ST_DATA[7:0]
Contains Self-Test data for the X
Accelerometer
Contains Self-Test data for the Y
Accelerometer
CONFIDENTIAL & PROPRIETARY
8 of 14