|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
this is information on a product in full production. may 2017 docid025056 rev 6 1/53 LIS2DH12 mems digital output motion sensor: ultra-low-power high-performance 3-axis "femto" accelerometer datasheet - production data features ? wide supply voltage, 1.71 v to 3.6 v ? independent io supply (1.8 v) and supply voltage compatible ? ultra-low power consumption down to 2 a ?? 2 g /4 g / ? 8 g / ? 16 g selectable full scales ? i 2 c/spi digital output interface ? 2 independent programmable interrupt generators for free-fall and motion detection ? 6d/4d orientation detection ? ?sleep-to-wake? and ?return-to-sleep? functions ? free-fall detection ? motion detection ? embedded temperature sensor ? embedded fifo ? ecopack ? , rohs and ?green? compliant applications ? motion-activated functions ? display orientation ? shake control ? pedometer ? gaming and virtual reality input devices ? impact recognition and logging description the LIS2DH12 is an ultra-low-power high- performance three-axis linear accelerometer belonging to the ?femto? family with digital i 2 c/spi serial interface standard output. the LIS2DH12 has user-selectable full scales of ? 2 g /4 g / ? 8 g / ? 16 g and is capable of measuring accelerations with output data rates from 1 hz to 5.3 khz. the self-test capability allows the user to check the functionality of the sensor in the final application. the device may be configured to generate interrupt signals by detecting two independent inertial wake-up/free-fall events as well as by the position of the device itself. the LIS2DH12 is available in a small thin plastic land grid array package (lga) and is guaranteed to operate over an extended temperature range from -40 c to +85 c. / * $ [ [ p p table 1. device summary order code temp. range [ ? c] package packaging LIS2DH12tr -40 to +85 lga-12 tape and reel www.st.com
contents LIS2DH12 2/53 docid025056 rev 6 contents 1 block diagram and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.1 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 mechanical and electrical specifications . . . . . . . . . . . . . . . . . . . . . . . 10 2.1 mechanical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 temperature sensor characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3 electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.4 communication interface characteristics . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4.1 spi - serial peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4.2 i 2 c - inter-ic control interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.5 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3 terminology and functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1 terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.1 sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.1.2 zero-g level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.2 functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.2.1 high-resolution, normal mode, low-power mode . . . . . . . . . . . . . . . . . . 16 3.2.2 self-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2.3 6d / 4d orientation detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.2.4 ?sleep-to-wake? and ?return-to-sleep? . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3 sensing element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.4 ic interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.5 factory calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.6 fifo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.7 temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4 application hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4.1 soldering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5 digital main blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.1 fifo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 docid025056 rev 6 3/53 LIS2DH12 contents 53 5.1.1 bypass mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.1.2 fifo mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.1.3 stream mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.1.4 stream-to-fifo mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.1.5 retrieving data from fifo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6 digital interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 6.1 i 2 c serial interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 6.1.1 i 2 c operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.2 spi bus interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.2.1 spi read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 6.2.2 spi write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 6.2.3 spi read in 3-wire mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7 register mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 8 register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.1 status_reg_aux (07h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.2 out_temp_l (0ch), out_temp_h (0dh) . . . . . . . . . . . . . . . . . . . . . . 33 8.3 who_am_i (0fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.4 ctrl_reg0 (1eh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 8.5 temp_cfg_reg (1fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 8.6 ctrl_reg1 (20h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 8.7 ctrl_reg2 (21h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.8 ctrl_reg3 (22h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.9 ctrl_reg4 (23h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 8.10 ctrl_reg5 (24h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 8.11 ctrl_reg6 (25h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 8.12 reference (26h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 8.13 status_reg (27h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 8.14 out_x_l (28h), out_x_h (29h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 8.15 out_y_l (2ah), out_y_h (2bh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 8.16 out_z_l (2ch), out_z_h (2dh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 8.17 fifo_ctrl_reg (2eh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 8.18 fifo_src_reg (2fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 contents LIS2DH12 4/53 docid025056 rev 6 8.19 int1_cfg (30h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 8.20 int1_src (31h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 8.21 int1_ths (32h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 8.22 int1_duration (33h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 8.23 int2_cfg (34h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 8.24 int2_src (35h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 8.25 int2_ths (36h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 8.26 int2_duration (37h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 8.27 click_cfg (38h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 8.28 click_src (39h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 8.29 click_ths (3ah) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 8.30 time_limit (3bh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 8.31 time_latency (3ch) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 8.32 time_window (3dh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 8.33 act_ths (3eh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 8.34 act_dur (3fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 9 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 9.1 lga-12 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 9.2 lga-12 packing information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 10 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 docid025056 rev 6 5/53 LIS2DH12 list of tables 53 list of tables table 1. device summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 table 3. internal pull-up values (typ.) for sdo/sa0 pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 table 4. mechanical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 table 5. temperature sensor characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 table 6. electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 table 7. spi slave timing values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 table 8. i 2 c slave timing values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 table 9. absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 table 10. operating mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 table 11. turn-on time for operating mode transition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 table 12. current consumption of operating modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 table 13. internal pin status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 table 14. serial interface pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 table 15. i 2 c terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 table 16. sad+read/write patterns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 table 17. transfer when master is writing one byte to slave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 table 18. transfer when master is writing multiple bytes to slave . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 table 19. transfer when master is receiving (reading) one byte of data from slave . . . . . . . . . . . . . 26 table 20. transfer when master is receiving (reading) multiple bytes of data from slave . . . . . . . . . 26 table 21. register address map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 table 22. status_reg_aux register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 table 23. status_reg_aux description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 24. who_am_i register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 25. ctrl_reg0 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 26. ctrl_reg0 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 table 27. temp_cfg_reg register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 table 28. temp_cfg_reg description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 29. ctrl_reg1 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 30. ctrl_reg1 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 31. data rate configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 table 32. ctrl_reg2 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 table 33. ctrl_reg2 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 table 34. high-pass filter mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 table 35. ctrl_reg3 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 table 36. ctrl_reg3 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 table 37. ctrl_reg4 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 table 38. ctrl_reg4 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 table 39. self-test mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 table 40. ctrl_reg5 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 table 41. ctrl_reg5 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 table 42. ctrl_reg6 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 table 43. ctrl_reg6 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 table 44. reference register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 table 45. reference description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 table 46. status_reg register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 table 47. status_reg description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 table 48. fifo_ctrl_reg register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 list of tables LIS2DH12 6/53 docid025056 rev 6 table 49. fifo_ctrl_reg description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 0 table 50. fifo mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 table 51. fifo_src_reg register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41 table 52. fifo_src_reg description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 table 53. int1_cfg register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 table 54. int1_cfg description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 table 55. interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 table 56. int1_src register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 table 57. int1_src description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 table 58. int1_ths register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 table 59. int1_ths description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 table 60. int1_duration register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43 table 61. int1_duration description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 table 62. int2_cfg register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 table 63. int2_cfg description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 table 64. interrupt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 table 65. int2_src register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 table 66. int2_src description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 table 67. int2_ths register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 table 68. int2_ths description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 table 69. int2_duration register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 table 70. int2_duration description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 table 71. click_cfg register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 table 72. click_cfg description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 table 73. click_src register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 table 74. click_src description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 table 75. click_ths register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 table 76. click_ths register description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 table 77. time_limit register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 table 78. time_limit description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 table 79. time_latency register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 80. time_latency description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 81. time_window register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 82. time_window description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 83. act_ths register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 84. act_ths description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 85. act_dur register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 86. act_dur description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 table 87. reel dimensions for carrier tape of lga-12 package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 table 88. document revision history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 docid025056 rev 6 7/53 LIS2DH12 list of figures 53 list of figures figure 1. block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 2. pin connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 3. spi slave timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 4. i 2 c slave timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 5. LIS2DH12 electrical connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 figure 6. read and write protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 figure 7. spi read protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 8. multiple byte spi read protocol (2-byte example) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 9. spi write protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 10. multiple byte spi write protocol (2-byte example). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 11. spi read protocol in 3-wire mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 figure 12. lga-12: package outline and mechanical data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 figure 13. carrier tape information for lga-12 package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 figure 14. lga-12 package orientation in carrier tape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 figure 15. reel information for carrier tape of lga-12 package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 block diagram and pin description LIS2DH12 8/53 docid025056 rev 6 1 block diagram and pin description 1.1 block diagram figure 1. block diagram 1.2 pin description figure 2. pin connections charge amplifier y+ z+ y- z- a x+ x- i2c spi cs scl/spc sda/sdi/sdo sdo/sa0 control logic & interrupt gen. int 1 clock trimming circuits temperature self test control a/d converter int 2 mux 32 level fifo logic sensor am10218v2 (top view) direction of the detectable accelerations y 1 x z vdd_io sc l/spc sda/sdi/sdo cs sdo/sa0 res gnd int1 int2 res vdd res (bottom view) pin 1 indicator 4 1 5 7 11 8 res res 12 14 gnd sc l/spc sda/sdi/sdo cs sdo/sa0 gnd res int 1 vdd_io (bottom view) 4 1 5 6 gnd 11 int 2 7 10 vdd 12 docid025056 rev 6 9/53 LIS2DH12 block diagram and pin description 53 table 2. pin description pin# name function 1 scl spc i 2 c serial clock (scl) spi serial port clock (spc) 2cs spi enable i 2 c/spi mode selection: 1: spi idle mode / i 2 c communication enabled 0: spi communication mode / i 2 c disabled 3 (1) 1. sdo/sa0 pin is internally pulled up. refer to table 3 for the internal pull-up values (typ). sdo sa0 spi serial data output (sdo) i 2 c less significant bit of the device address (sa0) 4 sda sdi sdo i 2 c serial data (sda) spi serial data input (sdi) 3-wire interface serial data output (sdo) 5 res connect to gnd 6 gnd 0 v supply 7 gnd 0 v supply 8 gnd 0 v supply 9 vdd power supply 10 vdd_io power supply for i/o pins 11 int2 interrupt pin 2 12 int1 interrupt pin 1 table 3. internal pull-up values (typ.) for sdo/sa0 pin vdd_io resistor value for sdo/sa0 pin typ. (k ) 1.7 v 54.4 1.8 v 49.2 2.5 v 30.4 3.6 v 20.4 mechanical and electrical specifications LIS2DH12 10/53 docid025056 rev 6 2 mechanical and electrical specifications 2.1 mechanical characteristics @ vdd = 2.5 v, t = 25 c unless otherwise noted (a) a. the product is factory calibrated at 2.5 v. the operational power supply range is from 1.71 v to 3.6 v. table 4. mechanical characteristics symbol parameter test conditions min. typ. (1) max. unit fs measurement range (2) fs bit set to 00 2.0 g fs bit set to 01 4.0 fs bit set to 10 8.0 fs bit set to 11 16.0 so sensitivity fs bit set to 00; high-resolution mode 1 m g /digit fs bit set to 00; normal mode 4 fs bit set to 00; low-power mode 16 fs bit set to 01; high-resolution mode 2 m g /digit fs bit set to 01; normal mode 8 fs bit set to 01; low-power mode 32 fs bit set to 10; high-resolution mode 4 m g /digit fs bit set to 10; normal mode 16 fs bit set to 10; low-power mode 64 fs bit set to 11; high-resolution mode 12 m g /digit fs bit set to 11; normal mode 48 fs bit set to 11; low-power mode 192 tcso sensitivity change vs. temperature fs bit set to 00 0.01 %/c tyoff typical zero- g level offset accuracy (3) fs bit set to 00 40 m g docid025056 rev 6 11/53 LIS2DH12 mechanical and electrical specifications 53 2.2 temperature sensor characteristics @ vdd = 2.5 v, t = 25 c unless otherwise noted (b) tcoff zero- g level change vs. temperature max delta from 25 c 0.5 m g /c an acceleration noise density fs bit set to 00, high-resolution mode ( table 10 ), odr > 1300 hz 220 g / hz vst self-test output change (4) (5) (6) fs bit set to 00 x-axis; normal mode 17 360 lsb fs bit set to 00 y-axis; normal mode 17 360 lsb fs bit set to 00 z-axis; normal mode 17 360 lsb to p 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. typical zero-g level offset value after factory calibration test at socket level. 4. the sign of ?self-test output change? is defined by the st bits in ctrl_reg4 (23h) , for all axes. 5. ?self-test output change? is defined as the absolute value of: output[lsb] (self test enabled) - output[lsb] (self test disabled) . 1lsb = 4 m g at 10-bit representation, 2 g full scale 6. after enabling the self-test, correct data is obtained after two samples (low-power mode / normal mode) or after eight samples (high-resolution mode). table 4. mechanical characteristics (continued) symbol parameter test conditions min. typ. (1) max. unit b. the product is factory calibrated at 2.5 v. temperature sensor operation is guaranteed in the range 2 v - 3.6 v. table 5. temperature sensor characteristics symbol parameter min. typ. (1) max. unit tsdr temperature sensor output change vs. temperature 1 digit/c (2) todr temperature refresh rate odr (3) hz top operating temperature range -40 +85 c 1. typical specifications are not guaranteed. 2. 8-bit resolution. 3. refer to table 31 . mechanical and electrical specifications LIS2DH12 12/53 docid025056 rev 6 2.3 electrical characteristics @ vdd = 2.5 v, t = 25 c unless otherwise noted (c) c. the product is factory calibrated at 2.5 v. the operational power supply range is from 1.71 v to 3.6 v. table 6. electrical characteristics symbol parameter test conditions min. typ. (1) max. unit vdd supply voltage 1.71 2.5 3.6 v vdd_io i/o pins supply voltage (2) 1.71 vdd+0.1 v idd current consumption in normal mode 50 hz odr 11 a 1 hz odr 2 a iddlp current consumption in low-power mode 50 hz odr 6 a iddpdn current consumption in power-down mode 0.5 a vih digital high-level input voltage 0.8*vdd_io v vil digital low-level input voltage 0.2*vdd_io v voh high-level output voltage 0.9*vdd_io v vol low-level output voltage 0.1*vdd_io v top operating temperature range -40 +85 c 1. typical specification are not guaranteed. 2. it is possible to remove vdd maintaining vdd_io without blocking the communication busses, in this condition the measurement chain is powered off. docid025056 rev 6 13/53 LIS2DH12 mechanical and electrical specifications 53 2.4 communication interface characteristics 2.4.1 spi - serial peripheral interface subject to general operating conditions for vdd and top. figure 3. spi slave timing diagram 1. when no communication is ongoing, data on sdo is driven by internal pull-up resistors. note: measurement points are done at 0.2vdd_io and 0.8vdd_io, for both input and output ports. table 7. spi slave timing values symbol parameter value (1) unit min max t c(spc) spi clock cycle 100 ns f c(spc) spi clock frequency 10 mhz t su(cs) cs setup time 5 ns t h(cs) cs hold time 20 t su(si) sdi input setup time 5 t h(si) sdi input hold time 15 t v(so) sdo valid output time 50 t h(so) sdo output hold time 5 t dis(so) sdo output disable time 50 1. values are guaranteed at 10 mhz clock frequency for spi with both 4 and 3 wires, based on characterization results, not tested in production. spc cs sd i sd o t su(cs) t v(so) t h(so) t h(si) t su(si) t h(cs) t dis(so) t c(spc) msb in msb out lsb out lsb in (1) (1) (1) (1) (1) (1) (1) (1) mechanical and electrical specifications LIS2DH12 14/53 docid025056 rev 6 2.4.2 i 2 c - inter-ic control interface subject to general operating conditions for vdd and top. figure 4. i 2 c slave timing diagram note: measurement points are done at 0.2vdd_io and 0.8vdd_io, for both ports. table 8. i 2 c slave timing values symbol parameter i 2 c standard mode (1) i 2 c fast mode (1) unit min max min max f (scl) scl clock frequency 0 100 0 400 khz t w(scll) scl clock low time 4.7 1.3 s t w(sclh) scl clock high time 4.0 0.6 t su(sda) sda setup time 250 100 ns t h(sda) sda data hold time 0 3.45 0 0.9 s t h(st) start condition hold time 4 0.6 s t su(sr) repeated start condition setup time 4.7 0.6 t su(sp) stop condition setup time 4 0.6 t w(sp:sr) bus free time between stop and start condition 4.7 1.3 1. data based on standard i 2 c protocol requirement, not tested in production. sd a scl t su(sp) t w(scll) t su(sda) t su(sr) t h(st) t w(sclh) t h(sda) t w(sp:sr) start repea ted sta rt stop sta rt docid025056 rev 6 15/53 LIS2DH12 mechanical and electrical specifications 53 2.5 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. note: supply voltage on any pin should never exceed 4.8 v. table 9. absolute maximum ratings symbol ratings maximum value unit vdd supply voltage -0.3 to 4.8 v vdd_io supply voltage on i/o pins -0.3 to 4.8 v vin input voltage on any control pin (cs, scl/spc, sda/sdi/sdo, sdo/sa0) -0.3 to vdd_io +0.3 v a pow acceleration (any axis, powered, vdd = 2.5 v) 3000 g for 0.5 ms 10000 g for 0.2 ms a unp acceleration (any axis, unpowered) 3000 g for 0.5 ms 10000 g for 0.2 ms t op operating temperature range -40 to +85 c t stg storage temperature range -40 to +125 c esd electrostatic discharge protection (hbm) 2 kv 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. terminology and functionality LIS2DH12 16/53 docid025056 rev 6 3 terminology and functionality 3.1 terminology 3.1.1 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 zero- g level the zero- g level offset (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 for the x-axis and 0 g for 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 the mems sensor and therefore the offset can slightly change after mounting the sensor on a printed circuit board or exposing it to extensive mechanical stress. offset changes little over temperature, see table 4 ?zero- g level change vs. temperature? (tcoff). the zero- g level tolerance (tyoff) describes the standard deviation of the range of zero- g levels of a population of sensors. 3.2 functionality 3.2.1 high-resolution, normal mode, low-power mode the LIS2DH12 provides three different operating modes: high-resolution mode , normal mode and low-power mode . the table below summarizes how to select the different operating modes. table 10. operating mode selection operating mode ctrl_reg1[3] (lpen bit) ctrl_reg4[3] (hr bit) bw [hz] turn-on time [ms] so @ 2 g [m g /digit] 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) (1) 0 1 odr/9 7/odr 1 not allowed 1 1 -- -- -- 1. by design, when the device from high-resolution configuration (hr) is set to power-down mode (pd), it is recommended to read register reference (26h) for a complete reset of the filtering block before switching to normal/high-performance mode again. docid025056 rev 6 17/53 LIS2DH12 terminology and functionality 53 the turn-on time to transition to another operating mode is given in table 11 . 3.2.2 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 4 , then the sensor is working properly and the parameters of the interface chip are within the defined specifications. table 11. turn-on time for operating mode transition operating mode change turn-on time [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 12. current consumption of operating modes operating mode [hz] low-power mode (8-bit data output) [ a] normal mode (10-bit data output) [ a] high resolution (12-bit data output) [ a] 1222 10 3 4 4 25 4 6 6 50 6 11 11 100 10 20 20 200 18 38 38 400 36 73 73 1344 -- 185 185 1620 100 -- -- 5376 185 -- -- terminology and functionality LIS2DH12 18/53 docid025056 rev 6 3.2.3 6d / 4d orientation detection the LIS2DH12 provides the capability to detect the orientation of the device in space, enabling easy implementation of energy-saving procedures and automatic image rotation for mobile devices. the 4d detection is a subset of the 6d function especially defined to be implemented in mobile devices for portrait and landscape computation. in 4d configuration, the z-axis position detection is disabled. 3.2.4 ?sleep-to-wake? and ?return-to-sleep? the LIS2DH12 can be programmed to automatically switch to low-power mode upon recognition of a determined event. once the event condition is over, the device returns back to the preset normal or high- resolution mode. to enable this function the desired threshold value must be stored inside the act_ths (3eh) register while the duration value is written inside the act_dur (3fh) register. when the acceleration falls below the threshold value, the device automatically switches to low-power mode (10hz odr). during this condition, the odr[3:0] bits and the lpen bit inside ctrl_reg1 (20h) and the hr bit in ctrl_reg4 (23h) are not considered. as soon as the acceleration rises above threshold, the module restores the operating mode and odrs as determined by the ctrl_reg1 (20h) and ctrl_reg4 (23h) settings. 3.3 sensing element a proprietary process is used to create a surface micromachined accelerometer. the technology processes suspended silicon structures which are attached to the substrate in a few points called anchors and are free to move in the direction of the sensed acceleration. to be compatible with traditional packaging techniques, a cap is placed on top of the sensing element to avoid blocking the moving parts during the molding phase of the plastic encapsulation. when an acceleration is applied to the sensor, the proof mass displaces from its nominal position, causing an imbalance in the capacitive half-bridge. this imbalance is measured using charge integration in response to a voltage pulse applied to the capacitor. at steady state the nominal value of the capacitors are a few pf and when an acceleration is applied, the maximum variation of the capacitive load is in the ff range. 3.4 ic interface the complete measurement chain is composed of a low-noise capacitive amplifier which converts the capacitive unbalance of the mems sensor into an analog voltage that will be available to the user through an analog-to-digital converter. the acceleration data may be accessed through an i 2 c/spi interface, thus making the device particularly suitable for direct interfacing with a microcontroller. docid025056 rev 6 19/53 LIS2DH12 terminology and functionality 53 the LIS2DH12 features a data-ready signal (drdy) which indicates when a new set of measured acceleration data is available, thus simplifying data synchronization in the digital system that uses the device. the LIS2DH12 may also be configured to generate an inertial wake-up and free-fall interrupt signal according to a programmed acceleration event along the enabled axes. both free-fall and wake-up can be available simultaneously on two different pins. 3.5 factory calibration the ic interface is factory calibrated for sensitivity (so) and zero- g level (tyoff). the trim values are stored inside the device in non-volatile memory. any time the device is turned on, these values are downloaded into the registers to be used during active operation. this allows using the device without further calibration. 3.6 fifo the LIS2DH12 contains a 10-bit, 32-level fifo. buffered output allows the following operation modes: fifo, stream, stream-to-fifo and fifo bypass. when fifo bypass mode is activated, fifo is not operating and remains empty. in fifo mode, measurement data from acceleration detection on the x, y, and z-axes are stored in the fifo buffer. 3.7 temperature sensor in order to enable the internal temperature sensor, bits temp_en[1:0] in register temp_cfg_reg (1fh) and the bdu bit in ctrl_reg4 (23h) have to be set. the temperature is available in out_temp_l (0ch), out_temp_h (0dh) stored as two?s complement data, left-justified. the temperature data format can be 10 bits if lpen (bit 3) in ctrl_reg1 (20h) is cleared (high-resolution / normal mode), otherwise, in low-power mode, the adc resolution is 8-bit. refer to table 5: temperature sensor characteristics for the conversion factor. application hints LIS2DH12 20/53 docid025056 rev 6 4 application hints figure 5. LIS2DH12 electrical connections 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). all the voltage and ground supplies must be present at the same time to have proper behavior of the ic (refer to figure 5 ). it is possible to remove vdd while maintaining vdd_io without blocking the communication bus, in this condition the measurement chain is powered off. the functionality of the device and the measured acceleration data is selectable and accessible through the i 2 c or spi interfaces. when using the i 2 c, cs must be tied high. the functions, the threshold and the timing of the two interrupt pins (int1 and int2) can be completely programmed by the user through the i 2 c/spi interface. vdd_io digital signal from/to signal controller. signal levels are defined by proper selection of vdd_io 10f vdd 100nf gnd res sc l/spc sda/sdi/sdo cs sdo/sa0 gnd gnd int 2 vdd_io 4 1 6 5 gnd 12 int 1 7 10 vdd 100nf 11 docid025056 rev 6 21/53 LIS2DH12 application hints 53 4.1 soldering information the lga package is compliant with the ecopack ? , rohs and ?green? standard. 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 . table 13. internal pin status pin# name function pin status 1 scl spc i 2 c serial clock (scl) spi serial port clock (spc) default: input high impedance 2cs spi enable i 2 c/spi mode selection: 1: spi idle mode / i 2 c communication enabled 0: spi communication mode / i 2 c disabled default: input high impedance 3 sdo sa0 spi serial data output (sdo) i 2 c less significant bit of the device address (sa0) default: input with internal pull-up (1) 4 sda sdi sdo i 2 c serial data (sda) spi serial data input (sdi) 3-wire interface serial data output (sdo) default: (sda) input high impedance 5 res connect to gnd 6 gnd 0 v supply 7 gnd 0 v supply 8 gnd 0 v supply 9 vdd power supply 10 vdd_io power supply for i/o pins 11 int2 interrupt pin 2 default: push-pull output forced to gnd 12 int1 interrupt pin 1 default: push-pull output forced to gnd 1. in order to disable the internal pull-up on the sdo/sa0 pin, write 90h in ctrl_reg0 (1eh) . digital main blocks LIS2DH12 22/53 docid025056 rev 6 5 digital main blocks 5.1 fifo the LIS2DH12 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 (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 (2eh) . programmable fifo watermark level, fifo empty or fifo overrun events can be enabled to generate dedicated interrupts on the int1 pin (configuration through ctrl_reg3 (22h) ). in the fifo_src_reg (2fh) register the empty bit is equal to ?1? when all fifo samples are ready and fifo is empty. in the fifo_src_reg (2fh) register the wtm bit goes to ?1? if new data is written in the buffer and fifo_src_reg (2fh) (fss [4:0]) is greater than or equal to fifo_ctrl_reg (2eh) (fth [4:0]). fifo_src_reg (2fh) (wtm) goes to ?0? if reading an x, y, z data slot from fifo and fifo_src_reg (2fh) (fss [4:0]) is less than or equal to fifo_ctrl_reg (2eh) (fth [4:0]). in the fifo_src_reg (2fh) register the ovrn_fifo bit is equal to ?1? if the fifo slot is overwritten. 5.1.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). 5.1.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. an overrun interrupt can be enabled, i1_overrun = '1' in the ctrl_reg3 (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 transit from 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 (2eh) . docid025056 rev 6 23/53 LIS2DH12 digital main blocks 53 5.1.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, i1_overrun = '1' in the ctrl_reg3 (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 (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). 5.1.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. the fifo operating mode changes according to the int1 pin value if the tr bit is set to ?0? in the fifo_ctrl_reg (2eh) register or the int2 pin value if the tr bit is set to?1? in the fifo_ctrl_reg (2eh) register. when the interrupt pin is selected and the interrupt event is configured on the corresponding pin, the fifo operates in stream mode if the pin value is equal to ?0? and it operates in fifo mode if the pin value is equal to ?1?. switching modes is dynamically performed according to the 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. 5.1.5 retrieving data from fifo fifo data is read from out_x_l (28h), out_x_h (29h) , out_y_l (2ah), out_y_h (2bh) and out_z_l (2ch), out_z_h (2dh) . when the fifo is in stream, stream-to-fifo or fifo mode, a read operation to the out_x_l (28h), out_x_h (29h) , out_y_l (2ah), out_y_h (2bh) or out_z_l (2ch), out_z_h (2dh) 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 (28h), out_x_h (29h) , out_y_l (2ah), out_y_h (2bh) and out_z_l (2ch), out_z_h (2dh) registers and both single read and read_burst operations can be used. the address to be read is automatically updated by the device and it rolls back to 0x28 when register 0x2d is reached. in order to read all fifo levels in a multiple byte read,192 bytes (6 output registers of 32 levels) have to be read. digital interfaces LIS2DH12 24/53 docid025056 rev 6 6 digital interfaces the registers embedded inside the LIS2DH12 may be accessed through both the i 2 c and spi serial interfaces. the latter may be sw configured to operate either in 3-wire or 4-wire interface mode. the serial interfaces are mapped to the same pads. to select/exploit the i 2 c interface, the cs line must be tied high (i.e. connected to vdd_io). 6.1 i 2 c serial interface the LIS2DH12 i 2 c is a bus slave. the i 2 c is employed to write data into registers whose content can also be read back. the relevant i 2 c terminology is given in the table below. there are two signals associated with the i 2 c bus: the serial clock line (scl) and the serial data line (sda). the latter is a bidirectional line used for sending and receiving data to/from the interface. both the lines must be connected to vdd_io through an external pull-up resistor. when the bus is free, both the lines are high. the i 2 c interface is compliant with fast mode (400 khz) i 2 c standards as well as with normal mode. table 14. serial interface pin description pin name pin description cs spi enable i 2 c/spi mode selection: 1: spi idle mode / i 2 c communication enabled 0: spi communication mode / i 2 c disabled scl spc i 2 c serial clock (scl) spi serial port clock (spc) sda sdi sdo i 2 c serial data (sda) spi serial data input (sdi) 3-wire interface serial data output (sdo) sa0 sdo i 2 c less significant bit of the device address (sa0) spi serial data output (sdo) table 15. i 2 c terminology term description transmitter the device which sends data to the bus receiver 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 docid025056 rev 6 25/53 LIS2DH12 digital interfaces 53 6.1.1 i 2 c operation 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. the slave address (sad) associated to the LIS2DH12 is 001100xb. the sdo / sa0 pad can be used to modify the less significant bit of the device address. if the sa0 pad is connected to the voltage supply, lsb is ?1? (address 0011001b), else if the sa0 pad is connected to ground, the lsb value is ?0? (address 0011000b). this solution permits to connect and address two different accelerometers to the same i 2 c lines. 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 i 2 c embedded inside the LIS2DH12 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 is ?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 16 explains how the sad+read/write bit pattern is composed, listing all the possible configurations. table 16. sad+read/write patterns command sad[6:1] sad[0] = sa0 r/w sad+r/w read 001100 0 1 00110001 (31h) write 001100 0 0 00110000 (30h) read 001100 1 1 00110011 (33h) write 001100 1 0 00110010 (32h) table 17. transfer when master is writing one byte to slave master st sad + w sub data sp slave sak sak sak digital interfaces LIS2DH12 26/53 docid025056 rev 6 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 (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 order to read multiple bytes, it is necessary to assert the most significant bit of the sub- address field. in other words, sub(7) must be equal to 1 while sub(6-0) represents the address of the first register to be read. in the presented communication format mak is master acknowledge and nmak is no master acknowledge. table 18. transfer when master is writing multiple bytes to slave master st sad + w sub data data sp slave sak sak sak sak table 19. transfer when master is receiving (reading) one byte of data from slave master st sad + w sub sr sad + r nmak sp slave sak sak sak data table 20. transfer when master is receiving (reading) multiple bytes of data from slave master st sad+w sub sr sad+r mak mak nmak sp slave sak sak sak data data data docid025056 rev 6 27/53 LIS2DH12 digital interfaces 53 6.2 spi bus interface the LIS2DH12 spi is a bus slave. the spi allows writing to and reading from the registers of the device. the serial interface interacts with the application using 4 wires: cs , spc , sdi and sdo . figure 6. read and write protocol cs is the serial port enable and it is controlled by the spi master. it goes low at the start of the transmission and goes back high at the end. spc is the serial port clock and it is controlled by the spi master. it is stopped high when cs is high (no transmission). sdi and sdo are respectively the serial port data input and output. these lines are driven at the falling edge of spc and should be captured at the rising edge of spc . both the read register and write register commands are completed in 16 clock pulses or in multiples of 8 in case of multiple read/write bytes. bit duration is the time between two falling edges of spc . the first bit (bit 0) starts at the first falling edge of spc after the falling edge of cs while the last bit (bit 15, bit 23, ...) starts at the last falling edge of spc just before the rising edge of cs . bit 0 : r w bit. when 0, the data di(7:0) is written into the device. when 1, the data do(7:0) from the device is read. in the latter case, the chip will drive sdo at the start of bit 8. bit 1 : m s bit. when 0, the address will remain unchanged in multiple read/write commands. when 1, the address is auto incremented in multiple read/write commands. bit 2-7 : address ad(5: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 into the device (msb first). bit 8-15 : data do(7:0) (read mode). this is the data that is read from the device (msb first). in multiple read/write commands further blocks of 8 clock periods will be added. when the m s bit is ?0?, the address used to read/write data remains the same for every block. when the m s bit is ?1?, the address used to read/write data is increased at every block. the function and the behavior of sdi and sdo remain unchanged. & |