cancel
Showing results for 
Search instead for 
Did you mean: 

Free fall detection in LSM6DSO not working.

DDuc .1
Associate II

Hello everyone!

I got LSM6DSO on my custom board with stm32l4 MCU, I only use I2C interface (that i don't use interrupt). I'm using LSM6DSO free fall example code in STMems standard C drivers, I can get the id of LSM6DSO so i think the I2C interface is working fine, I have tried doing some free fall test (drop it from my hand) but the FF_IA in WAKE_UP_SRC kept staying 0) so the free fall can't be detected.

Can anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions
niccolò
ST Employee

Hi @DDuc .1​ ,

did you configure the wake-up interrupt?

I ask this, because the register you are reading is for the wake-up

you should check the FF_IA bit in register ALL_INT_SRC (1Ah)

also can you confirm that you set the INTERRUPTS_ ENABLE bit in register TAP_CFG2 (58h)?

even if you do not route the interrupts on INT1 or INT2, you have to set it to let the free-fall trigger

I hope this helps

Niccolò

View solution in original post

9 REPLIES 9
niccolò
ST Employee

Hi @DDuc .1​ ,

did you configure the wake-up interrupt?

I ask this, because the register you are reading is for the wake-up

you should check the FF_IA bit in register ALL_INT_SRC (1Ah)

also can you confirm that you set the INTERRUPTS_ ENABLE bit in register TAP_CFG2 (58h)?

even if you do not route the interrupts on INT1 or INT2, you have to set it to let the free-fall trigger

I hope this helps

Niccolò

Hi @niccolo.ruffini​ 

Your configuring the wake-up interrupt suggestion really help me a lot, I have configured wake-up interrupt and it worked! The FF_IO in WAKE_UP_SRC turn to 1 as my expectation.

Beside, I have checked the FF_IO from ALL_INT_SRC instead of WAKE_UP_SRC bit it didn't go to 1 when I tested free-fall (even I routed the interrupt). Do you know why ?

Thanks for your big help!

Hi @DDuc .1​ ,

you are welcome, I'm glad to hear it worked =)

regarding the ALL_INT_SRC it can depend on how you configured other registers.

depending on your configuration I figured one of the two suggestion was right.

if you want we can dig deep into it.

Niccolò

p.s. if the problem is solved, you can select a best answer to help other members of the community with similar problems

Hi @niccolo.ruffini​ 

My configuration just exactly like lsm6dso free fall example, and I have uncomment generation interrupt from int1 pin just like this. It is great if you can dig deep into it to confirm the example is working fine, I will do some investigation on my code too (may be my implementation was wrong in someway).

/* Disable I3C interface */
  lsm6dso_i3c_disable_set(&dev_ctx, LSM6DSO_I3C_DISABLE);
  /* Set XL Output Data Rate */
  lsm6dso_xl_data_rate_set(&dev_ctx, LSM6DSO_XL_ODR_417Hz);
  /* Set 2g full XL scale */
  lsm6dso_xl_full_scale_set(&dev_ctx, LSM6DSO_2g);
  /* 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, 0x06);
  lsm6dso_ff_threshold_set(&dev_ctx, LSM6DSO_FF_TSH_312mg);
 
  lsm6dso_pin_int1_route_get(&dev_ctx, &int1_route);
  int1_route.reg.md1_cfg.int1_ff = PROPERTY_ENABLE;
  lsm6dso_pin_int1_route_set(&dev_ctx, &int1_route);

Thanks again for your big help!

Hi @DDuc .1​ ,

can you confirm the content of register MD1_CFG (5Eh)?

it should be set to 10h, but we can be sure with a read while the program is running =)

Niccolò

Hi, I am not getting the free fall in lis12dh12. please help me. not raised any interrupt?

Regards,

Ani

Hi Ani @Akuma.6​ ,

did you follow all the steps like you did for lsm6dso?

Niccolò

Hi niccolo,

Thanks for your response. I have followed the below application note document for reading the interrupt. But lo luck.

dt0100-setting-up-freefall-recognition-with-sts-mems-accelerometers-stmicroelectronics.pdf

Regards,

Ani

Hi Ani @Akuma.6​ ,

please, can you confirm that the registers are written correctly after the procedure?

Niccolò