cancel
Showing results for 
Search instead for 
Did you mean: 

Use LSM6DSO to detect free-fall event can not work!

Ljian.1
Associate II

According to the official sample program, I set the register to detect free-fall event,But it can't be detected very well, even when I haven't moved anything, I have always detected the free-fall event,How can I use lsm6dso to detect free-fall event correctly?

4 REPLIES 4
Ljian.1
Associate II

This is the official sample program I refer to

Eleon BORLINI
ST Employee

Hi @Ljian.1​ , on which part number did you managed to detect the free-fall event, before LSM6DSO? You could try to change the detection threshold to a lower value and check if you can detect the free-fall interrupt.

  /* Set Free Fall duration to 3 and 6 samples event duration */
  lsm6dso_ff_dur_set(&dev_ctx, 0x06);
  lsm6dso_ff_threshold_set(&dev_ctx, LSM6DSO_FF_TSH_312mg);

Regards

Ljian.1
Associate II

This is the first time I have used lsm6dso to detect free-fall events. I have not used other ones before.

I changed the detection threshold to a lower value still not work!

Ljian.1
Associate II

This is my enable free-fall detection sourcecode.

void static FallDetectionInit(void)

{

  //stmdev_ctx_t dev_ctx;

  lsm6dso_pin_int1_route_t int1_route;

  /*

  * Uncomment to configure INT 2

  */

  //lsm6dso_pin_int2_route_t int2_route;   

   

  /*

  * Initialize mems driver interface

  */

  //dev_ctx.write_reg = platform_write;

  //dev_ctx.read_reg = platform_read;

   

  /*--------Enable free-fall detection from sensor(lsm6dso)--------*/

  /* Enable LIR */

  lsm6dso_int_notification_set(&dev_ctx, LSM6DSO_ALL_INT_LATCHED);

  /* Set Free Fall duration to 3 and 6 samples event duration */

  lsm6dso_ff_dur_set(&dev_ctx, 0x03);

  lsm6dso_ff_threshold_set(&dev_ctx, LSM6DSO_FF_TSH_312mg);   

   

  /*--------Enable detect activity/inactivity from sensor(lsm6dso)--------*/

  /* Set duration for Activity detection to 9.6 ms (= 4 * 1 / ODR_XL) */

  lsm6dso_wkup_dur_set(&dev_ctx, 0x04);

  /* Set duration for Inactivity detection to 4.92 s (= 4 * 512 / ODR_XL) */

  lsm6dso_act_sleep_dur_set(&dev_ctx, 0x04);

  /* Set Activity/Inactivity threshold to 62.5 mg */

  lsm6dso_wkup_threshold_set(&dev_ctx, 0x02);

   

  /*

  * Inactivity configuration: XL to 12.5 in LP, gyro to Power-Down

  */

  lsm6dso_act_mode_set(&dev_ctx, LSM6DSO_XL_12Hz5_GY_PD);

  /*

  * Enable interrupt generation on Inactivity INT1 pin

  */

  lsm6dso_pin_int1_route_get(&dev_ctx, &int1_route);

  int1_route.md1_cfg.int1_ff = PROPERTY_ENABLE;

  lsm6dso_pin_int1_route_set(&dev_ctx, &int1_route);   

   

   

  /* initialize variables */

  fall_occur = FALL_DETECT_FALSE;

  fall_detect_status = FALL_DETECT_STATUS_NONE;

   

  return;

}