This document is intended to provide usage information and application hints related to ST’s LIS2DW12 motion sensor.
The LIS2DW12 is a 3D digital accelerometer system-in-package with a digital I²C/SPI serial interface standard output,
performing at 90 µA in high-resolution mode and below 1 µA in low-power mode. Thanks to the ultra-low noise performance
of the accelerometer, the device combines always-on low-power features with superior sensing precision for an optimal motion
experience for the consumer. Furthermore, the accelerometer features smart sleep-to-wakeup (activity) and return-to-sleep
(inactivity) functions that allow advanced power saving.
The device has a dynamic user-selectable full-scale acceleration range of ±2/±4/±8/±16 g and is capable of measuring
accelerations with output data rates from 1.6 Hz to 1600 Hz. The LIS2DW12 can be configured to generate interrupt signals
by using hardware recognition of free-fall events, 6D orientation, tap and double-tap sensing, activity or inactivity, and wake-up
events.
The LIS2DW12 has an integrated 32-level first-in, first-out (FIFO) buffer allowing the user to store data in order to limit
intervention by the host processor.
The LIS2DW12 is available in a small thin plastic land grid array package (LGA) and it is guaranteed to operate over an
extended temperature range from -40 °C to +85 °C.
The ultra-small size and weight of the SMD package make it an ideal choice for handheld portable applications such as
smartphones, IoT connected devices, and wearables or any other application where reduced package size and weight are
required.
AN5038 - Rev 5 - January 2021
For further information contact your local STMicroelectronics sales office.
www.st.com
1Pin description
AN5038
Pin description
Figure 1. Pin connections
Table 1. Internal pin status
NameFunctionPin status
Pin #
SCL
1
2CS
3
4
5NCInternally not connected. Can be tied to VDD, VDDIO, or GND.
6GND0 V supply
7RESConnect to GND
8GND0 V supply
9VDDPower supply
10VDD_IO Power supply for I/O pins
11INT2
12INT1Interrupt pin 1Default: push-pull output forced to ground
1. In order to disable the internal pull-up on the CS pin, write '1' to the CS_PU_DISC bit in CTRL2 (21h).
2. Internal pull-up on SDO/SA0 pin cannot be disabled: do not connect this pin to GND in low-power applications.
I²C serial clock (SCL)
SPC
SPI serial port clock (SPC)
SPI enable
I²C/SPI mode selection
1: SPI idle mode / I²C communication enabled
0: SPI communication mode / I²C disabled
SDO
Serial data output (SDO)
SA0
I²C less significant bit of the device address (SA0)
SDA
I²C serial data (SDA)
SDI
SPI serial data input (SDI)
SDO
3-wire interface serial data output (SDO)
Interrupt pin 2
Clock input when selected in single data conversion on demand.
These operating modes are selected by writing the MODE[1:0] and LP_MODE[1:0] bits in CTRL1 (20h) shown in
the table below.
AN5038
Operating modes
Table 3. Accelerometer resolution
Table 4. CTRL1 register
b7b6b5b4b3b2b1b0
ODR3ODR2ODR1ODR0MODE1MODE0LP_MODE1LP_MODE0
Table 5. Mode selection
MODE[1:0]
00Low-Power Mode (12/14-bit resolution)
01High-Performance Mode (14-bit resolution)
10Single data conversion on-demand mode (12/14-bit resolution)
11Not allowed
Mode and resolution
Table 6. Low-power mode selection
LP_MODE[1:0]
00Low-Power Mode 1 (12-bit resolution)
01Low-Power Mode 2 (14-bit resolution)
10Low-Power Mode 3 (14-bit resolution)
11Low-Power Mode 4 (14-bit resolution)
Mode and resolution
AN5038 - Rev 5
From each of these five sets, two configurations have been designed:
•Very low-power(low-noise off)
•Low-noise
Writing the LOW_NOISE bit in CTRL6 (25h) selects the desired configuration. The LOW_NOISE bit in CTRL6
(25h) impacts front-end noise and current consumption. Bandwidths and settling time are not impacted.
page 5/51
Table 7 shows the typical values of power consumption for the different operating modes.
Note: In Low-Power Mode the RMS noise is the same for all ODRs.
AN5038 - Rev 5
page 6/51
3.2Continuous conversion
When bits MODE[1:0] in CTRL1 (20h) are set to Low-Power mode (00b) or High-Performance mode (01b), the
device is in continuous conversion and the output data rate can be selected through the ODR[3:0] bits in CTRL1
(20h).
This mode is available only for low-power modes and it is enabled by writing the MODE[1:0] bits to ‘10' in CTRL1
(20h).
In this configuration the device waits for a trigger signal in order to generate new data according to the selected
power mode LP_MODE[1:0] bits in CTRL1 (20h), after that the device immediately enters power-down.
The trigger can be:
•A rising edge on the INT2 pin (if SLP_MODE_SEL = ‘0' in register CTRL3 (22h)). In this case the
user can detect the end of the conversion using the DRDY bit of the STATUS register (27h) that can also
be routed to the INT1 pin by setting the INT1_DRDY bit to 1 in register CTRL4_INT1_PAD_CTRL (23h).
Minimum duration of trigger signal high level is 20 ns.
•A write of SLP_MODE_1 to ‘1' in register CTRL3 (22h) (if SLP_MODE_SEL ='1' in register CTRL3(22h)). In this case, the user can detect the end of the conversion using the DRDY bit/signal as in the
previous case, or by checking when the SLP_MODE_1 bit in register CTRL3 (22h) is automatically cleared.
Figure 2. Single data conversion using INT2 as external trigger (SLP_MODE_SEL = 0)
AN5038
Single data conversion (on-demand mode)
The maximum data rate using single data conversion mode is 200 Hz and the time of conversion depends on the
low-power mode selected (refer to the following table).
Table 11. Low-power mode selection
Low-power
Mode 11.20 ms
Mode 21.70 ms
Mode 32.30 ms
Mode 43.55 ms
Typical time of conversion
(T_on)
Note: If the ODR[3:0] bits of the CTRL1 register are set to 0000b, the accelerometer is permanently configured in
Power-down mode and no conversion can be triggered. When the single data conversion mode has to be used,
the ODR[3:0] bits of the CTRL1 register must be different than 0000b.
Interrupts, embedded features and FIFO are still supported when using single data conversion mode. Also the
embedded filters LPF1, LPF2 and HP are available in single data conversion (on-demand mode) with the same
bandwidth and settling time of the selected low-power mode (see Section 3.4 Accelerometer bandwidth for
details).
AN5038 - Rev 5
page 8/51
3.4Accelerometer bandwidth
The accelerometer sampling chain (Figure 3. Accelerometer filtering chain diagram) is represented by a cascade
of a few blocks:
•ADC: Analog-to-digital converter
•Anti-Aliasing Filter: available only in High-Performance Mode (MODE[1:0] = 01) with a cutoff frequency of
400 Hz
•LPF1(2): low-pass filter 1(2)
•HP: high-pass filter
•User offset: configurable values that are subtracted from the sampled data (one for each axis)
Figure 3. Accelerometer filtering chain diagram
AN5038
Accelerometer bandwidth
As shown in the figure above, data can be generated using three different filter paths:
•only LPF1 (green path) : in order to select this path set BW_FILT[1:0] = 00 and FDS = 0. Additional details in
Table 12. Low-pass filter 1 bandwidth.
•LPF1 + LPF2 (purple path) : in order to select this path set BW_FILT[1:0] to a value different from 00 and
FDS = 0. Additional details in Table 13. Bandwidth: low-pass path.
•LPF1 + HP (blue path): these outputs are available by setting FDS = 1. Additional details in
Table 14. Bandwidth: high-pass path.
AN5038 - Rev 5
page 9/51
AN5038
Accelerometer bandwidth
Table 12. Low-pass filter 1 bandwidth
BW_FILT[1:0] = 00
ModeODR selection
Samples to discard
Settling @95%
Low-Power Mode 4@ each ODR
0180
Low-Power Mode 3@ each ODR0360
Low-Power Mode 2@ each ODR0720
Low-Power Mode 1@ each ODR03200
High-Performance@12.5 Hz0ODR/2
High-Performance@25 Hz0ODR/2
High-Performance@50 Hz0ODR/2
High-Performance@100 Hz1ODR/2
High-Performance@200 Hz1ODR/2
High-Performance@400 Hz1ODR/2
High-Performance@800 Hz1ODR/2
High-Performance@1600 Hz2400
1. The starting condition of ODR[3:0], MODE[1:0], LP_MODE[1:0] and BW_FILT[1:0] do not impact these values. The turn-on
time (first sample available starting from power-down condition) is 1 / ODR.
1. The starting condition of ODR[3:0], MODE[1:0], LP_MODE[1:0] and BW_FILT[1:0] do not impact these values.
(1)
Cutoff
Samples to discard
[Hz]
Settling @95%
(1)
Cutoff
[Hz]
Setting USR_OFF_ON_OUT = 1 in CTRL7 does not change the bandwidth of the system. In this configuration,
the values written in registers X_OFS_USR, Y_OFS_USR, Z_OFS_USR are subtracted from the respective axis.
The offset values are signed values (two's complement).
The weight of the bits in registers X_OFS_USR, Y_OFS_USR, Z_OFS_USR is defined through the USR_OFF_W
bit in CTRL7.
AN5038 - Rev 5
page 11/51
3.5High-pass filter configuration
The LIS2DW12 provides an embedded high-pass filtering capability to easily delete the DC component of the
measured acceleration. As shown in Figure 3. Accelerometer filtering chain diagram, through the FDS bit in
register CTRL6 the user can route the filter outputs to the output registers.
It is also possible to independently apply the filter to the embedded function data (Figure 6. Embedded functions
in Section 5 Interrupt generation and embedded functions). This means that it is possible to get filtered data
while the interrupt generation works on unfiltered data.
The high-pass filter can be configured in reference mode by setting the HP_REF_MODE bit in the CTRL7 register
to 1. In this configuration the output data is calculated as the difference between the measured acceleration and
the output values captured when reference mode was enabled. In this way only the difference is applied without
any filtering.
As an example, this feature can be combined with the wake-up functionality described in Section 5.4 in order
to detect when the device is displaced with respect to a specific orientation, i.e. the orientation of the device
when the HP_REF_MODE bit was set to 1. When the output acceleration exceeds the wake-up threshold defined
by the WK_THS[5:0] bits in the WAKE_UP_THS register for a duration longer than the one defined by the
WAKE_DUR[1:0] bits in the WAKE_UP_DUR register, an interrupt is generated. If the device is moved back to the
original reference orientation, the interrupt is deactivated.
Figure 4. High-pass filter in normal and reference mode
AN5038
High-pass filter configuration
AN5038 - Rev 5
page 12/51
4Reading output data
4.1Startup sequence
Once the device is powered up, it automatically downloads the calibration coefficients from the embedded
non-volatile memory to the internal registers. When the boot procedure is completed, i.e. after approximately
20 milliseconds, the accelerometer automatically enters power-down. The default status of the pins with both VDD
and VDDIO "on" is indicated in Table 1. Internal pin status.
Note: VDD cannot be lower than VDDIO. VDD = 0 V and VDDIO "on" is allowed: when this power supply
configuration is applied, an internal pull-up is applied also to the SDA and SCL pins (the other pins maintain the
default status indicated in Table 1).
To turn on the accelerometer and gather acceleration data, it is necessary to select one of the operating modes
through the CTRL1 register.
Refer to Section 3 Operating modes for a detailed description of data generation.
4.2Using the status register
The device is provided with a STATUS register which can be polled to check when a new set of data is available.
The DRDY bit is set to 1 when a new set of data is available from the accelerometer output.
The read operations should be performed as follows:
1.Read STATUS
2.If DRDY = 0, then go to 1
3.Read OUT_X_L
4.Read OUT_X_H
5.Read OUT_Y_L
6.Read OUT_Y_H
7.Read OUT_Z_L
8.Read OUT_Z_H
9.Data processing
10. Go to 1
AN5038
Reading output data
4.3Using the data-ready signal
The device can be configured to have one hardware signal to determine when a new set of measurement data is
available to be read.
The data-ready signal is derived from the DRDY bit of the STATUS register. The signal can be driven to the INT1
pin by setting the INT1_DRDY bit of the CTRL4_INT1_PAD_CTRL register to 1 and to the INT2 pin by setting the
INT2_DRDY bit of the CTRL5_INT2_PAD_CTRL register to 1.
The data-ready signal rises to 1 when a new set of data has been measured and is available to be read. In
DRDY latched mode (DRDY_PULSED bit = 0 in CTRL7 register), which is the default condition, the signal gets
reset when the higher part of one of the channels has been read (29h, 2Bh, 2Dh). In DRDY pulsed mode
(DRDY_PULSED = 1) the pulse duration is 75 μs (typical) if the accelerometer is configured in High-Performance
mode, otherwise it can vary between 105 μs and 175 μs. Pulsed mode is not applied to the DRDY bit which is
always latched.
AN5038 - Rev 5
page 13/51
Figure 5. Data-ready signal
4.4Using the block data update (BDU) feature
If reading the accelerometer data is particularly slow and cannot be synchronized (or it is not required) with either
the DRDY event bit in the STATUS register or with the DRDY signal driven to the INT1/INT2 pins, it is strongly
recommended to set the BDU (block data update) bit to 1 in the CTRL2 (21h) register.
This feature avoids reading values (most significant and least significant parts of output data) related to different
samples. In particular, when the BDU is activated, the data registers related to each channel always contain
the most recent output data produced by the device, but, in case the read of a given pair (i.e. OUT_X_H and
OUT_X_L, OUT_Y_H and OUT_Y_L, OUT_Z_H and OUT_Z_L) is initiated, the refresh for that pair is blocked
until both MSB and LSB parts of the data are read.
Note: BDU only guarantees that the LSB part and MSB part of one data channel have been sampled at the same
moment. For example, if the reading speed is too slow, X and Y can be read at T1 and Z sampled at T2.
AN5038
Using the block data update (BDU) feature
4.5Understanding output data
The measured acceleration data are sent to the OUT_X_H, OUT_X_L, OUT_Y_H, OUT_Y_L, OUT_Z_H, and
OUT_Z_L registers. These registers contain, respectively, the most significant part and the least significant part of
the acceleration signals acting on the X, Y, and Z axes.
The complete output data for the X, Y, Z channels is given by the concatenation OUT_X_H & OUT_X_L,
OUT_Y_H & OUT_Y_L , OUT_Z_H & OUT_Z_L.
Acceleration data is represented as 16-bit numbers, left-aligned and encoded in two’s complement. These values
(LSB) have different resolution according to the selected operating mode.
After calculating the LSB, it must be multiplied by the proper sensitivity parameter to obtain the corresponding
value in mg.
Full Scale
±2 g
±4 g1.9520.488
±8 g3.9040.976
1. Only Low-Power Mode 1
±16 g7.8081.952
Table 15. Sensitivity
Sensitivity [mg/LSB]
12-bit format
0.9760.244
(1)
14-bit format
AN5038 - Rev 5
page 14/51
4.5.1Example of output data
Below is a simple example of how to use the LSB data and transform it into mg.
The values are given under the hypothesis of ideal device calibration (i.e., no offset, no gain error, etc.).
Get raw data from the sensor (High-Performance mode, ±2 g):
OUT_X_L: 60h
OUT_X_H: FDh
OUT_Y_L: 78h
OUT_Y_H: 00h
OUT_Z_L: FCh
OUT_Z_H: 42h
Do register concatenation:
AN5038
Understanding output data
OUT_X_H & OUT_X_L: FD60h
OUT_Y_H & OUT_Y_L: 0078h
OUT_Z_H & OUT_Z_L: 42FCh
Apply sensitivity (e.g., 14-bit resolution, 0.244 at full scale ±2 g):
X: -672 / 4 * 0.244 = -41 mg
Y: +120 / 4 * 0.244 = +7 mg
Z: +17148 / 4 * 0.244 = +1046 mg
AN5038 - Rev 5
page 15/51
Interrupt generation and embedded functions
5Interrupt generation and embedded functions
Figure 6. Embedded functions
AN5038
In order to generate an interrupt, the LIS2DW12 device has to be set in an active operating mode (not in
power-down) because generation of the interrupt is based on accelerometer data.
The interrupt generator can be configured to detect:
•Free-fall;
•Wake-up;
•6D/4D orientation detection;
•Single-tap and double-tap sensing;
•Activity/Inactivity detection.
All these interrupt signals, together with the FIFO interrupt signals and sensor data-ready, can be driven to the
INT1 and/or INT2 interrupt pins or checked by reading the dedicated source register bits.
The H_LACTIVE bit of the CTRL3 register must be used to select the polarity of the interrupt pins. If this bit
is set to 0 (default value), the interrupt pins are active high and they change from low to high level when the
related interrupt condition is verified. Otherwise, if the H_LACTIVE bit is set to 1 (active low), the interrupt pins are
normally at high level and they change from high to low when the interrupt condition is reached.
The PP_OD bit of CTRL3 allows changing the behavior of the interrupt pins also when the DRDY signal is routed
to them from push-pull to open drain. If the PP_OD bit is set to 0, the interrupt pins are in push-pull configuration
(low-impedance output for both high and low level). When the PP_OD bit is set to 1, only the interrupt active state
is a low-impedance output.
The LIR bit of CTRL3 allows applying the latched mode to the interrupt signals (not affecting the DRDY signal).
When the LIR bit is set to 1, once the interrupt pin is asserted, it must be reset by reading the related interrupt
source register. If the LIR bit is set to 0, the interrupt signal is automatically reset when the interrupt condition is
no longer verified or after a certain amount of time in function of the type of interrupt.
Note: If latched mode is enabled (LIR = 1), it is not recommended to continuously poll ALL_INT_SRC or the
dedicated source registers because by reading them the embedded functions are internally reset; a synchronous
(with interrupt event) read of the source registers is recommended in this case.
AN5038 - Rev 5
page 16/51
Loading...
+ 35 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.