STMicroelectronics LSM303AGR Ultra-low-power 3d accelerometer and 3d magnetometer Datasheet

LSM303AGR
Ultra-compact high-performance eCompass module:
ultra-low-power 3D accelerometer and 3D magnetometer
Datasheet - preliminary data
 Intelligent power saving for handheld devices
 Display orientation
 Gaming and virtual reality input devices
 Impact recognition and logging
 Vibration monitoring and compensation
Description
/*$ [[PP
Features
 3 magnetic field channels and 3 acceleration
channels
 ±50 gauss magnetic dynamic range
 ±2/±4/±8/16 g selectable acceleration full
scales
 16-bit data output
 SPI / I2C serial interfaces
 Analog supply voltage 1.71 V to 3.6 V
 Power-down mode / low-power mode
 Programmable interrupt generators for freefall, motion detection and magnetic field
detection
 Embedded self test
 Embedded temperature sensor
 Embedded FIFO
 ECOPACK®, RoHS and “Green” compliant
The LSM303AGR is an ultra-low-power highperformance system-in-package featuring a 3D
digital linear acceleration sensor and a 3D digital
magnetic sensor.
The LSM303AGR has linear acceleration full
scales of ±2g/±4g/±8g/16g and a magnetic field
dynamic range of ±50 gauss.
The LSM303AGR includes an I2C serial bus
interface that supports standard, fast mode, fast
mode plus, and high-speed (100 kHz, 400 kHz,
1 MHz, and 3.4 MHz) and an SPI serial standard
interface.
The system can be configured to generate an
interrupt signal for free-fall, motion detection and
magnetic field detection.
The magnetic and accelerometer blocks can be
enabled or put into power-down mode separately.
The LSM303AGR is available in a plastic land
grid array package (LGA) and is guaranteed to
operate over an extended temperature range
from -40 °C to +85 °C.
Applications
 Tilt-compensated compasses
 Map rotation
 Position detection
 Motion-activated functions
 Free-fall detection
Table 1. Device summary
Part number
Temp.
Package Packaging
range [°C]
LSM303AGR
-40 to +85
LGA-12
Tray
LSM303AGRTR
-40 to +85
LGA-12
Tape and
reel
 Click/double-click recognition
 Pedometers
November 2015
DocID027765 Rev 5
This is preliminary information on a new product now in development or undergoing evaluation. Details are subject to
change without notice.
1/68
www.st.com
Contents
LSM303AGR
Contents
1
2
Block diagram and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.1
Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2
Pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Module specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1
Sensor characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2
Temperature sensor characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3
Electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4
Communication interface characteristics . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5
3
2.4.2
I2C - inter-IC control interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.1
Linear acceleration sensor sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1.2
Magnetic sensor sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2
Zero-g level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3
Zero-gauss level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4
Magnetic dynamic range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1
4.2
2/68
SPI - serial peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1
4
2.4.1
Magnetometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1.1
Magnetometer power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1.2
Magnetometer offset cancellation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.1.3
Magnetometer interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.1.4
Magnetometer hard-iron compensation . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.1.5
Magnetometer self-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.1
Accelerometer power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.2
Accelerometer 6D / 4D orientation detection . . . . . . . . . . . . . . . . . . . . . 27
4.2.3
Accelerometer activity/inactivity function . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.4
Accelerometer self-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
DocID027765 Rev 5
LSM303AGR
5
6
Contents
4.3
IC interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4
FIFO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.1
Bypass mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.2
FIFO mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.4.3
Stream mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4.4
Stream-to-FIFO mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4.5
Retrieving data from FIFO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.4.6
FIFO multiple read (burst) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.5
Temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.6
Factory calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Application hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.1
Soldering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.2
High-current wiring effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Digital interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.1
I2C serial interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.1.1
6.2
I2C operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
SPI bus interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.2.1
Accelerometer SPI write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.2.2
Accelerometer SPI read in 3-wire mode . . . . . . . . . . . . . . . . . . . . . . . . 40
6.2.3
Magnetometer SPI write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.2.4
Magnetometer SPI read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7
Register mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
8
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.1
STATUS_REG_AUX_A (07h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.2
OUT_TEMP_L_A (0Ch), OUT_TEMP_H_A (0Dh) . . . . . . . . . . . . . . . . . . 45
8.3
INT_COUNTER_REG_A (0Eh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.4
WHO_AM_I_A (0Fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.5
TEMP_CFG_REG_A (1Fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
8.6
CTRL_REG1_A (20h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
8.7
CTRL_REG2_A (21h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
8.8
CTRL_REG3_A (22h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
8.9
CTRL_REG4_A (23h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
DocID027765 Rev 5
3/68
68
Contents
4/68
LSM303AGR
8.10
CTRL_REG5_A (24h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
8.11
CTRL_REG6_A (25h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
8.12
REFERENCE/DATACAPTURE_A (26h) . . . . . . . . . . . . . . . . . . . . . . . . . 49
8.13
STATUS_REG_A (27h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.14
OUT_X_L_A (28h), OUT_X_H_A (29h) . . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.15
OUT_Y_L_A (2Ah), OUT_Y_H_A (2Bh) . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.16
OUT_Z_L_A (2Ch), OUT_Z_H_A (2Dh) . . . . . . . . . . . . . . . . . . . . . . . . . 50
8.17
FIFO_CTRL_REG_A (2Eh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
8.18
FIFO_SRC_REG_A (2Fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
8.19
INT1_CFG_A (30h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
8.20
INT1_SRC_A (31h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
8.21
INT1_THS_A (32h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
8.22
INT1_DURATION_A (33h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
8.23
INT2_CFG_A (34h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
8.24
INT2_SRC_A (35h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
8.25
INT2_THS_A (36h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
8.26
INT2_DURATION_A (37h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
8.27
CLICK_CFG_A (38h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
8.28
CLICK_SRC_A (39h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
8.29
CLICK_THS_A (3Ah) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
8.30
TIME_LIMIT_A (3Bh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
8.31
TIME_LATENCY_A (3Ch) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
8.32
TIME_WINDOW_A (3Dh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
8.33
Act_THS_A (3Eh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
8.34
Act_DUR_A (3Fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
8.35
OFFSET_X_REG_L_M (45h) and OFFSET_X_REG_H_M (46h) . . . . . . 60
8.36
OFFSET_Y_REG_L_M (47h) and OFFSET_Y_REG_H_M (48h) . . . . . . 60
8.37
OFFSET_Z_REG_L_M (49h) and OFFSET_Z_REG_H_M (4Ah) . . . . . . 60
8.38
WHO_AM_I_M (4Fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.39
CFG_REG_A_M (60h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.40
CFG_REG_B_M (61h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
8.41
CFG_REG_C_M (62h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
8.42
INT_CTRL_REG_M (63h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
DocID027765 Rev 5
LSM303AGR
9
8.43
INT_SOURCE_REG_M (64h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.44
INT_THS_L_REG_M (65h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.45
INT_THS_H_REG_M (66h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
8.46
STATUS_REG_M (67h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
8.47
OUTX_L_REG_M, OUTX_H_REG_M (68h - 69h) . . . . . . . . . . . . . . . . . . 64
8.48
OUTY_L_REG_M, OUTY_H_REG_M (6Ah - 6Bh) . . . . . . . . . . . . . . . . . 65
8.49
OUTZ_L_REG_M, OUTZ_H_REG_M (6Ch - 6Dh) . . . . . . . . . . . . . . . . . 65
Package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
9.1
10
Contents
LGA-12 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
DocID027765 Rev 5
5/68
68
List of tables
LSM303AGR
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Table 6.
Table 7.
Table 8.
Table 9.
Table 10.
Table 11.
Table 12.
Table 13.
Table 14.
Table 15.
Table 16.
Table 17.
Table 18.
Table 19.
Table 20.
Table 21.
Table 22.
Table 23.
Table 24.
Table 25.
Table 26.
Table 27.
Table 28.
Table 29.
Table 30.
Table 31.
Table 32.
Table 33.
Table 34.
Table 35.
Table 36.
Table 37.
Table 38.
Table 39.
Table 40.
Table 41.
Table 42.
Table 43.
Table 44.
Table 45.
Table 46.
Table 47.
Table 48.
6/68
Device summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Sensor characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Temperature sensor characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
SPI slave timing values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
I2C slave timing values (standard and fast mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
I2C slave timing values (fast mode plus and high speed) . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Digital low-pass filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Current consumption of operating modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Operating mode and turn-on time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Operating mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Turn-on time for operating mode transition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Current consumption of operating modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Activity/Inactivity function control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Serial interface pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
I2C terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Transfer when master is writing one byte to slave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Transfer when master is writing multiple bytes to slave . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Transfer when master is receiving (reading) one byte of data from slave . . . . . . . . . . . . . 37
Transfer when master is receiving (reading) multiple bytes of data from slave . . . . . . . . . 37
SAD + Read/Write patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
SAD + Read/Write patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Register address map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
STATUS_REG_AUX register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
STATUS_REG_AUX description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
INT_COUNTER_REG register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
WHO_AM_I register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
TEMP_CFG_REG register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
TEMP_CFG_REG description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
CTRL_REG1 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
CTRL_REG1 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Data rate configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
CTRL_REG2 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
CTRL_REG2 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
High-pass filter mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
CTRL_REG3 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
CTRL_REG3 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
CTRL_REG4 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
CTRL_REG4 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Self-test mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
CTRL_REG5_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
CTRL_REG5_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
CTRL_REG6_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
CTRL_REG6_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
REFERENCE/DATACAPTURE_A register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
REFERENCE/DATACAPTURE_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
DocID027765 Rev 5
LSM303AGR
Table 49.
Table 50.
Table 51.
Table 52.
Table 53.
Table 54.
Table 55.
Table 56.
Table 57.
Table 58.
Table 59.
Table 60.
Table 61.
Table 62.
Table 63.
Table 64.
Table 65.
Table 66.
Table 67.
Table 68.
Table 69.
Table 70.
Table 71.
Table 72.
Table 73.
Table 74.
Table 75.
Table 76.
Table 77.
Table 78.
Table 79.
Table 80.
Table 81.
Table 82.
Table 83.
Table 84.
Table 85.
Table 86.
Table 87.
Table 88.
Table 89.
Table 90.
Table 91.
Table 92.
Table 93.
Table 94.
Table 95.
Table 96.
Table 97.
Table 98.
Table 99.
Table 100.
List of tables
STATUS_REG_A register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
STATUS_REG_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
FIFO_CTRL_REG_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
FIFO_CTRL_REG_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
FIFO mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
FIFO_SRC_REG_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
FIFO_SRC_REG_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
INT1_CFG_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
INT1_CFG_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
INT1_SRC_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
INT1_SRC_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
INT1_THS_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
INT1_THS_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
INT1_DURATION_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
INT1_DURATION_A description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
INT2_CFG_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
INT2_CFG_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
INT2_SRC_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
INT2_SRC_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
INT2_THS_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
INT2_THS_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
INT2_DURATION_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
INT2_DURATION_A description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
CLICK_CFG_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
CLICK_CFG_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
CLICK_SRC_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
CLICK_SRC_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
CLICK_THS_A register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
CLICK_SRC_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
TIME_LIMIT_A register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
TIME_LIMIT_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
TIME_LATENCY_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
TIME_LATENCY_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
TIME_WINDOW_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
TIME_WINDOW_A description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Act_THS_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Act_THS_A description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Act_DUR_A register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Act_DUR_A description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
CFG_REG_A_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
CFG_REG_A_M register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Output data rate configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
System mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CFG_REG_B_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CFG_REG_B_M register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Digital low-pass filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CFG_REG_C_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
CFG_REG_C_M register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
INT_CRTL_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
INT_CTRL_REG_M register description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
DocID027765 Rev 5
7/68
68
List of tables
Table 101.
Table 102.
Table 103.
Table 104.
Table 105.
Table 106.
Table 107.
Table 108.
Table 109.
Table 110.
Table 111.
Table 112.
Table 113.
Table 114.
Table 115.
8/68
LSM303AGR
INT_SOURCE_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
INT_SOURCE_REG_M register description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
INT_THS_L_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
INT_THS_L_REG_M register description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
INT_THS_H_REG_M register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
INT_THS_H_REG_M register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
STATUS_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
STATUS_REG_M register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
OUTX_L_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
OUTX_H_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
OUTY_L_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
OUTY_H_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
OUTZ_L_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
OUTZ_H_REG_M register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Document revision history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
DocID027765 Rev 5
LSM303AGR
List of figures
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Figure 13.
Figure 14.
Figure 15.
Figure 16.
Figure 17.
Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Pin connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
SPI slave timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
I2C slave timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Interrupt function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Magnetometer self-test procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Accelerometer self-test procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Stream mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
FIFO multiple read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
LSM303AGR electrical connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Accelerometer SPI write protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Accelerometer multiple byte SPI write protocol (2-byte example) . . . . . . . . . . . . . . . . . . . 39
Accelerometer SPI read protocol in 3-wire mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Magnetometer SPI write protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Magnetometer multiple byte SPI write protocol (2-byte example) . . . . . . . . . . . . . . . . . . . 41
Magnetometer SPI read protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
LGA-12 2x2x1 mm package outline and mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . 66
DocID027765 Rev 5
9/68
68
Block diagram and pin description
LSM303AGR
1
Block diagram and pin description
1.1
Block diagram
Figure 1. Block diagram
;
,17BB;/
<
&+$5*(
$03/,),(5
=
D
,17BB;/
&21752/
/2*,&
$'
&219(57(5
08;
=
<
;
&6B;/
,&
&6B0$*
6&/63&
63,
6'$6',6'2
;
<
&+$5*(
$03/,),(5
=
, 0
$'
&219(57(5
08;
&21752/
/2*,&
=
,17B0$*'5'<
<
;
7(036(1625
10/68
6(/)7(67
5()(5(1&(
DocID027765 Rev 5
75,00,1*
&,5&8,76
&/2&.
),)2
LSM303AGR
Pin description
Figure 2. Pin connections
=
,17BB;/
9GGB,2
<
,17BB;/
6&/63&
;
7239,(:
&6B;/
9GG
&6B0$*
,17B0$*'5'<
=
&
*1'
',5(&7,212)
'(7(&7$%/(
$&&(/(5$7,216
*1'
1.2
Block diagram and pin description
6'$6',6'2
%277209,(:
<
;
7239,(:
',5(&7,212)
'(7(&7$%/(
0$*1(7,&),(/'6
DocID027765 Rev 5
11/68
68
Block diagram and pin description
LSM303AGR
Table 2. Pin description
Pin#
Name
1
SCL
SPC
I2C serial clock (SCL)
SPI serial port clock (SPC)
CS_XL
Accelerometer: SPI enable
I2C/SPI mode selection
1: SPI idle mode / I2C communication enabled;
0: SPI communication mode / I2C disabled
3
CS_MAG
Magnetometer: SPI enable
I2C/SPI mode selection
1: SPI idle mode / I2C communication enabled;
0: SPI communication mode / I2C disabled
4
SDA
SDI
SDO
5
C1
6
GND
7
INT_MAG/DRDY
8
GND
0V
9
Vdd
Power supply
10
Vdd_IO
Power supply for I/O pins
11
INT_2_XL
Accelerometer interrupt 2
12
INT_1_XL
Accelerometer interrupt 1
2
12/68
Function
I2C serial data (SDA)
SPI serial data input (SDI)
3-wire interface serial data output (SDO)
Capacitor connection (C1 = 220 nF)
Connected to GND
Magnetometer interrupt/data-ready signal
DocID027765 Rev 5
LSM303AGR
Module specifications
2
Module specifications
2.1
Sensor characteristics
@ Vdd = 2.5 V, T = 25 °C unless otherwise noted(a).
Table 3. Sensor characteristics
Symbol
Parameter
Test conditions
Min.
Typ.(1)
Max.
Unit
±2
LA_FS
Linear acceleration
measurement range(2)
M_FS
Magnetic dynamic range
±4
g
±8
±16
LA_So
Linear acceleration sensitivity
±49.152
FS = ±2 g and in normal mode
3.9
FS = ±2 g and in high-resolution
mode
0.98
FS = ±2 g and in low-power mode
15.63
FS = ±4 g and in normal mode
7.82
FS = ±4 g and in high-resolution
mode
1.95
FS = ±4 g and in low-power mode
31.26
FS = ±8 g and in normal mode
15.63
FS = ±8 g and in high-resolution
mode
mg/LSB
3.9
FS = ±8 g and in low-power mode
62.52
FS = ±16 g and in normal mode
46.9
FS = ±16 g and in high-resolution
mode
11.72
FS = ±16 g and in low-power mode
gauss
187.58
M_GN
Magnetic sensitivity
1.5
mgauss/
LSB
LA_TCSo
Linear acceleration sensitivity
change vs. temperature(3)
0.01
%/°C
LA_TyOff
Typical zero-g level offset
accuracy(4),(5)
±40
mg
M_TyOff
Magnetic sensor offset
LA_TCOff
Zero-g level change vs.
temp.(3)
Max. delta from 25 °C
LA_An
Linear acceleration RMS
noise
ODR = 100 Hz, high-resolution
mode, FS = ±2 g
With offset cancellation
0
Without offset cancellation
±1
gauss
±0.5
mg/°C
3
mg
(RMS)
a. The product is factory calibrated at 2.5 V. The operational power supply range is from 1.71 V to 3.6 V.
DocID027765 Rev 5
13/68
68
Module specifications
LSM303AGR
Table 3. Sensor characteristics (continued)
Symbol
Parameter
Test conditions
M_R
Magnetic RMS noise(6)
High-performance mode
LA_ST
Linear acceleration self-test
positive difference(7) (8) (9)
FS = ±2 g; normal mode
M_ST
Top
Min.
Typ.(1)
Max.
Unit
mgauss
(RMS)
3
17
360
LSB
Magnetic self-test(10)
15
500
mgauss
Operating temperature range
-40
+85
°C
1. Typical specifications are not guaranteed.
2. Verified by wafer level test and measurement of initial offset and sensitivity.
3. Measurements are performed in a uniform temperature setup and they are based on characterization data in a limited
number of samples, not measured during final test for production.
4. Typical zero-g level offset value after MSL3 preconditioning.
5. Offset can be eliminated by enabling the built-in high-pass filter.
6. With low-pass filter or offset cancellation enabled.
7. The sign of “Self-test output change” is defined by the ST bit in CTRL_REG4_A (23h), for all axes.
8. “Self-test output change” is defined as the absolute value of:
OUTPUT[LSb](Self-test enabled) - OUTPUT[LSb](Self-test disabled). 1LSb=4mg at 10bit representation, ±2 g full scale.
9. After enabling the ST bit, correct data is obtained after two samples (low-power mode / normal mode) or after eight samples
(high-resolution mode).
10. Magnetic “self-test” is defined as: OUTPUT[gauss](Self-test enabled) - OUTPUT[gauss](Self-test disabled).
14/68
DocID027765 Rev 5
LSM303AGR
2.2
Module specifications
Temperature sensor characteristics
@ Vdd = 2.5 V, T = 25 °C unless otherwise noted (b).
Table 4. Temperature sensor characteristics
Symbol
Parameter
TSDr
Temperature sensor output change vs. temp.
TODR
Temperature refresh rate
Top
Test conditions
Min.
Operating temperature range
Typ.(1)
Max.
Unit
1
digit/°C(2)
ODR(3)
Hz
-40
+85
°C
1. Typical specifications are not guaranteed.
2. 8-bit resolution.
3. Refer to Table 34.
2.3
Electrical characteristics
@ Vdd = 2.5 V, T = 25 °C unless otherwise noted.(b)
Table 5. Electrical characteristics
Symbol
Vdd
Parameter
Test conditions
Supply voltage
Vdd_IO
Module power supply for I/O
Min.
Typ.(1)
Max.
Unit
3.6
V
Vdd+0.1
V
1.71
(2)
1.71
Accelerometer current consumption
LA_Idd_NM Magnetic sensor in power-down
mode.
1.8
50 Hz ODR in
normal mode
11
1 Hz ODR in
normal mode
2
50 Hz ODR in
low-power mode
6
μA
M_Idd_HR
Magnetic current consumption in
high-resolution mode
Accelerometer in power-down mode.
ODR = 20 Hz
200
μA
M_Idd_LP
Magnetic current consumption in
low-power mode
Accelerometer in power-down mode.
ODR = 20 Hz
50
μA
Idd_PD
Current consumption in power-down
1.5
μA
VIH
Digital high-level input voltage
VIL
Digital low-level input voltage
0.8*Vdd_IO
VOH
High-level output voltage
IOH = 4 mA
VOL
Low-level output voltage
IOL = 4 mA
TOP
V
0.2*Vdd_IO
Operating temperature range
Vdd_IO - 0.2
-40
V
V
0.2
V
+85
°C
1. Typical specifications are not guaranteed.
2. It is possible to remove Vdd maintaining Vdd_IO without blocking the communication bus, in this condition the
measurement chain is powered off.
b. The product is factory calibrated at 2.5 V.The operational power supply range is from 1.71 V to 3.6 V.
DocID027765 Rev 5
15/68
68
Module specifications
LSM303AGR
2.4
Communication interface characteristics
2.4.1
SPI - serial peripheral interface
Subject to general operating conditions for Vdd and Top.
Table 6. SPI slave timing values
Value (1)
Symbol
Parameter
Unit
Min
tc(SPC)
SPI clock cycle
fc(SPC)
SPI clock frequency
Max
100
ns
10
tsu(CS_XL, CS_MAG)
CS setup time
5
th(CS_XL, CS_MAG)
CS hold time
20
tsu(SI)
SDI input setup time
5
th(SI)
SDI input hold time
15
tv(SO)
SDO valid output time
th(SO)
SDO output hold time
tdis(SO)
SDO output disable time
MHz
ns
50
5
50
Figure 3. SPI slave timing diagram
&6
WVX &6B;/&6B0$*
WK &6B;/&6B0$*
WF 63&
63&
WVX 6, 6',
WK 6,
/6%,1
06%,1
WY 62
6'2
Note:
WGLV 62
WK 62
06%287
/6%287
Values are guaranteed at 10 MHz clock frequency for SPI with 3 wires, based on
characterization results, not tested in production.
Measurement points are done at 0.2·Vdd_IO and 0.8·Vdd_IO, for both input and output
ports.
16/68
DocID027765 Rev 5
LSM303AGR
2.4.2
Module specifications
I2C - inter-IC control interface
Subject to general operating conditions for Vdd and Top.
Table 7. I2C slave timing values (standard and fast mode)
Symbol
f(SCL)
I2C standard mode (1)
Parameter
I2C fast mode (1)
Min
Max
Min
Max
0
100
0
400
SCL clock frequency
tw(SCLL) Low period of the SCL clock
4.7
1.3
tw(SCLH) High period of the SCL clock
4.0
0.6
tsu(SDA)
Data setup time
250
100
th(SDA)
Data hold time
0
th(ST)
START condition hold time
4
0.6
tsu(SR)
Setup time for a repeated START condition
4.7
0.6
tsu(SP)
Setup time for STOP condition
4
0.6
4.7
1.3
tw(SP:SR) Bus free time between STOP and START condition
3.45
0
Unit
kHz
μs
ns
0.9
μs
1. Data based on standard I2C protocol requirement, not tested in production.
Table 8. I2C slave timing values (fast mode plus and high speed)
Symbol
f(SCL)
I2C fast mode
plus(1)
Parameter
I2C high speed(1)
Unit
Min
Max
Min
Max
0
1
0
3.4
SCL clock frequency
tw(SCLL)
Low period of the SCL clock
0.5
0.16
tw(SCLH)
High period of the SCL clock
0.26
0.06
tsu(SDA)
Data setup time
50
10
th(SDA)
Data hold time
0
0
th(ST)
START condition hold time
0.26
0.16
tsu(SR)
Setup time for a repeated START condition
0.26
0.16
tsu(SP)
Setup time for STOP condition
0.26
0.16
tw(SP:SR) Bus free time between STOP and START condition
1. Data based on standard
I2C
MHz
μs
ns
0.07
μs
0.5
protocol requirement, not tested in production.
DocID027765 Rev 5
17/68
68
Module specifications
LSM303AGR
Figure 4. I2C slave timing diagram
5(3($7('
67$57
67$57
WVX 65
67$57
WZ 6365
6'$
WVX 6'$
WK 6'$
WVX 63
6723
6&/
WK 67
Note:
18/68
WZ 6&//
WZ 6&/+
Measurement points are done at 0.2·Vdd_IO and 0.8·Vdd_IO, for both ports.
DocID027765 Rev 5
LSM303AGR
2.5
Module specifications
Absolute maximum ratings
Stresses above those listed as “absolute maximum ratings” may cause permanent damage
to the device. This is a stress rating only and functional operation of the device under these
conditions is not implied. Exposure to maximum rating conditions for extended periods may
affect device reliability.
Table 9. Absolute maximum ratings
Symbol
Vdd
Vdd_IO
Note:
Ratings
Maximum value
Unit
Supply voltage
-0.3 to 4.8
V
I/O pins supply voltage
-0.3 to 4.8
V
-0.3 to Vdd_IO +0.3
V
3000 for 0.5 ms
g
10000 for 0.1 ms
g
3000 for 0.5 ms
g
10000 for 0.1 ms
g
10000
gauss
Vin
Input voltage on any control pin
(CS_XL, CS_MAG, SCL/SPC, SDA/SDI/SDO)
APOW
Acceleration (any axis, powered, Vdd = 2.5 V)
AUNP
Acceleration (any axis, unpowered)
MEF
Maximum exposed field
TOP
Operating temperature range
-40 to +85
°C
TSTG
Storage temperature range
-40 to +125
°C
ESD
Electrostatic discharge protection (HBM)
2
kV
Supply voltage on any pin should never exceed 4.8 V
This device is sensitive to mechanical shock, improper handling can cause
permanent damage to the part.
This device is sensitive to electrostatic discharge (ESD), improper handling can
cause permanent damage to the part.
DocID027765 Rev 5
19/68
68
Terminology
LSM303AGR
3
Terminology
3.1
Sensitivity
3.1.1
Linear acceleration sensor sensitivity
Sensitivity describes the gain of the sensor and can be determined by applying 1 g
acceleration to it. As the sensor can measure DC accelerations this can be done easily by
pointing the axis of interest towards the center of the Earth, noting the output value, rotating
the sensor by 180 degrees (pointing to the sky) and noting the output value again. By doing
so, ±1 g acceleration is applied to the sensor. Subtracting the larger output value from the
smaller one, and dividing the result by 2, leads to the actual sensitivity of the sensor. This
value changes very little over temperature and time. The sensitivity tolerance describes the
range of sensitivities of a large population of sensors.
3.1.2
Magnetic sensor sensitivity
Sensitivity describes the ratio of the output digital data expressed in LSB units and the
applied magnetic field expressed in mG (milligauss). It can be measured, for example, by
applying a known magnetic field along one axis and measuring the digital output of the
device.
3.2
Zero-g level
The zero-g level offset (LA_TyOff) describes the deviation of an actual output signal from
the ideal output signal if no acceleration is present. A sensor in a steady state on a
horizontal surface will measure 0 g on the X-axis and 0 g on the Y-axis whereas the Z-axis
will measure 1 g. The output is ideally in the middle of the dynamic range of the sensor
(content of OUT registers 00h, data expressed as two’s complement number). A deviation
from the ideal value in this case is called zero-g offset. Offset is to some extent a result of
stress to MEMS sensor and therefore the offset can slightly change after mounting the
sensor onto a printed circuit board or exposing it to extensive mechanical stress. Offset
changes little with temperature, see Table 3 “Zero-g level change vs. temperature”
(LA_TCOff). The zero-g level tolerance (TyOff) describes the standard deviation of the
range of zero-g levels of a population of sensors.
3.3
Zero-gauss level
Zero-gauss level offset (M_TyOff) describes the deviation of an actual output signal from the
ideal output if no magnetic field is present.
3.4
Magnetic dynamic range
The magnetic dynamic range is defined as the magnetic field driven along one sensitive
axis, giving the maximum digital output value.
20/68
DocID027765 Rev 5
LSM303AGR
Functionality
4
Functionality
4.1
Magnetometer
4.1.1
Magnetometer power modes
The LSM303AGR magnetometer provides two different power modes: high-resolution and
low-power modes.
The tables below summarize the selection of the low-pass filter and current consumption of
the operating modes.
When the low-pass filter is enabled, the bandwidth is reduced while noise performance is
improved without any increase in power consumption.
Table 10. Digital low-pass filter
(CFG_REG_A_M [LP = 0])
high-resolution mode
(CFG_REG_A_M [LP = 1])
low-power mode
BW [Hz]
Noise RMS [mg]
BW [Hz]
Noise RMS [mg]
0 (disable)
ODR/2
4
ODR/2
8.5
1 (enable)
ODR/4
3
ODR/4
6
CFG_REG_B_M
[LPF]
Table 11. Current consumption of operating modes
ODR
(Hz)
Current consumption (μA)
Current consumption (μA)
(CFG_REG_A_M [LP] = 0) - high-resolution
(CFG_REG_A_M [LP] = 1) - low-power
10
100
25
20
200
50
50
500
125
100
1000
250
The following table summarizes the turn-on time of the magnetometer in the two different
power modes with the offset cancellation function enabled or disabled (see Section 4.1.2:
Magnetometer offset cancellation).
Table 12. Operating mode and turn-on time
Operating mode
Turn-on time
CFG_REG_A_M[LP]
CFG_REG_A_M[OFF_CANC = 0]
CFG_REG_A_M[OFF_CANC = 1]
0 (high-resolution)
9.4 ms
9.4 ms + 1/ODR
1 (low-power)
6.4 ms
6.4 ms + 1/ODR
DocID027765 Rev 5
21/68
68
Functionality
4.1.2
LSM303AGR
Magnetometer offset cancellation
The offset cancellation is the result of performing a set and reset in the magnetic sensor.
The offset cancellation technique is defined as follows:
Hn – Hn – 1
H out = -------------------------2
where Hn and Hn-1 are two consecutive magnetic field measurements, one after a set pulse,
the other after a reset pulse.
Considering a magnetic offset (Hoff), the two magnetic field measurements are:

Set: Hn = H + Hoff

Reset: Hn-1 = –H + Hoff
The offset is cancelled according the offset cancellation technique:
Hn – Hn – 1
2H + H off + – H off
H out = -------------------------- = -------------------------------------------- = H
2
2
In the LSM303AGR the offset cancellation is enabled by setting the bit OFF_CANC = 1 in
CFG_REG_B_M (61h).
If the offset cancellation is disabled, a set of the magnetic sensor is performed anyway.
The set pulse frequency can be configured by setting the Set_FREQ bit in CFG_REG_B_M
(61h).
4.1.3
Magnetometer interrupt
In the LSM303AGR the magnetometer interrupt signal generation is based on the
comparison between data and a programmable threshold.
To enable the interrupt function, in INT_CTRL_REG_M register (63h) the "IEN" bit must be
set to '1'.
In the LSM303AGR the user can select the axis/axes in which the interrupt function can be
enabled. In order to do this, the XIEN, YIEN, and ZIEN bits in INT_CTRL_REG_M (63h)
need be set properly.
The threshold value can be programmed by setting the INT_THS_L_REG_M (65h) and
INT_THS_H_REG_M (66h) registers.
The threshold is expressed in absolute value as a 15-bit unsigned number. The threshold
has the same sensitivity as the magnetic data.
When magnetic data exceeds the positive or the negative threshold, the interrupt signal is
generated and the information about the type of interrupt is stored in the
INT_SOURCE_REG_M (64h) register. In particular, when magnetic data exceeds the
positive threshold the P_TH_S_axis bit is set to '1', while if data exceeds the negative
threshold the N_TH_S_axis bit is set to '1'. If magnetic data lay between the positive and the
negative thresholds, no interrupt signal is released.
22/68
DocID027765 Rev 5
LSM303AGR
Functionality
Figure 5. Interrupt function
Two different approaches for the interrupt function are available:

Typical: comparison is between magnetic data read by the sensor and the
programmable threshold;

Advanced: comparison is made between magnetic data after hard-iron correction and
the programmable threshold.
These approaches are configurable by setting the INT_on_DataOFF bit in CFG_REG_B_M
(61h).
If INT_on_DataOFF is set to '0' the typical approach is selected, otherwise if it is set to '1'
the advanced approach is selected.
Two different interrupts are available:

Pulsed interrupt signal: it goes high when the magnetic data exceed one of the two
thresholds and goes low when the magnetic data are between the two thresholds. This
kind of interrupt is selected by setting the IEL bit in INT_CTRL_REG_M (63h) to '0'.

Latched interrupt signal: it goes high when the data exceed one of the two thresholds
but is reset only once the source register is read and not when the magnetic data
returns between the two thresholds. This kind of interrupt is selected by setting the IEL
bit in INT_CTRL_REG_M (63h) to '1'.
The interrupt signal polarity can be set using the IEA bit in INT_CTRL_REG_M (63h).
If IEA is set to '1' then the interrupt signal is active high, while if it is set to '0' the interrupt
signal is active low.
In order to drive the interrupt signal from the DRDY pad, the INT_MAG_PIN bit in
CFG_REG_C_M (62h) must be set to '1'.
DocID027765 Rev 5
23/68
68
Functionality
4.1.4
LSM303AGR
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 LSM303AGR 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.
4.1.5
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.
24/68
DocID027765 Rev 5
LSM303AGR
Functionality
Figure 6. Magnetometer self-test procedure
:ULWH&KWR&)*B5(*B$B0 K
:ULWHKWR&)*B5(*B%B0 K
:ULWHKWR&)*B5(*B&B0 K
Æ ,QLWLDOL]H6HQVRUWXUQRQVHQVRU
Æ %'8&RQWLQXRXV&RQYHUVLRQPRGH(QDEOHRIIVHWFDQFHOODWLRQ
2'5 +]
3RZHUXSZDLWPVIRUVWDEOHRXWSXW
&KHFN=\[GD LQ67$786B5(*B0 K ± 0DJ'DWD5HDG\%LW
5HDG0DJ287;287<287=WRFOHDU=\[GD ELWLQUHJLVWHU
67$786B5(*B0 K ZDLWIRUWKHILUVWVDPSOH Æ 'LVFDUGGDWD
5HDGWKHRXWSXWUHJLVWHUVDIWHUFKHFNLQJ=\[GD ELW WLPHV
:KHQ=\[GD 5HDG287;B/B5(*B0 K 287;B+B5(*B0 K 6WRUHGDWDLQ287;B1267
5HDG287<B/B5(*B0 $K 287<B+B5(*B0 %K 6WRUHGDWDLQ287<B1267
5HDG287=B/B5(*B0 &K 287=B+B5(*B0 'K 6WRUHGDWDLQ287=B1267
7KHELWGDWDLVH[SUHVVHGLQWZR¶VFRPSOHPHQW
$YHUDJHWKHVWRUHGGDWDRQHDFKD[LV
:ULWHKWR&)*B5(*B&B0 K
Æ(QDEOH6HOI7HVW
:DLWIRUPV
&KHFN=\[GD LQ67$786B5(*B0 K ± 0DJ'DWD5HDG\%LW
5HDG0DJ287;287<287=WRFOHDU=\[GD ELWLQUHJLVWHU
67$786B5(*B0 K ZDLWIRUWKHILUVWVDPSOH Æ 'LVFDUGGDWD
5HDGWKHRXWSXWUHJLVWHUVDIWHUFKHFNLQJ=\[GD ELW WLPHV
:KHQ=\[GD 5HDG287;B/B5(*B0 K 287;B+B5(*B0 K 6WRUHGDWDLQ287;B67
5HDG287<B/B5(*B0 $K 287<B+B5(*B0 %K 6WRUHGDWDLQ287<B67
5HDG287=B/B5(*B0 &K 287=B+B5(*B0 'K 6WRUHGDWDLQ287=B67
7KHELWGDWDLVH[SUHVVHGLQWZR¶VFRPSOHPHQW
$YHUDJHWKHVWRUHGGDWDRQHDFKD[LV
0LQ 67B; _287;B67 287;B1267_ 0D[ 67B; $1'
0LQ 67B< _287<B67 287<B1267_ 0D[ 67B<
$1'
0LQ 67B= _287=B67 287=B1267_ 0$; 67B=
<(6 3$66 12 )$,/ :ULWHKWR&)*B5(*B&B0 K 'LVDEOHVHOIWHVW
:ULWHKWR&)*B5(*B$B0 K ,GOHPRGH
DocID027765 Rev 5
25/68
68
Functionality
LSM303AGR
4.2
Accelerometer
4.2.1
Accelerometer power modes
The LSM303AGR accelerometer provides three different linear acceleration operating
modes: high-resolution mode, normal mode and low-power mode.
The table below summarizes how to select the different operating modes.
Table 13. Operating mode selection
CTRL_REG1_A[3]
CTRL_REG4_A[3]
(LPen bit)
(HR bit)
Low-power mode
(8-bit data output)
1
0
ODR/2
1
16
Normal mode
(10-bit data output)
0
0
ODR/2
1.6
4
High-resolution mode
(12-bit data output)
0
1
ODR/9
7/ODR
1
Not allowed
1
1
--
--
--
Operating mode
BW [Hz]
Turn-on So @ ±2 g
time [ms] [mg/digit]
The turn-on time to transition to another operating mode is given in Table 14.
Table 14. Turn-on time for operating mode transition
Turn-on time
Operating mode change
[ms]
12-bit mode to 8-bit mode
1/ODR
12-bit mode to 10-bit mode
1/ODR
10-bit mode to 8-bit mode
1/ODR
10-bit mode to 12-bit mode
7/ODR
8-bit mode to 10-bit mode
1/ODR
8-bit mode to 12-bit mode
7/ODR
Table 15. Current consumption of operating modes
26/68
High resolution
Low-power mode
(8-bit data output)
[μA]
Normal mode
(10-bit data output)
[μA]
(12-bit data output)
[μA]
1
2
2
2
10
3
4
4
25
4
6
6
50
6
11
11
100
10
20
20
200
18
38
38
400
36
73
73
Operating
mode [Hz]
DocID027765 Rev 5
LSM303AGR
Functionality
Table 15. Current consumption of operating modes (continued)
4.2.2
High resolution
Low-power mode
(8-bit data output)
[μA]
Normal mode
(10-bit data output)
[μA]
(12-bit data output)
[μA]
1344
--
185
185
1620
100
--
--
5376
185
--
--
Operating
mode [Hz]
Accelerometer 6D / 4D orientation detection
The LSM303AGR includes 6D / 4D orientation detection which applies only to the
accelerometer.
In this configuration the interrupt is generated when the device is stable in a known
direction. In 4D configuration, detection of the position of the Z-axis is disabled.
4.2.3
Accelerometer activity/inactivity function
The Activity/Inactivity recognition function allows reducing the power consumption of the
accelerometer block in order to supply other smart applications and is applicable only to the
accelerometer block of the device.
When the Activity/Inactivity recognition function is activated, accelerometer is able to
automatically go to 10 Hz sampling rate and to wake up as soon as the interrupt event has
been detected, increasing the output data rate and bandwidth.
With this feature the system may be efficiently switched from/to low-power mode to full
performance depending on user-selectable positioning and acceleration events, thus
ensuring power saving and flexibility.
The Activity/Inactivity recognition function is activated by writing the desired threshold in the
Act_THS_A (3Eh) register. The high-pass filter is automatically enabled.
Table 16. Activity/Inactivity function control registers
Register
LSB value
ACT_THS_A
Full scale / 128 [mg]
ACT_DUR_A
8/ODR [s]
When the acceleration becomes smaller than the threshold for at least the duration
(8*ACT_DUR+1)/ODR, the ODR [3:0] bits of CTRL_REG1_A (20h) are bypassed (Inactivity)
and internally set to 10 Hz (ODR [3:0] = 0010), but the content of the CTRL_REG1_A
(20h)(ODR [3:0]) bits are left untouched.
When the acceleration becomes greater than the threshold (Act_THS_A (3Eh)),
CTRL_REG1_A (20h) is restored immediately (Activity).
Once the Activity/Inactivity detection function is enabled, it will be applied to the INT_2 pin
by setting the CTRL_REG6_A (25h) (P2_ACT) bit to ‘1’.
To disable the Activity/Inactivity detection function, set the content of the Act_THS_A (3Eh)
register to 00h.
DocID027765 Rev 5
27/68
68
Functionality
4.2.4
LSM303AGR
Accelerometer self-test
The self-test allows the user to check the sensor functionality without moving it. When the
self-test is enabled, an actuation force is applied to the sensor, simulating a definite input
acceleration. In this case the sensor outputs will exhibit a change in their DC levels which
are related to the selected full scale through the device sensitivity. When the self-test is
activated, the device output level is given by the algebraic sum of the signals produced by
the acceleration acting on the sensor and by the electrostatic test-force. If the output signals
change within the amplitude specified inside 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.
28/68
DocID027765 Rev 5
LSM303AGR
Functionality
Figure 7. Accelerometer self-test procedure
:ULWHKWR&75/B5(*B$
:ULWHKWR&75/B5(*B$
:ULWHKWR&75/B5(*B$
:ULWHKWR&75/B5(*B$
K
K
K
K
Æ ,QLWLDOL]H6HQVRUWXUQRQVHQVRUHQDEOH;<=D[HV
Æ 6HW%'8 )6 *1RUPDO0RGH2'5 +]
3RZHUXSZDLWIRUPVIRUVWDEOHRXWSXW
&KHFN=<;'$LQ67$786B5(*B$ K ± $FF 'DWD5HDG\%LW
5HDG$FF 287;287<287=WRFOHDU=<;'$ELWLQUHJLVWHU
67$786B5(*B$ K ZDLWIRUWKHILUVWVDPSOH Æ 'LVFDUGGDWD
5HDGWKHRXWSXWUHJLVWHUVDIWHUFKHFNLQJ=<;'$ELW WLPHV
5HDG287B;B/B$ K 287B;B+B$ K 6WRUHGDWDLQ287;B1267
5HDG287B<B/B$ $K 287B<B+B$ %K 6WRUHGDWDLQ287<B1267
5HDG287B=B/B$ &K 287B=B+B$ 'K 6WRUHGDWDLQ287=B1267
7KHELWOHIWMXVWLILHGGDWDLVH[SUHVVHGLQWZR¶VFRPSOHPHQW
$YHUDJHWKHVWRUHGGDWDRQHDFKD[LV
:ULWH$KWR&75/B5(*B$ K
Æ(QDEOH6HOI7HVW
:DLWIRUPVIRUVWDEOHRXWSXW
&KHFN=<;'$LQ67$786B5(*B$ K ± $FF 'DWD5HDG\%LW
5HDG$FF287;287<287=WRFOHDU=<;'$ELWLQUHJLVWHU
67$786B5(*B$ K ZDLWIRUWKHILUVWVDPSOH Æ 'LVFDUGGDWD
5HDGWKHRXWSXWUHJLVWHUVDIWHUFKHFNLQJ=<;'$ELW WLPHV
5HDG287B;B/B$ K 287B;B+B$ K 6WRUHGDWDLQ287;B67
5HDG287B<B/B$ $K 287B<B+B$ %K 6WRUHGDWDLQ287<B67
5HDG287B=B/B$ &K 287B=B+B$ 'K 6WRUHGDWDLQ287=B67
7KHELWOHIWMXVWLILHGGDWDLVH[SUHVVHGLQWZR¶VFRPSOHPHQW
$YHUDJHWKHVWRUHGGDWDRQHDFKD[LV
_0LQ 67B; _ _287;B67287;B1267_ _0D[ 67B; _
$1'
_0LQ 67B< _ _287<B67287<B1267_ _0D[ 67B< _
$1'
_0LQ 67B= _ _287=B67287=B1267_ _0$; 67B= _
<(6 3$66 12 )$,/ :ULWHKWR&75/B5(*B$ K 'LVDEOHVHQVRU
:ULWHKWR&75/B5(*B$ K 'LVDEOHVHOIWHVW
DocID027765 Rev 5
29/68
68
Functionality
4.3
LSM303AGR
IC interface
The complete measurement chain is composed of a low-noise capacitive amplifier which
converts the capacitive unbalancing of the MEMS sensor into an analog voltage using an
analog-to-digital converter.
The acceleration and magnetic data may be accessed through an I2C/SPI interface thus
making the device particularly suitable for direct interfacing with a microcontroller.
The LSM303AGR features a data-ready signal which indicates when new sets of measured
acceleration and magnetic data are available, thus simplifying data synchronization in the
digital system that uses the device.
4.4
FIFO
The FIFO buffer applies only to the accelerometer. The LSM303AGR embeds a 32-level
FIFO for each of the three output channels, X, Y and Z. This allows consistent power saving
for the system, since the host processor does not need to continuously poll data from the
sensor, but it can wake up only when needed and burst the significant data out from the
FIFO.
In order to enable the FIFO buffer, the FIFO_EN bit in CTRL_REG5_A (24h) must be set to
‘1’.
This buffer can work according to the following different modes: Bypass mode, FIFO mode,
Stream mode and Stream-to-FIFO mode. Each mode is selected by the FM [1:0] bits in
FIFO_CTRL_REG_A (2Eh). Programmable FIFO watermark level, FIFO empty or FIFO
overrun events can be enabled to generate dedicated interrupts on the INT_1_XL pin
(configuration through CTRL_REG3_A (22h)).
In the FIFO_SRC_REG_A (2Fh) register the EMPTY bit is equal to ‘1’ when all FIFO
samples are ready and FIFO is empty.
In the FIFO_SRC_REG_A (2Fh) register the WTM bit goes to ‘1’ if new data is written in the
buffer and FIFO_SRC_REG_A (2Fh) (FSS [4:0]) is greater than or equal to
FIFO_CTRL_REG_A (2Eh) (FTH [4:0]). FIFO_SRC_REG_A (2Fh) (WTM) goes to ‘0’ if
reading an X, Y, Z data slot from FIFO and FIFO_SRC_REG_A (2Fh) (FSS [4:0]) is less
than or equal to FIFO_CTRL_REG_A (2Eh) (FTH [4:0]).
In the FIFO_SRC_REG_A (2Fh) register the OVRN_FIFO bit is equal to ‘1’ if the FIFO slot
is overwritten.
4.4.1
Bypass mode
In Bypass mode the FIFO is not operational and for this reason it remains empty. For each
channel only the first address is used. The remaining FIFO levels are empty.
Bypass mode must be used in order to reset the FIFO buffer when a different mode is
operating (i.e. FIFO mode).
4.4.2
FIFO mode
In FIFO mode, the buffer continues filling data from the X, Y and Z accelerometer channels
until it is full (a set of 32 samples stored). When the FIFO is full, it stops collecting data from
the input channels and the FIFO content remains unchanged.
30/68
DocID027765 Rev 5
LSM303AGR
Functionality
An overrun interrupt can be enabled, I1_OVERRUN = '1' in the CTRL_REG3_A (22h)
register, in order to be raised when the FIFO stops collecting data. When the overrun
interrupt occurs, the first data has been overwritten and the FIFO stops collecting data from
the input channels.
After the last read it is necessary to exit Bypass mode in order to reset the FIFO content.
After this reset command, it is possible to restart FIFO mode just by selecting the FIFO
mode configuration (FM[1:0] bits) in register FIFO_CTRL_REG_A (2Eh).
4.4.3
Stream mode
In Stream mode the FIFO continues filling data from the X, Y, and Z accelerometer channels
until the buffer is full (a set of 32 samples stored) at which point the FIFO buffer index
restarts from the beginning and older data is replaced by the current data. The oldest values
continue to be overwritten until a read operation frees the FIFO slots.
An overrun interrupt can be enabled, I_XL_OVERRUN = '1' in the CTRL_REG3_A (22h)
register, in order to read the entire contents of the FIFO at once. If, in the application, it is
mandatory not to lose data and it is not possible to read at least one sample for each axis
within one ODR period, a watermark interrupt can be enabled in order to read partially the
FIFO and leave memory slots free for incoming data.
Setting the FTH [4:0] bit in the FIFO_CTRL_REG_A (2Eh) register to an N value, the
number of X, Y and Z data samples that should be read at the rise of the watermark interrupt
is up to (N+1).
Figure 8. Stream mode
4.4.4
Stream-to-FIFO mode
In Stream-to-FIFO mode, data from the X, Y and Z accelerometer channels are collected in
a combination of Stream mode and FIFO mode. The FIFO buffer starts operating in Stream
mode and switches to FIFO mode when the selected interrupt occurs.
DocID027765 Rev 5
31/68
68
Functionality
LSM303AGR
When an interrupt event is configured on the INT_1_XL pin, the FIFO operates in Stream
mode if the INT_1_XL pin value is equal to ‘0’ and it operates in FIFO mode if the INT_1_XL
pin value is equal to ‘1’. Switching modes is dynamically performed according to the
INT_1_XL pin value.
Stream-to-FIFO can be used in order to analyze the sampling history that generates an
interrupt. The standard operation is to read the contents of FIFO when the FIFO mode is
triggered and the FIFO buffer is full and stopped.
4.4.5
Retrieving data from FIFO
FIFO data is read from the OUT_X_L_A (28h), OUT_X_H_A (29h), OUT_Y_L_A (2Ah),
OUT_Y_H_A (2Bh), and OUT_Z_L_A (2Ch), OUT_Z_H_A (2Dh) registers. A read operation
using a serial interface of the OUT_X_L_A (28h), OUT_X_H_A (29h), OUT_Y_L_A (2Ah),
OUT_Y_H_A (2Bh) or OUT_Z_L_A (2Ch), OUT_Z_H_A (2Dh) output registers provides the
data stored in the FIFO. Each time data is read from the FIFO, the oldest X, Y and Z data
are placed in the OUT_X_L_A (28h), OUT_X_H_A (29h), OUT_Y_L_A (2Ah), OUT_Y_H_A
(2Bh) and OUT_Z_L_A (2Ch), OUT_Z_H_A (2Dh) registers and both single read and
read_burst operations can be used.
32/68
DocID027765 Rev 5
LSM303AGR
4.4.6
Functionality
FIFO multiple read (burst)
Starting from Addr 28h multiple reads can be performed. Once the read reaches Addr 2Dh,
the system automatically restarts from Addr 28h.
Figure 9. FIFO multiple read
[\]
5HDG
287B<B$
$%
287B=B$
&'
287B;B$
287B<B$
$%
287B=B$
&'
[\]
5HDGQ
4.5
287B;B$
Temperature sensor
The LSM303AGR is supplied with an internal temperature sensor. Temperature data can be
enabled by setting the TEMP_EN[1:0] bits to ‘1’ in the TEMP_CFG_REG_A (1Fh) register.
To retrieve the temperature sensor data the BDU bit in CTRL_REG4_A (23h) must be set
to ‘1’.
Both the OUT_TEMP_L_A (0Ch), OUT_TEMP_H_A (0Dh) registers must be read.
Temperature data is stored inside OUT_TEMP_H as two’s complement data in 8-bit format
left-justified.
4.6
Factory calibration
The IC interface is factory calibrated for sensitivity (LA_So, M_GN), Zero-g level (LA_TyOff)
and Zero-gauss level (M_TyOff).
The trim values are stored inside the device in nonvolatile memory. Anytime the device is
turned on, the trim parameters are downloaded into the registers to be used during active
operation. This allows using the device without further calibration.
DocID027765 Rev 5
33/68
68
Application hints
5
LSM303AGR
Application hints
Figure 10. LSM303AGR electrical connections
9GGB,2
& Q)
,17BB;/
,17BB;/
6&/63&
9GG
&6B;/
9GGB,2
& —)
9GG
7239,(:
&6B0$*
*1'
& Q)
,17B0$*'5'<
&
&& Q)
Q)
*1'
6'$6',6'2
*1'
'LJLWDOVLJQDOIURPWRVLJQDOFRQWUROOHU6LJQDO OHYHOVDUHGHILQHGE\SURSHUVHOHFWLRQRI9GGB,2
The device core is supplied through the Vdd line while the I/O pads are supplied through the
Vdd_IO line. Power supply decoupling capacitors (100 nF ceramic, 10 μF aluminum) should
be placed as near as possible to pin 9 of the device (common design practice).
It is possible to remove Vdd, maintaining Vdd_IO, without blocking the communication bus,
in this condition the measurement chain is powered off.
The following recommendations apply to capacitor C1:

It must be connected as close as possible to pins 5 and 6 since very high current
pulses flow from C1 to pin 5 and 6. This avoid problems caused by inductive effects
due to the length of the copper strips.

It is highly recommended to use low ESR (max 200 mOhm)
The functionality of the device and the measured acceleration data are selectable and
accessible through the I2C or SPI interfaces. When using the I2C, CS must be tied high (i.e.
connected to Vdd_IO).
The functions, the threshold and the timing of the three interrupt pins (INT_1_XL, INT_2_XL,
and INT_MAG) can be completely programmed by the user through the I2C/SPI interface.
5.1
Soldering information
The LGA package is compliant with the ECOPACK®, RoHS and “Green” standards.
It is qualified for soldering heat resistance according to JEDEC J-STD-020.
Leave “Pin 1 Indicator” unconnected during soldering.
Land pattern and soldering recommendations are available at www.st.com.
34/68
DocID027765 Rev 5
LSM303AGR
5.2
Application hints
High-current wiring effects
High current in wiring and printed circuit traces can be culprits in causing errors in magnetic
field measurements for compassing.
Conductor-generated magnetic fields will add to the Earth’s magnetic field, leading to errors
in compass heading computation.
Keep currents higher than 10 mA a few millimeters away from the sensor IC.
DocID027765 Rev 5
35/68
68
Digital interfaces
6
LSM303AGR
Digital interfaces
The registers embedded inside the LSM303AGR may be accessed through both the I2C
and SPI serial interfaces. The latter may be SW-configured to operate in 3-wire interface
mode.
The serial interfaces are mapped onto the same pads. To select/exploit the I2C interface, the
CS line must be tied high (i.e. connected to Vdd_IO).
Table 17. Serial interface pin description
Pin name
CS_XL, CS_MAG
6.1
Pin description
SPI enable
I2C/SPI mode selection (1: SPI idle mode / I2C communication
enabled; 0: SPI communication mode / I2C disabled)
SCL
SPC
I2C serial clock (SCL)
SPI serial port clock (SPC)
SDA
SDI
SDO
I2C serial data (SDA)
SPI serial data input (SDI)
3-wire interface serial data output (SDO)
I2C serial interface
The LSM303AGR I2C is a bus slave. The I2C is employed to write data into registers whose
content can also be read back.
The relevant I2C terminology is given in the table below.
Table 18. I2C terminology
Term
Transmitter
Receiver
Description
The device which sends data to the bus
The device which receives data from the bus
Master
The device which initiates a transfer, generates clock signals and terminates a
transfer
Slave
The device addressed by the master
There are two signals associated with the I2C bus: the serial clock line (SCL) and the serial
data line (SDA). The latter is a bidirectional line used for sending and receiving the data
to/from the interface. Both the lines must be connected to Vdd_IO through an external pullup resistor. When the bus is free, both the lines are high.
The I2C interface is compliant with fast mode (400 kHz) I2C standards as well as with the
normal mode.
36/68
DocID027765 Rev 5
LSM303AGR
Digital interfaces
I2C operation
6.1.1
The transaction on the bus is started through a START (ST) signal. A START condition is
defined as a high-to-low transition on the data line while the SCL line is held high. After this
has been transmitted by the master, the bus is considered busy. The next byte of data
transmitted after the start condition contains the address of the slave in the first 7 bits and
the eighth bit tells whether the master is receiving data from the slave or transmitting data to
the slave. When an address is sent, each device in the system compares the first seven bits
after a start condition with its address. If they match, the device considers itself addressed
by the master.
Data transfer with acknowledge is mandatory. The transmitter must release the SDA line
during the acknowledge pulse. The receiver must then pull the data line LOW so that it
remains stable low during the high period of the acknowledge clock pulse. A receiver which
has been addressed is obliged to generate an acknowledge after each byte of data
received.
The I2C embedded inside the LSM303AGR behaves like a slave device and the following
protocol must be adhered to. After the start condition (ST) a slave address is sent, once a
slave acknowledge (SAK) has been returned, an 8-bit sub-address (SUB) is transmitted: the
7 LSb represent the actual register address while the MSB enables address auto increment.
If the MSb of the SUB field is ‘1’, the SUB (register address) is automatically increased to
allow multiple data read/writes.
The slave address is completed with a Read/Write bit. If the bit was ‘1’ (Read), a repeated
START (SR) condition must be issued after the two sub-address bytes; if the bit is ‘0’ (Write)
the master will transmit to the slave with direction unchanged. Table 23 explains how the
SAD+read/write bit pattern is composed, listing all the possible configurations.
Table 19. Transfer when master is writing one byte to slave
Master
ST
SAD + W
SUB
Slave
DATA
SAK
SP
SAK
SAK
Table 20. Transfer when master is writing multiple bytes to slave
Master
ST
SAD + W
SUB
Slave
SAK
DATA
DATA
SAK
SAK
SP
SAK
Table 21. Transfer when master is receiving (reading) one byte of data from slave
Master
ST
SAD + W
Slave
SUB
SAK
SR
SAD + R
SAK
NMAK
SAK
SP
DATA
Table 22. Transfer when master is receiving (reading) multiple bytes of data from slave
Master
Slave
ST
SAD+W
SUB
SAK
SR SAD+R
SAK
MAK
SAK
DATA
MAK
DAT
A
NMAK
SP
DATA
Data are transmitted in byte format (DATA). Each data transfer contains 8 bits. The number
of bytes transferred per transfer is unlimited. Data is transferred with the Most Significant bit
DocID027765 Rev 5
37/68
68
Digital interfaces
LSM303AGR
(MSb) first. If a receiver can’t receive another complete byte of data until it has performed
some other function, it can hold the clock line SCL low to force the transmitter into a wait
state. Data transfer only continues when the receiver is ready for another byte and releases
the data line. If a slave receiver doesn’t acknowledge the slave address (i.e. it is not able to
receive because it is performing some real-time function) the data line must be left high by
the slave. The master can then abort the transfer. A low-to-high transition on the SDA line
while the SCL line is high is defined as a STOP condition. Each data transfer must be
terminated by the generation of a STOP (SP) condition.
In the presented communication format MAK is Master acknowledge and NMAK is No
Master Acknowledge.
Default address:
The accelerometer sensor slave address is 0011001b while magnetic sensor slave address
is 0011110b.
The slave addresses are completed with a Read/Write bit. If the bit was ‘1’ (Read), a
repeated START (SR) condition must be issued after the two sub-address bytes. If the bit is
‘0’ (Write) the master will transmit to the slave with direction unchanged. Table 23 and
Table 24 explain how the SAD+Read/Write bit patterns are composed, listing all the
possible configurations.
Linear acceleration sensor: the default (factory setting) 7-bit slave address is
0011001b.
Table 23. SAD + Read/Write patterns
Command
SAD[6:0]
R/W
SAD + R/W
Read
0011001
1
00110011 (33h)
Write
0011001
0
00110010 (32h)
Magnetic field sensor: the default (factory setting) 7-bit slave address is 0011110b.
Table 24. SAD + Read/Write patterns
6.2
Command
SAD[6:0]
R/W
SAD + R/W
Read
0011110
1
00111101 (3Dh)
Write
0011110
0
00111100 (3Ch)
SPI bus interface
The LSM303AGR SPI is a bus slave. The SPI allows writing and reading the registers of the
device.
The serial interface interacts with the application using 3 wires: CS_XL or CS_MAG, SPC,
SDI/O.
38/68
DocID027765 Rev 5
LSM303AGR
6.2.1
Digital interfaces
Accelerometer SPI write
Figure 11. Accelerometer SPI write protocol
The SPI Write command is performed with 16 clock pulses. A multiple byte write command
is performed by adding blocks of 8 clock pulses to the previous one.
bit 0: WRITE bit. The value is 0.
bit 1: MS bit. When O do not increment address, when 1 increment address in multiple
writing.
bit 2-7: address AD(5:0). This is the address field of the indexed register.
bit 8-15. data 01(7:0) {write mode). This is the data that is written inside the device (MSb
first).
bit 16-...: data Dl(...-8). Further data in multiple byte writes.
Figure 12. Accelerometer multiple byte SPI write protocol (2-byte example)
DocID027765 Rev 5
39/68
68
Digital interfaces
6.2.2
LSM303AGR
Accelerometer SPI read in 3-wire mode
3-wire mode is entered by setting the CTRL_REG4_A (23h) (SPI_ENABLE) bit equal ‘1’
(SPI serial interface read enable).
Figure 13. Accelerometer SPI read protocol in 3-wire mode
&6
63&
6',2
'2 '2 '2 '2 '2 '2 '2 '2
5:
06
$' $' $' $' $' $'
The SPI read command is performed with 16 clock pulses:
bit 0: READ bit. The value is 1.
bit 1: MS bit. When 0, does not increment the address; when 1, increments the address in
multiple reads.
bit 2-7: address AD(5:0). This is the address field of the indexed register.
bit 8-15: data DO(7:0) (read mode). This is the data that is read from the device (MSb first).
A multiple read command is also available in 3-wire mode.
6.2.3
Magnetometer SPI write
Figure 14. Magnetometer SPI write protocol
CS
SPC
SDI
D I7
RW
D I6
D I5
D I4
DI3
DI2
DI1
DI0
AD6 AD5 AD 4 AD 3 AD2 AD 1 AD0
The SPI write command is performed with 16 clock pulses. The multiple byte write
command is performed by adding blocks of 8 clock pulses to the previous one.
bit 0: WRITE bit. The value is 0.
bit 1-7: address AD(6:0). This is the address field of the indexed register.
bit 8-15: data DI(7:0) (write mode). This is the data that is written inside the device (MSb
first).
bit 16-... : data DI(...-8). Further data in multiple byte writes.
40/68
DocID027765 Rev 5
LSM303AGR
Digital interfaces
Figure 15. Magnetometer multiple byte SPI write protocol (2-byte example)
CS
SPC
SDI
DI7 D I6 DI5 D I4 DI3 DI2 DI1 DI0 DI15 D I1 4 DI13 D I1 2 DI11 DI10 DI9 DI8
RW
AD6 AD5 AD4 AD3 AD2 AD1 AD 0
6.2.4
Magnetometer SPI read
Figure 16. Magnetometer SPI read protocol
CS
SPC
SDI/O
D O7 D O6 D O5 DO4 DO3 DO2 DO1 DO0
RW
AD6 AD5
AD 4 AD 3 AD2 AD1
AD 0
The SPI read command is performed with 16 clock pulses:
bit 0: WRITE bit. The value is 1.
bit 1-7: address AD(6:0). This is the address field of the indexed register.
bit 8-15: data DO(7:0) (read mode). This is the data that is read from the device (MSb first).
A multiple read command is available in 3-wire mode.
DocID027765 Rev 5
41/68
68
Register mapping
7
LSM303AGR
Register mapping
The table given below provides a list of the 8-bit registers embedded in the device and the
corresponding addresses. Registers 00h through 3Fh are dedicated to the accelerometer
while registers 40h through 6Fh are dedicated to the magnetometer.
Table 25. Register address map
Name
Type(1)
Register address
Default
Hex
Reserved
00 - 06
Reserved
STATUS_REG_AUX_A
R
07
Reserved
R
08-0B
OUT_TEMP_L_A
R
0C
000 1100
Output
OUT_TEMP_H_A
R
0D
000 1101
Output
INT_COUNTER_REG_A
R
0E
000 1110
WHO_AM_I_A
R
0F
000 1111
Reserved
Comment
Binary
000 0111
Reserved
Output registers
00110011 Dummy register
10 - 1E
Reserved
TEMP_CFG_REG_A
R/W
1F
001 1111
00000000
CTRL_REG1_A
R/W
20
010 0000
00000111
CTRL_REG2_A
R/W
21
010 0001
00000000
CTRL_REG3_A
R/W
22
010 0010
CTRL_REG4_A
R/W
23
010 0011
00000000 Accelerometer control
00000000 registers
CTRL_REG5_A
R/W
24
010 0100
00000000
CTRL_REG6_A
R/W
25
010 0101
00000000
REFERENCE/DATACAPTURE_A
R/W
26
010 0110
00000000
STATUS_REG_A
R
27
010 0111
00000000
OUT_X_L_A
R
28
010 1000
Output
OUT_X_H_A
R
29
010 1001
Output
OUT_Y_L_A
R
2A
010 1010
Output
OUT_Y_H_A
R
2B
010 1011
Output
OUT_Z_L_A
R
2C
010 1100
Output
OUT_Z_H_A
R
2D
010 1101
Output
FIFO_CTRL_REG_A
R/W
2E
010 1110
00000000
FIFO_SRC_REG_A
R
2F
010 1111
0010000
42/68
DocID027765 Rev 5
Accelerometer status
register
Accelerometer output
registers
FIFO registers
LSM303AGR
Register mapping
Table 25. Register address map (continued)
Name
Type(1)
Register address
Default
Hex
Binary
INT1_CFG_A
R/W
30
011 0000
00000000
INT1_SRC_A
R
31
011 0001
00000000
INT1_THS_A
R/W
32
011 0010
00000000
INT1_DURATION_A
R/W
33
011 0011
00000000
INT2_CFG_A
R/W
34
011 0100
00000000
INT2_SRC_A
R
35
011 0101
00000000
INT2_THS_A
R/W
36
011 0110
00000000
INT2_DURATION_A
R/W
37
011 0111
00000000
CLICK_CFG_A
R/W
38
011 1000
00000000
CLICK_SRC_A
R
39
011 1001
00000000
CLICK_THS_A
R/W
3A
011 1010
00000000
TIME_LIMIT_A
R/W
3B
011 1011
00000000
TIME_LATENCY_A
R/W
3C
011 1100
00000000
TIME_WINDOW_A
R/W
3D
011 1101
00000000
Act_THS_A
R/W
3E
011 1110
00000000
Act_DUR_A
R/W
3F
011 1111
00000000
RESERVED
Interrupt 1 registers
Interrupt 2 registers
40-44
OFFSET_X_REG_L_M
R/W
45
01000101
00000000
OFFSET_X_REG_H_M
R/W
46
01000110
00000000
OFFSET_Y_REG_L_M
R/W
47
01000111
00000000
OFFSET_Y_REG_H_M
R/W
48
01001000
00000000
OFFSET_Z_REG_L_M
R/W
49
01001001
00000000
OFFSET_Z_REG_H_M
R/W
4A
01001010
00000000
01001111
01000000
RESERVED
WHO_AM_I_M
Comment
Magnetometer
hard-iron registers
4B-4C
R
RESERVED
4F
50-5F
CFG_REG_A_M
R/W
60
01100000
00000011
CFG_REG_B_M
R/W
61
01100001
00000000
CFG_REG_C_M
R/W
62
01100010
00000000
INT_CRTL_REG_M
R/W
63
01100011
11100000
R
64
01100100
INT_THS_L_REG_M
R/W
65
01100101
Magnetometer
interrupt configuration
00000000
registers
INT_THS_H_REG_M
R/W
66
01100110
00000000
INT_SOURCE_REG_M
DocID027765 Rev 5
Magnetometer
configuration registers
43/68
68
Register mapping
LSM303AGR
Table 25. Register address map (continued)
Name
Register address
Type(1)
Default
Hex
Binary
STATUS_REG_M
R
67
01100111
OUTX_L_REG_M
R
68
01101000
output
OUTX_H_REG_M
R
69
01101001
output
OUTY_L_REG_M
R
6A
01101010
output
OUTY_H_REG_M
R
6B
01101010
output
OUTZ_L_REG_M
R
6C
01101100
output
OUTZ_H_REG_M
R
6D
01101101
output
RESERVED
Comment
Magnetometer output
registers
6E-6F
1. R = read-only register, R/W = readable/writable register
Registers marked as Reserved must not be changed. Writing to those registers may cause
permanent damage to the device.
The content of the registers that are loaded at boot should not be changed. They contain the
factory calibration values. Their content is automatically restored when the device is
powered up.
44/68
DocID027765 Rev 5
LSM303AGR
Register description
8
Register description
8.1
STATUS_REG_AUX_A (07h)
Table 26. STATUS_REG_AUX register
--
TOR
--
--
--
TDA
--
--
Table 27. STATUS_REG_AUX description
8.2
TOR
Temperature data overrun. Default value: 0
(0: no overrun has occurred;
1: new temperature data has overwritten the previous data)
TDA
Temperature new data available. Default value: 0
(0: new temperature data is not yet available;
1: new temperature data is available)
OUT_TEMP_L_A (0Ch), OUT_TEMP_H_A (0Dh)
Temperature sensor data. Refer to Section 4.5: Temperature sensor for details on how to
enable and read the temperature sensor output data.
8.3
INT_COUNTER_REG_A (0Eh)
Table 28. INT_COUNTER_REG register
IC7
8.4
IC6
IC5
IC4
IC3
IC2
IC1
IC0
WHO_AM_I_A (0Fh)
Table 29. WHO_AM_I register
0
0
1
1
0
0
1
1
0
0
Device identification register.
8.5
TEMP_CFG_REG_A (1Fh)
Table 30. TEMP_CFG_REG register
TEMP_EN1 TEMP_EN0
0
0
0
0
Table 31. TEMP_CFG_REG description
TEMP_EN[1:0]
Temperature sensor (T) enable. Default value: 00
(00: T disabled; 11: T enabled)
DocID027765 Rev 5
45/68
68
Register description
8.6
LSM303AGR
CTRL_REG1_A (20h)
Table 32. CTRL_REG1 register
ODR3
ODR2
ODR1
ODR0
LPen
Zen
Yen
Xen
Table 33. CTRL_REG1 description
ODR[3:0]
Data rate selection. Default value: 0000
(0000: power-down mode; others: refer to Table 34)
LPen
Low-power mode enable. Default value: 0
(0: normal mode, 1: low-power mode)
(Refer to Section 4.2.1: Accelerometer power modes)
Zen
Z-axis enable. Default value: 1
(0: Z-axis disabled; 1: Z-axis enabled)
Yen
Y-axis enable. Default value: 1
(0: Y-axis disabled; 1: Y-axis enabled)
Xen
X-axis enable. Default value: 1
(0: X-axis disabled; 1: X-axis enabled)
ODR[3:0] is used to set the power mode and ODR selection. The following table indicates
the frequency of each combination of ODR[3:0].
Table 34. Data rate configuration
ODR3
8.7
ODR2
ODR1
ODR0
Power mode selection
0
0
0
0
Power-down mode
0
0
0
1
HR / Normal / Low-power mode (1 Hz)
0
0
1
0
HR / Normal / Low-power mode (10 Hz)
0
0
1
1
HR / Normal / Low-power mode (25 Hz)
0
1
0
0
HR / Normal / Low-power mode (50 Hz)
0
1
0
1
HR / Normal / Low-power mode (100 Hz)
0
1
1
0
HR / Normal / Low-power mode (200 Hz)
0
1
1
1
HR/ Normal / Low-power mode (400 Hz)
1
0
0
0
Low-power mode (1.620 kHz)
1
0
0
1
HR/ Normal (1.344 kHz);
Low-power mode (5.376 kHz)
CTRL_REG2_A (21h)
Table 35. CTRL_REG2 register
HPM1
46/68
HPM0
HPCF2
HPCF1
DocID027765 Rev 5
FDS
HPCLICK
HPIS2
HPIS1
LSM303AGR
Register description
Table 36. CTRL_REG2 description
HPM[1:0]
High-pass filter mode selection. Default value: 00
Refer to Table 37 for filter mode configuration
HPCF[2:1]
High-pass filter cutoff frequency selection
FDS
Filtered data selection. Default value: 0
(0: internal filter bypassed; 1: data from internal filter sent to output register and FIFO)
HPCLICK
High-pass filter enable for CLICK function.
(0: filter bypassed; 1: filter enabled)
HPIS2
High-pass filter enable for AOI function on Interrupt 2.
(0: filter bypassed; 1: filter enabled)
HPIS1
High-pass filter enable for AOI function on Interrupt 1.
(0: filter bypassed; 1: filter enabled)
Table 37. High-pass filter mode configuration
8.8
HPM1
HPM0
High-pass filter mode
0
0
Normal mode (reset by reading the REFERENCE/DATACAPTURE_A (26h) register)
0
1
Reference signal for filtering
1
0
Normal mode
1
1
Autoreset on interrupt event
CTRL_REG3_A (22h)
Table 38. CTRL_REG3 register
I1_CLICK
I1_AOI1
I1_AOI2
I1_DRDY1
I1_DRDY2
I1_WTM
I1_OVERRUN
--
Table 39. CTRL_REG3 description
I1_CLICK
CLICK interrupt on INT1 pin. Default value 0.
(0: disable; 1: enable)
I1_AOI1
AOI1 interrupt on INT1 pin. Default value 0.
(0: disable; 1: enable)
I1_AOI2
AOI2 interrupt on INT1 pin. Default value 0.
(0: disable; 1: enable)
I1_DRDY1
DRDY1 interrupt on INT1 pin. Default value 0.
(0: disable; 1: enable)
I1_DRDY2
DRDY2 interrupt on INT1 pin. Default value 0.
(0: disable; 1: enable)
I1_WTM
FIFO watermark interrupt on INT1 pin. Default value 0.
(0: disable; 1: enable)
I1_OVERRUN
FIFO overrun interrupt on INT1 pin. Default value 0.
(0: disable; 1: enable)
DocID027765 Rev 5
47/68
68
Register description
8.9
LSM303AGR
CTRL_REG4_A (23h)
Table 40. CTRL_REG4 register
BDU
BLE(1)
FS1
FS0
HR
ST1
SPI_
ENABLE
ST0
1. The BLE function can be activated only in high-resolution mode
Table 41. CTRL_REG4 description
BDU
Block data update. Default value: 0
(0: continuous update; 1: output registers not updated until MSB and LSB
have been read)
BLE
Big/Little Endian data selection. Default value: 0
(0: data LSb at lower address; 1: data MSb at lower address)
The BLE function can be activated only in high-resolution mode
FS[1:0]
Full-scale selection. Default value: 00
(00: ±2g; 01: ±4g; 10: ±8g; 11: ±16g)
HR
Operating mode selection (refer to Section 4.2.1: Accelerometer power
modes)
ST[1:0]
Self-test enable. Default value: 00
(00: self-test disabled; other: see Table 42)
SPI_ENABLE
3-wire SPI interface enable. Default: 0
(0: SPI 3-wire disabled; 1: SPI 3-wire enabled)
Table 42. Self-test mode configuration
ST1
8.10
ST0
Self-test mode
0
0
Normal mode
0
1
Self test 0
1
0
Self test 1
1
1
--
CTRL_REG5_A (24h)
Table 43. CTRL_REG5_A register
BOOT
48/68
FIFO_EN
--
--
LIR_INT1
DocID027765 Rev 5
D4D_INT1
LIR_INT2
D4D_INT2
LSM303AGR
Register description
Table 44. CTRL_REG5_A description
8.11
BOOT
Reboot memory content. Default value: 0
(0: normal mode; 1: reboot memory content)
FIFO_EN
FIFO enable. Default value: 0
(0: FIFO disabled; 1: FIFO enabled)
LIR_INT1
Latch interrupt request on INT1_SRC_A (31h), with INT1_SRC_A (31h) register
cleared by reading INT1_SRC_A (31h) itself. Default value: 0.
(0: interrupt request not latched; 1: interrupt request latched)
D4D_INT1
4D enable: 4D detection is enabled on INT1 pin when 6D bit on INT1_CFG_A
(30h) is set to 1.
LIR_INT2
Latch interrupt request on INT2_SRC_A (35h) register, with INT2_SRC_A (35h)
register cleared by reading INT2_SRC_A (35h) itself. Default value: 0.
(0: interrupt request not latched; 1: interrupt request latched)
D4D_INT2
4D enable: 4D detection is enabled on INT2 pin when 6D bit on INT2_CFG_A
(34h) is set to 1.
CTRL_REG6_A (25h)
Table 45. CTRL_REG6_A register
I2_CLICKen
I2_INT1
I2_INT2
BOOT_I2
P2_ACT
--
H_LACTIVE
-
Table 46. CTRL_REG6_A description
8.12
I2_CLICKen
Click interrupt on INT2 pin. Default value: 0
(0: disabled; 1: enabled)
I2_INT1
Interrupt 1 function enable on INT2 pin. Default value: 0
(0: function disabled; 1: function enabled)
I2_INT2
Interrupt 2 function enable on INT2 pin. Default value: 0
(0: function disabled; 1: function enabled)
BOOT_I2
Boot on INT2 pin enable. Default value: 0
(0: disabled; 1:enabled)
P2_ACT
Activity interrupt enable on INT2 pin. Default value: 0.
(0: disabled; 1:enabled)
H_LACTIVE
interrupt active. Default value: 0.
(0: interrupt active-high; 1: interrupt active-low)
REFERENCE/DATACAPTURE_A (26h)
Table 47. REFERENCE/DATACAPTURE_A register
Ref7
Ref6
Ref5
Ref4
Ref3
DocID027765 Rev 5
Ref2
Ref1
Ref0
49/68
68
Register description
LSM303AGR
Table 48. REFERENCE/DATACAPTURE_A description
Ref [7:0]
8.13
Reference value for interrupt generation. Default value: 0
STATUS_REG_A (27h)
Table 49. STATUS_REG_A register
ZYXOR
ZOR
YOR
XOR
ZYXDA
ZDA
YDA
XDA
ZYXOR
X-, Y- and Z-axis data overrun. Default value: 0
(0: no overrun has occurred; 1: a new set of data has overwritten the previous set)
ZOR
Z-axis data overrun. Default value: 0
(0: no overrun has occurred; 1: new data for the Z-axis has overwritten the previous data)
YOR
Y-axis data overrun. Default value: 0
(0: no overrun has occurred;
1: new data for the Y-axis has overwritten the previous data)
XOR
X-axis data overrun. Default value: 0
(0: no overrun has occurred;
1: new data for the X-axis has overwritten the previous data)
ZYXDA
X-, Y- and Z-axis new data available. Default value: 0
(0: a new set of data is not yet available; 1: a new set of data is available)
ZDA
Z-axis new data available. Default value: 0
(0: new data for the Z-axis is not yet available;
1: new data for the Z-axis is available)
YDA
Y-axis new data available. Default value: 0
(0: new data for the Y-axis is not yet available;
1: new data for the Y-axis is available)
Table 50. STATUS_REG_A description
8.14
OUT_X_L_A (28h), OUT_X_H_A (29h)
X-axis acceleration data. The value is expressed as two’s complement left-justified.
Please refer to Section 4.2.1: Accelerometer power modes.
8.15
OUT_Y_L_A (2Ah), OUT_Y_H_A (2Bh)
Y-axis acceleration data. The value is expressed as two’s complement left-justified.
Please refer to Section 4.2.1: Accelerometer power modes.
8.16
OUT_Z_L_A (2Ch), OUT_Z_H_A (2Dh)
Z-axis acceleration data. The value is expressed as two’s complement left-justified.
Please refer to Section 4.2.1: Accelerometer power modes.
50/68
DocID027765 Rev 5
LSM303AGR
8.17
Register description
FIFO_CTRL_REG_A (2Eh)
Table 51. FIFO_CTRL_REG_A register
FM1
FM0
TR
FTH4
FTH3
FTH2
FTH1
FTH0
Table 52. FIFO_CTRL_REG_A description
FM[1:0]
FIFO mode selection. Default value: 00 (see Table 53)
TR
Trigger selection. Default value: 0
0: trigger event allows triggering signal on INT1
1: trigger event allows triggering signal on INT2
FTH[4:0]
Default value: 00000
Table 53. FIFO mode configuration
FM1
8.18
FM0
FIFO mode
0
0
Bypass mode
0
1
FIFO mode
1
0
Stream mode
1
1
Stream-to-FIFO mode
FIFO_SRC_REG_A (2Fh)
Table 54. FIFO_SRC_REG_A register
WTM
OVRN_FIFO
EMPTY
FSS4
FSS3
FSS2
FSS1
FSS0
Table 55. FIFO_SRC_REG_A description
WTM
WTM bit is set high when FIFO content exceeds watermark level.
OVRN_FIFO
OVRN bit is set high when FIFO buffer is full; this means that the FIFO buffer
contains 32 unread samples. At the following ODR a new sample set replaces the
oldest FIFO value. The OVRN bit is set to 0 when the first sample set has been
read.
EMPTY
EMPTY flag is set high when all FIFO samples have been read and FIFO is empty.
FSS [4:0]
FSS [4:0] field always contains the current number of unread samples stored in the
FIFO buffer. When FIFO is enabled, this value increases at ODR frequency until
the buffer is full, whereas, it decreases every time one sample set is retrieved from
FIFO.
DocID027765 Rev 5
51/68
68
Register description
8.19
LSM303AGR
INT1_CFG_A (30h)
Table 56. INT1_CFG_A register
AOI
6D
ZHIE/
ZUPE
ZLIE/
ZDOWNE
YHIE/
YUPE
YLIE/
YDOWNE
XHIE/
XUPE
XLIE/
XDOWNE
Table 57. INT1_CFG_A description
AOI
And/Or combination of interrupt events. Default value: 0. Refer to Table 58.
6D
6-direction detection function enabled. Default value: 0. Refer to Table 58.
ZHIE/
ZUPE
Enable interrupt generation on Z high event or on direction recognition. Default value: 0
(0: disable interrupt request;1: enable interrupt request)
ZLIE/
Enable interrupt generation on Z low event or on direction recognition. Default value: 0
ZDOWNE (0: disable interrupt request;1: enable interrupt request)
YHIE/
YUPE
Enable interrupt generation on Y high event or on direction recognition. Default value: 0
(0: disable interrupt request; 1: enable interrupt request.)
YLIE/
Enable interrupt generation on Y low event or on direction recognition. Default value: 0
YDOWNE (0: disable interrupt request; 1: enable interrupt request.)
XHIE/
XUPE
Enable interrupt generation on X high event or on direction recognition. Default value: 0
(0: disable interrupt request; 1: enable interrupt request.)
XLIE/
Enable interrupt generation on X low event or on direction recognition. Default value: 0
XDOWNE (0: disable interrupt request; 1: enable interrupt request.)
The content of this register is loaded at boot.
A write operation to this address is possible only after system boot.
52/68
DocID027765 Rev 5
LSM303AGR
Register description
Table 58. Interrupt mode
AOI
6D
Interrupt mode
0
0
OR combination of interrupt events
0
1
6-direction movement recognition
1
0
AND combination of interrupt events
1
1
6-direction position recognition
The difference between AOI-6D = ‘01’ and AOI-6D = ‘11’.
AOI-6D = ‘01’ is movement recognition. An interrupt is generated when the orientation
moves from an unknown zone to a known zone. The interrupt signal remains for a duration
ODR.
AOI-6D = ‘11’ is direction recognition. An interrupt is generated when the orientation is
inside a known zone. The interrupt signal remains while the orientation is inside the zone.
8.20
INT1_SRC_A (31h)
Table 59. INT1_SRC_A register
0
IA
ZH
ZL
YH
YL
XH
XL
Table 60. INT1_SRC_A description
IA
Interrupt active. Default value: 0
(0: no interrupt has been generated; 1: one or more interrupts have been generated)
ZH
Z high. Default value: 0
(0: no interrupt, 1: Z high event has occurred)
ZL
Z low. Default value: 0
(0: no interrupt; 1: Z low event has occurred)
YH
Y high. Default value: 0
(0: no interrupt, 1: Y high event has occurred)
YL
Y low. Default value: 0
(0: no interrupt, 1: Y low event has occurred)
XH
X high. Default value: 0
(0: no interrupt, 1: X high event has occurred)
XL
X low. Default value: 0
(0: no interrupt, 1: X low event has occurred)
Interrupt 1 source register. Read-only register.
Reading at this address clears the INT1_SRC_A (31h) IA bit (and the interrupt signal on the
INT1 pin) and allows the refresh of data in the INT1_SRC_A (31h) register if the latched
option was chosen.
DocID027765 Rev 5
53/68
68
Register description
8.21
LSM303AGR
INT1_THS_A (32h)
Table 61. INT1_THS_A register
0
THS6
THS5
THS4
THS3
THS2
THS1
THS0
D1
D0
Table 62. INT1_THS_A description
THS[6:0]
8.22
Interrupt 1 threshold. Default value: 000 0000
1 LSb = 16 mg @ FS = 2 g
1 LSb = 32 mg @ FS = 4 g
1 LSb = 62 mg @ FS = 8 g
1 LSb = 186 mg @ FS = 16 g
INT1_DURATION_A (33h)
Table 63. INT1_DURATION_A register
0
D6
D5
D4
D3
D2
Table 64. INT1_DURATION_A description
D[6:0]
Duration value. Default value: 000 0000
1 LSb = 1/ODR
The D[6:0] bits set the minimum duration of the Interrupt 2 event to be recognized. Duration
steps and maximum values depend on the ODR chosen.
Duration time is measured in N/ODR, where N is the content of the duration register.
8.23
INT2_CFG_A (34h)
Table 65. INT2_CFG_A register
AOI
6D
ZHIE
ZLIE
YHIE
YLIE
XHIE
XLIE
Table 66. INT2_CFG_A description
54/68
AOI
AND/OR combination of interrupt events. Default value: 0
(see Table 67)
6D
6-direction detection function enabled. Default value: 0. Refer to Table 67.
ZHIE
Enable interrupt generation on Z high event. Default value: 0
(0: disable interrupt request;
1: enable interrupt request on measured accel. value higher than preset threshold)
DocID027765 Rev 5
LSM303AGR
Register description
Table 66. INT2_CFG_A description (continued)
ZLIE
Enable interrupt generation on Z low event. Default value: 0
(0: disable interrupt request;
1: enable interrupt request on measured accel. value lower than preset threshold)
YHIE
Enable interrupt generation on Y high event. Default value: 0
(0: disable interrupt request;
1: enable interrupt request on measured accel. value higher than preset threshold)
YLIE
Enable interrupt generation on Y low event. Default value: 0
(0: disable interrupt request;
1: enable interrupt request on measured accel. value lower than preset threshold)
XHIE
Enable interrupt generation on X high event. Default value: 0
(0: disable interrupt request;
1: enable interrupt request on measured accel. value higher than preset threshold)
XLIE
Enable interrupt generation on X low event. Default value: 0
(0: disable interrupt request;
1: enable interrupt request on measured accel. value lower than preset threshold)
The content of this register is loaded at boot.
A write operation to this address is possible only after system boot.
Table 67. Interrupt mode
AOI
6D
Interrupt mode
0
0
OR combination of interrupt events
0
1
6-direction movement recognition
1
0
AND combination of interrupt events
1
1
6-direction position recognition
The difference between AOI-6D = ‘01’ and AOI-6D = ‘11’.
AOI-6D = ‘01’ is movement recognition. An interrupt is generated when the orientation
moves from an unknown zone to a known zone. The interrupt signal remains for a duration
ODR.
AOI-6D = ‘11’ is direction recognition. An interrupt is generated when the orientation is
inside a known zone. The interrupt signal remains while the orientation is inside the zone.
8.24
INT2_SRC_A (35h)
Table 68. INT2_SRC_A register
0
IA
ZH
ZL
DocID027765 Rev 5
YH
YL
XH
XL
55/68
68
Register description
LSM303AGR
Table 69. INT2_SRC_A description
IA
Interrupt active. Default value: 0
(0: no interrupt has been generated; 1: one or more interrupts have been generated)
ZH
Z high. Default value: 0
(0: no interrupt, 1: Z high event has occurred)
ZL
Z low. Default value: 0
(0: no interrupt; 1: Z low event has occurred)
YH
Y high. Default value: 0
(0: no interrupt, 1: Y high event has occurred)
YL
Y low. Default value: 0
(0: no interrupt, 1: Y low event has occurred)
XH
X high. Default value: 0
(0: no interrupt, 1: X high event has occurred)
XL
X low. Default value: 0
(0: no interrupt, 1: X low event has occurred)
Interrupt 2 source register. Read-only register.
Reading at this address clears the INT2_SRC_A (35h) IA bit (and the interrupt signal on the
INT2 pin) and allows the refresh of data in the INT2_SRC_A (35h) register if the latched
option was chosen.
8.25
INT2_THS_A (36h)
Table 70. INT2_THS_A register
0
THS6
THS5
THS4
THS3
THS2
THS1
THS0
D1
D0
Table 71. INT2_THS_A description
Interrupt 2 threshold. Default value: 000 0000
THS[6:0]
8.26
1 LSb = 16 mg @ FS = 2 g
1 LSb = 32 mg @ FS = 4 g
1 LSb = 62 mg @ FS = 8 g
1 LSb = 186 mg @ FS = 16 g
INT2_DURATION_A (37h)
Table 72. INT2_DURATION_A register
0
56/68
D6
D5
D4
DocID027765 Rev 5
D3
D2
LSM303AGR
Register description
Table 73. INT2_DURATION_A description
Duration value. Default value: 000 0000
1 LSb = 1/ODR(1)
D[6:0]
1. Duration time is measured in N/ODR, where N is the content of the duration register.
The D[6:0] bits set the minimum duration of the Interrupt 2 event to be recognized. Duration
time steps and maximum values depend on the ODR chosen.
8.27
CLICK_CFG_A (38h)
Table 74. CLICK_CFG_A register
--
--
ZD
ZS
YD
YS
XD
XS
Table 75. CLICK_CFG_A description
ZD
Enable interrupt double-click on Z-axis. Default value: 0
(0: disable interrupt request; 1: enable interrupt request on measured accel. value
higher than preset threshold)
ZS
Enable interrupt single-click on Z-axis. Default value: 0
(0: disable interrupt request; 1: enable interrupt request on measured accel. value
higher than preset threshold)
YD
Enable interrupt double-click on Y-axis. Default value: 0
(0: disable interrupt request; 1: enable interrupt request on measured accel. value
higher than preset threshold)
YS
Enable interrupt single-click on Y-axis. Default value: 0
(0: disable interrupt request; 1: enable interrupt request on measured accel. value
higher than preset threshold)
XD
Enable interrupt double-click on X-axis. Default value: 0
(0: disable interrupt request; 1: enable interrupt request on measured accel. value
higher than preset threshold)
XS
Enable interrupt single-click on X-axis. Default value: 0
(0: disable interrupt request; 1: enable interrupt request on measured accel. value
higher than preset threshold)
DocID027765 Rev 5
57/68
68
Register description
8.28
LSM303AGR
CLICK_SRC_A (39h)
Table 76. CLICK_SRC_A register
IA
DClick
SClick
Sign
Z
Y
X
Table 77. CLICK_SRC_A description
8.29
IA
Interrupt active. Default value: 0
(0: no interrupt has been generated; 1: one or more interrupts have been generated)
DClick
Double-click enable. Default value: 0 (0: double-click detection disabled,
1: double-click detection enabled)
SClick
Single-click enable. Default value: 0 (0: single-click detection disabled, 1: single-click
detection enabled)
Sign
Click sign. 0: positive detection, 1: negative detection
Z
Z click detection. Default value: 0
(0: no interrupt, 1: Z high event has occurred)
Y
Y click detection. Default value: 0
(0: no interrupt, 1: Y high event has occurred)
X
X click detection. Default value: 0
(0: no interrupt, 1: X high event has occurred)
CLICK_THS_A (3Ah)
Table 78. CLICK_THS_A register
-
Ths6
Ths5
Ths4
Ths3
Ths2
Ths1
Ths0
TLI1
TLI0
Table 79. CLICK_SRC_A description
Ths[6:0]
8.30
Click threshold. Default value: 000 0000
TIME_LIMIT_A (3Bh)
Table 80. TIME_LIMIT_A register
-
TLI6
TLI5
TLI4
TLI3
TLI2
Table 81. TIME_LIMIT_A description
TLI[6:0]
58/68
Click time limit. Default value: 000 0000
DocID027765 Rev 5
LSM303AGR
8.31
Register description
TIME_LATENCY_A (3Ch)
Table 82. TIME_LATENCY_A register
TLA7
TLA6
TLA5
TLA4
TLA3
TLA2
TLA1
TLA0
TW1
TW0
Acth1
Acth0
Table 83. TIME_LATENCY_A description
TLA[7:0]
8.32
Click time latency. Default value: 0000 0000
TIME_WINDOW_A (3Dh)
Table 84. TIME_WINDOW_A register
TW7
TW6
TW5
TW4
TW3
TW2
Table 85. TIME_WINDOW_A description
TW[7:0]
8.33
Click time window
Act_THS_A (3Eh)
Table 86. Act_THS_A register
--
Acth6
Acth5
Acth4
Acth3
Acth2
Table 87. Act_THS_A description
Acth[6:0]
8.34
Sleep-to-wake, return-to-sleep activation threshold in low-power mode
1 LSb = 16 mg @ FS = 2 g
1 LSb = 32 mg @ FS = 4 g
1 LSb = 62 mg @ FS = 8 g
1 LSb = 186 mg @ FS = 16 g
Act_DUR_A (3Fh)
Table 88. Act_DUR_A register
ActD7
ActD6
ActD5
ActD4
ActD3
ActD2
ActD1
ActD0
Table 89. Act_DUR_A description
ActD[7:0]
Sleep-to-wake, return-to-sleep duration
1 LSb = (8*1[LSb]+1)/ODR
DocID027765 Rev 5
59/68
68
Register description
8.35
LSM303AGR
OFFSET_X_REG_L_M (45h) and OFFSET_X_REG_H_M (46h)
These registers comprise a 16-bit register and represent X hard-iron offset in order to
compensate environmental effects (data in two’s complement). These values act on the
magnetic output data value in order to delete the environmental offset.
8.36
OFFSET_Y_REG_L_M (47h) and OFFSET_Y_REG_H_M (48h)
These registers comprise a 16-bit register and represent Y hard-iron offset in order to
compensate environmental effects (data in two’s complement). These values act on the
magnetic output data value in order to delete the environmental offset.
8.37
OFFSET_Z_REG_L_M (49h) and OFFSET_Z_REG_H_M (4Ah)
These registers comprise a 16-bit register and represent Z hard-iron offset in order to
compensate environmental effects (data in two’s complement). These values act on the
magnetic output data value in order to delete the environmental offset.
8.38
WHO_AM_I_M (4Fh)
The identification register is used to identify the device (read-only register).
0
8.39
1
0
0
0
0
0
0
CFG_REG_A_M (60h)
The configuration register is used to configure the output data rate and the measurement
configuration.
Table 90. CFG_REG_A_M register
0
0
SOFT_RST
LP
ODR1
ODR0
MD1
MD0
Table 91. CFG_REG_A_M register description
60/68
SOFT_RST
When this bit is set, the configuration registers and user registers are reset. Flash
registers keep their values.
LP
Low-power mode enable. Default: 0
0: high-resolution mode 1: low-power mode enabled
ODR[1:0]
Output data rate configuration (see Table 92: Output data rate configuration)
MD[1:0]
Mode select bit. These bits select the mode of operation of the device (see
Table 93: System mode)
DocID027765 Rev 5
LSM303AGR
Register description
Table 92. Output data rate configuration
ODR1
ODR0
ODR (Hz)
0
0
10 (default)
0
1
20
1
0
20
1
1
100
Table 93. System mode
MD1
8.40
MD0
Mode
0
0
Continuous mode. In continuous mode the device continuously
performs measurements and places the result in the data register.
The data-ready signal is generated when a new data set is ready to
be read. This signal can be available on the external pin by setting
the INT_MAG bit in CFG_REG_C_M (62h).
0
1
Single mode. When single mode is selected, the device performs a
single measurement, sets DRDY high and returns to idle mode.
Mode register return to idle mode bit values.
1
0
Idle mode. Device is placed in idle mode. I2C and SPI active.
1
1
Idle mode. Device is placed in idle mode. I2C and SPI active.
CFG_REG_B_M (61h)
Table 94. CFG_REG_B_M register
0
0
0
0
INT_on_
DataOFF
Set_FREQ
OFF_CANC
LPF
Table 95. CFG_REG_B_M register description
INT_on_
DataOFF
If ‘1’, the interrupt block recognition checks data after the hard-iron correction to
discover the interrrupt.
Set_FREQ
Selects the frequency of the set pulse.
0: set pulse is released every 63 ODR; 1: set pulse is release only at power-on
after PD condition.
OFF_CANC
Enables offset cancellation.
LPF
Low-pass filter enable (see Table 96)
0: digital filter disabled; 1: digital filter enabled
Table 96. Digital low-pass filter
CFG_REG_B[LPF]
BW [Hz]
0 (disable)
ODR/2
1 (enable)
ODR/4
DocID027765 Rev 5
61/68
68
Register description
8.41
LSM303AGR
CFG_REG_C_M (62h)
Table 97. CFG_REG_C_M register
0
INT_MAG
_PIN
I2C_DIS
BDU
BLE
0(1)
Self_test
INT_MAG
1. This bit must be set to ‘0’ for the correct operation of the device.
Table 98. CFG_REG_C_M register description
8.42
INT_MAG_PIN
If '1', the INTERRUPT signal (INT bit inside INT_SOURCE_REG_M (64h)) is
driven on INT_MAG_PIN
I2C_DIS
If ‘1’, the I2C interface is inhibited. Only the SPI interface can be used.
BDU
If enabled, reading of incorrect data is avoided when the user reads asynchronously. In fact if the read request arrives during an update of the output data, a
latch is possible, reading incoherent high and low parts of the same register. Only
one part is updated and the other one remains old.
BLE
If ‘1’, an inversion of the low and high parts of the data occurs.
Self_test
If ‘1’, the self-test is enabled.
INT_MAG
If ‘1’, the DRDY pin is configured as a digital output.
INT_CTRL_REG_M (63h)
The interrupt control register is used to enable and to configure the interrupt recognition.
Table 99. INT_CRTL_REG_M register
XIEN
YIEN
ZIEN
0(1)
0(1)
IEA
IEL
IEN
1. This bit must be set to ‘0’ for the correct operation of the device.
Table 100. INT_CTRL_REG_M register description
62/68
XIEN
Enables the interrupt recognition for the X-axis. Default: 0
1: enabled; 0: disabled.
YIEN
Enables the interrupt recognition for the Y-axis. Default: 0
1: enabled; 0: disabled.
ZIEN
Enables the interrupt recognition for the Z-axis. Default: 0
1: enabled; 0: disabled.
IEA
Controls the polarity of the INT bit (INT_SOURCE_REG_M (64h)) when an interrupt
occurs. Default: 0
If IEA = 0, then INT = 0 signals an interrupt
If IEA = 1, then INT = 1 signals an interrupt
IEL
Controls whether the INT bit (INT_SOURCE_REG_M (64h)) is latched or pulsed.
Default: 0
If IEL = 0, then INT is pulsed.
If IEL = 1, then INT is latched.
Once latched, INT remains in the same state until INT_SOURCE_REG_M (64h) is read.
IEN
Interrupt enable. When set, enables the interrupt generation. The INT bit
is in INT_SOURCE_REG_M (64h). Default: 0
DocID027765 Rev 5
LSM303AGR
8.43
Register description
INT_SOURCE_REG_M (64h)
When interrupt latched is selected, reading this register resets all the bits in this register.
Table 101. INT_SOURCE_REG_M register
P_TH_S_
X
P_TH_S_
Y
P_TH_S_
Z
N_TH_S_
X
N_TH_S_
Y
N_TH_S_
Z
MROI
INT
Table 102. INT_SOURCE_REG_M register description
8.44
P_TH_S_X
X-axis value exceeds the threshold positive side
P_TH_S_Y
Y-axis value exceeds the threshold positive side
P_TH_S_Z
Z-axis value exceeds the threshold positive side
N_TH_S_X
X-axis value exceeds the threshold negative side
N_TH_S_Y
Y-axis value exceeds the threshold negative side
N_TH_S_Z
Z-axis value exceeds the threshold negative side
MROI
MROI flag generation is alway enabled.This flag is reset by reading
INT_SOURCE_REG_M (64h).
INT
This bit signals when the interrupt event occurs.
INT_THS_L_REG_M (65h)
This register contains the least significant bits of the threshold value chosen for the interrupt.
Table 103. INT_THS_L_REG_M register
TH7
THS6
TH5
TH4
TH3
TH2
TH1
TH0
Table 104. INT_THS_L_REG_M register description
TH[7:0]
8.45
Threshold value for the interrupt.
INT_THS_H_REG_M (66h)
This register contains the most significant bits of the threshold value chosen for the
interrupt.
Table 105. INT_THS_H_REG_M register
TH7
THS6
TH5
TH4
TH3
TH2
TH1
TH0
Table 106. INT_THS_H_REG_M register description
TH[7:0]
Threshold value for the interrupt.
These registers set the threshold value for the output to generate the interrupt (INT bit in
INT_SOURCE_REG_M (64h)). This threshold is common to all three (axes) output values
and is unsigned unipolar. The threshold value is correlated to the current gain and it is
unsigned because the threshold is considered as an absolute value, but crossing the
threshold is detected for both positive and negative sides.
DocID027765 Rev 5
63/68
68
Register description
8.46
LSM303AGR
STATUS_REG_M (67h)
The status register is an 8-bit read-only register. This register is used to indicate device
status. SR0 through SR7 indicate bit locations, with SR denoting the bits that are in the
status register. SR7 denotes the first bit of the data stream.
Table 107. STATUS_REG_M register
Zyxor
zor
yor
xor
Zyxda
zda
yda
xda
Table 108. STATUS_REG_M register description
8.47
Zyxor
X-, Y- and Z-axis data overrun. Default value: 0
(0: no overrun has occurred; 1: a new set of data has overwritten the previous set).
zor
Z-axis data overrun. Default value: 0
(0: no overrun has occurred; 1: new data for the Z-axis has overwritten the previous data).
yor
Y-axis data overrun. Default value: 0
(0: no overrun has occurred; 1: new data for the Y-axis has overwritten the previous data).
xor
X-axis data overrun. Default value: 0
(0: no overrun has occurred; 1: new data for the X-axis has overwritten the previous data).
Zyxda
X-, Y- and Z-axis new data available. Default value: 0
(0: a new set of data is not yet available; 1: a new set of data is available).
zda
Z-axis new data available. Default value: 0
(0: a new data for the Z-axis is not yet available; 1: a new data for the Z-axis is available)
yda
Y-axis new data available. Default value: 0
(0: a new data for the Y-axis is not yet available; 1: a new data for the Y-axis is available)
xda
X-axis new data available. Default value: 0
(0: a new data for the X-axis is not yet available; 1: a new data for the X-axis is available)
OUTX_L_REG_M, OUTX_H_REG_M (68h - 69h)
The data output X registers are two 8-bit registers, data output ch1 MSB register (69h) and
output X LSB register (68h).
The output data represents the raw magnetic data only if OFFSET_X_REG is equal to zero,
otherwise hard-iron calibration is included.
Table 109. OUTX_L_REG_M register
0
0
0
0
0
0
0
0
0
0
0
0
Table 110. OUTX_H_REG_M register
0
0
0
0
The value of the magnetic field is expressed in two’s complement. This register contains the
X component of the magnetic data.
64/68
DocID027765 Rev 5
LSM303AGR
8.48
Register description
OUTY_L_REG_M, OUTY_H_REG_M (6Ah - 6Bh)
The data output Y registers are two 8-bit registers, data output ch1 MSB register (6Bh) and
output Y LSB register (6Ah).
The output data represents the raw magnetic data only if OFFSET_Y_REG is equal to zero,
otherwise hard-iron calibration is included.
Table 111. OUTY_L_REG_M register
0
0
0
0
0
0
0
0
0
0
0
0
Table 112. OUTY_H_REG_M register
0
0
0
0
The value of the magnetic field is expressed in two’s complement. This register contains the
Y component of the magnetic data.
8.49
OUTZ_L_REG_M, OUTZ_H_REG_M (6Ch - 6Dh)
The data output Zregisters are two 8-bit registers, data output ch1 MSB register (6Bh) and
output Z LSB register (6Ah).
The output data represents the raw magnetic data only if OFFSET_Z_REG is equal to zero,
otherwise hard-iron calibration is included.
Table 113. OUTZ_L_REG_M register
0
0
0
0
0
0
0
0
0
0
Table 114. OUTZ_H_REG_M register
0
0
0
0
0
0
The value of the magnetic field is expressed in two’s complement. This register contains the
Z component of the magnetic data.
DocID027765 Rev 5
65/68
68
Package information
9
LSM303AGR
Package information
In order to meet environmental requirements, ST offers these devices in different grades of
ECOPACK® packages, depending on their level of environmental compliance. ECOPACK®
specifications, grade definitions and product status are available at: www.st.com.
ECOPACK is an ST trademark.
9.1
LGA-12 package information
Figure 17. LGA-12 2x2x1 mm package outline and mechanical data
'LPHQVLRQVDUHLQPLOOLPHWHUXQOHVVRWKHUZLVHVSHFLILHG
*HQHUDO7ROHUDQFHLVPPXQOHVVRWKHUZLVHVSHFLILHG
287(5',0(16,216
,7(0
/HQJWK>/@
: LGWK>: @
+HLJKW>+@
',0(16,21>PP@
72/(5$1&(>PP@
“
“
0$;
B
66/68
DocID027765 Rev 5
LSM303AGR
10
Revision history
Revision history
Table 115. Document revision history
Date
Revision
12-May-2015
1
Initial release
2
Updated Description to include fast mode plus and high speed I2C
interface
Added Table 8: I2C slave timing values (fast mode plus and high speed)
26-Aug-2015
3
Added footnote 3 to Table 3: Sensor characteristics
Added values for M_ST in Table 3: Sensor characteristics
Updated Figure 17: LGA-12 2x2x1 mm package outline and mechanical
data
06-Oct-2015
4
Updated Table 3: Sensor characteristics
Added Section 4.1.5: Magnetometer self-test and updated
Section 4.2.4: Accelerometer self-test
18-Nov-2015
5
Initial public release
10-Jun-2015
Changes
DocID027765 Rev 5
67/68
68
LSM303AGR
IMPORTANT NOTICE – PLEASE READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on
ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or
the design of Purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
© 2015 STMicroelectronics – All rights reserved
68/68
DocID027765 Rev 5
Similar pages