Skip to main content
JXiao.1
Associate III
September 2, 2021
Question

LSM6DSO pedometer interrupt setting

  • September 2, 2021
  • 2 replies
  • 1095 views

Hello,

I am using LSM6DSO sensor to do a pedometer. I use the official interrupt signal to control the step update like the following sentence.

int1_route.emb_func_int1.int1_step_detector = PROPERTY_ENABLE;

But I found the interrupt signal always has some delays. When I am moving, sensor will not produce an interrupt signal. After I stop moving for few seconds (about 10 seconds), the sensor will send an interrupt signal.

Is there some settings for this condition?

Thank you.

This topic has been closed for replies.

2 replies

Eleon BORLINI
ST Employee
September 7, 2021

Hi @JXiao.1​ ,

Are you using the lsm6dso_pedometer.c Github reference code?

And did you set the proper ODR and FS, as stated in the application note AN5192, p.58, of // ODR_XL = 26 Hz, FS_XL = ±4 g?

I suggest you also to enable the False-Positive Rejection and Advanced Detection blocks, as suggested in the code below:

 /* Enable step counter */
 lsm6dso_****_sens_set(&ag_ctx, LSM6DSO_FALSE_STEP_REJ_ADV_MODE);
 emb_sens.step = PROPERTY_ENABLE;
 emb_sens.step_adv = PROPERTY_ENABLE;
 lsm6dso_embedded_sens_set(&ag_ctx, &emb_sens);

-Eleon

JXiao.1
JXiao.1Author
Associate III
September 7, 2021

Hi Eleon,

I have seen the reference code. But the reference code use while loop instead of interrupt. The while loop will take more power consumption.

The ODR_Xl is set 26 Hz and FS_XL is ​±2g. This is the code for pedometer.

lsm6dso_xl_full_scale_set(&imu_dev_ctx, LSM6DSO_2g);
lsm6dso_gy_full_scale_set(&imu_dev_ctx, LSM6DSO_250dps);
lsm6dso_block_data_update_set(&imu_dev_ctx, PROPERTY_ENABLE);
 
lsm6dso_****_sens_set(&imu_dev_ctx, LSM6DSO_****_BASE_MODE);
 
lsm6dso_pin_int1_route_get(&imu_dev_ctx, &int1_route);
int1_route.emb_func_int1.int1_step_detector = PROPERTY_ENABLE;
lsm6dso_pin_int1_route_set(&imu_dev_ctx, &int1_route);

I will try your pedometer working mode. Thank you.