2026-06-05 1:39 AM
LSM6DSM setting: acc/gyro/fifo ODR 208hz, timer resolution 25us, FIFO continous mode
# 1. Enable Block Data Update (BDU) and Auto-increment (IF_INC)
imu.__write_reg(CTRL3_C, 0x44)
# 2. Timestamp resolution (25 us / LSB)
# TIMER_HR (bit 5) = 1 in WAKE_UP_DUR register -> 0x10
imu.__write_reg(WAKE_UP_DUR, 0x10)
# 3. Enable the Hardware Timestamp Timer AND the Embedded Digital Block
# TIMER_EN (bit 5) = 1, FUNC_EN (bit 2) = 1 -> 0x24
imu.__write_reg(CTRL10_C, 0x24)
# 4. Set Accelerometer ODR to 208Hz, 8g
imu.__write_reg(CTRL1_XL, 0x5c)
# 5. Set Gyroscope ODR to 208Hz, 2000dps
imu.__write_reg(CTRL2_G, 0x5c)
# 6. Enable Timestamp routing to the FIFO at every Data-Ready (DRDY)
imu.__write_reg(FIFO_CTRL2, 0x80)
# 7. Set FIFO decimation: No decimation for Accel and Gyro (Datasets 1 & 2)
imu.__write_reg(FIFO_CTRL3, 0x09)
# 8. Set FIFO decimation: No decimation for Timestamp (Dataset 4)
imu.__write_reg(FIFO_CTRL4, 0x08)
# 9. Set FIFO ODR to 208Hz and mode to Continuous
imu.__write_reg(FIFO_CTRL5, 0x2E)When MCU reading data from FIFO, each batch usually contains 6 ~ 10 acc_gyro_timestamp samples. In each batch there may be 1~2 samples which timestamp is larger or smaller than expected. OVER_RUN bit in FIFO_STATUS2 is not detected. Following are timestamps
[273, 467, 661, 854, 1048, 1242, 1436, 1630, 1824, 2017]
[2211, 2787, 2793, 2987, 3181, 3374, 3568, 3762, 3956, 4150]
[4766, 4925, 5120, 5313, 5507, 5700, 5894, 6088]
[6283, 6968, 7058, 7251, 7445, 7639, 7833, 8026, 8220]
[8415, 9036, 9190, 9383, 9577, 9771, 9965, 10159, 10352]
[10546, 11091, 11128, 11322, 11516, 11709, 11903, 12097, 12291, 12485]
[12679, 13212, 13260, 13454, 13648, 13842, 14035, 14229, 14423]
[14617, 15276, 15392, 15586, 15780, 15974, 16167, 16361, 16555]
[16749, 17366, 17525, 17718, 17912, 18106, 18300, 18493, 18687]
[18882, 19508, 19656, 19850, 20044, 20238, 20432, 20626, 20819]
[21013, 21504, 21595, 21789, 21982, 22176, 22370, 22564, 22758, 22952]
[23606, 23728, 23922, 24116, 24309, 24502, 24696, 24890]
[25084, 25679, 25859, 26053, 26247, 26441, 26635, 26828, 27022]
[27216, 27783, 27798, 27992, 28185, 28379, 28573, 28767, 28961, 29155]
[29863, 29930, 30124, 30318, 30512, 30706, 30899, 31093, 31287]
[31978, 32062, 32256, 32450, 32644, 32838, 33032, 33225, 33419]
[34051, 34195, 34389, 34582, 34776, 34970, 35164, 35358]
[35551, 36222, 36327, 36521, 36715, 36908, 37102, 37296, 37490]
[37684, 38288, 38459, 38653, 38847, 39041, 39234, 39428, 39622]
[39816, 40425, 40591, 40785, 40979, 41173, 41367, 41560, 41754]
[42434, 42530, 42723, 42917, 43111, 43305, 43499, 43692]
[43886, 44610, 44662, 44855, 45050, 45243, 45437, 45631, 45825]
[46018, 46609, 46794, 46988, 47181, 47375, 47569, 47763, 47957]
[48151, 48784, 48927, 49120, 49314, 49507, 49701, 49895, 50089]
[50784, 50864, 51058, 51253, 51446, 51640, 51834, 52027, 52221]
[52894, 52997, 53191, 53384, 53578, 53772, 53966, 54160]
[54354, 55018, 55129, 55323, 55517, 55711, 55904, 56098, 56292]
[56486, 57124, 57261, 57455, 57650, 57843, 58037, 58231, 58424]
[58618, 59130, 59200, 59394, 59588, 59781, 59975, 60169, 60363, 60557]
[61269, 61332, 61526, 61720, 61914, 62107, 62301, 62495]
[62689, 63360, 63465, 63658, 63852, 64046, 64240, 64434, 64627]
[64821, 65495, 65597, 65790, 65985, 66178, 66372, 66566, 66760]
[66955, 67519, 67535, 67729, 67923, 68117, 68310, 68504, 68698, 68892]
[69086, 69694, 69861, 70055, 70249, 70443, 70637, 70830, 71024]
[71673, 71800, 71994, 72187, 72381, 72575, 72769, 72963]
[73157, 73817, 73932, 74126, 74320, 74514, 74707, 74901, 75095]
[75289, 75898, 76064, 76258, 76452, 76646, 76840, 77034, 77227]
[77421, 78025, 78197, 78390, 78584, 78778, 78972, 79166, 79360]
[80050, 80135, 80329, 80524, 80717, 80910, 81104, 81298, 81492]
[82228, 82267, 82461, 82655, 82849, 83043, 83236, 83430]
[83624, 84254, 84400, 84593, 84787, 84981, 85175, 85369, 85563]
[85756, 86409, 86532, 86726, 86920, 87114, 87307, 87501, 87695]
[87889, 88459, 88470, 88664, 88858, 89052, 89246, 89440, 89633, 89827]
[90021, 90586, 90603, 90796, 90990, 91185, 91378, 91572, 91766]
[91960, 92590, 92735, 92930, 93123, 93317, 93511, 93704, 93898]
[94092, 94702, 94868, 95061, 95255, 95449, 95643, 95837, 96031]
[96225, 96774, 96806, 97000, 97194, 97388, 97581, 97775, 97969, 98163]
[98912, 98938, 99132, 99326, 99520, 99714, 99908, 100102, 100296]
[101010, 101071, 101265, 101459, 101653, 101846, 102040, 102234]
[102428, 103067, 103204, 103397, 103591, 103785, 103979, 104173, 104366]
[104560, 105132, 105142, 105336, 105529, 105724, 105917, 106111, 106305, 106499]
Similar to https://community.st.com/t5/mems-sensors/fifo-timestamp-lsm6dsm/td-p/127219
Thank you for helping
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.