Skip to main content
Visitor II
September 22, 2020
Solved

LIS2DWT12 4D/6D Recognition

  • September 22, 2020
  • 2 replies
  • 869 views

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    Hi @Mcabe.1​ ,

    I cannot see the content of your question, if any...

    I suggest you to check the lis2dtw12_orientation.c code on LIS2DWT12 Github repository. The procedure is the following one:

     /* Set full scale */
     lis2dtw12_full_scale_set(&dev_ctx, LIS2DTW12_2g);
     
     /* Configure power mode */
     lis2dtw12_power_mode_set(&dev_ctx, LIS2DTW12_CONT_LOW_PWR_LOW_NOISE_12bit);
     
     /* Set threshold to 60 degrees */
     lis2dtw12_6d_threshold_set(&dev_ctx, 0x02);
     
     /* LPF2 on 6D function selection. */
     lis2dtw12_6d_feed_data_set(&dev_ctx, LIS2DTW12_ODR_DIV_2_FEED);
     
     /* Enable interrupt generation on 6D INT1 pin. */
     lis2dtw12_pin_int1_route_get(&dev_ctx, &int_route.ctrl4_int1_pad_ctrl);
     int_route.ctrl4_int1_pad_ctrl.int1_6d = PROPERTY_ENABLE;
     lis2dtw12_pin_int1_route_set(&dev_ctx, &int_route.ctrl4_int1_pad_ctrl);
     
     /* Set Output Data Rate */
     lis2dtw12_data_rate_set(&dev_ctx, LIS2DTW12_XL_ODR_200Hz);

    -Eleon

    P.S.: I received an automatic e-mail with this content. Can you please confirm me it is the correct one?

    Good Morning,

     

    I'm trying to use 4d/6d recognition for a project. I configure the accelerometer registers like this:

    Reg 25h = 0x00

    Reg 3Fh = 0x21

    Reg 35h = 0x60

    Reg 34h = 0x08

    Reg 23h = 0x80

    Reg 30h = 0xE0

    Reg 20h = 0x20

     

    In register 30h I enable 4D detection, in register 3Fh I enable interrups and in register 23h I route 6d recognition to INT1.

     

    When I faced up or down the accelerometer and read the status register (27h) I don't see that a change position event is detected.

     

    Does anyone know what is wrong with the accelerometer configuration?

    2 replies

    ST Employee
    September 22, 2020

    Hi @Mcabe.1​ ,

    I cannot see the content of your question, if any...

    I suggest you to check the lis2dtw12_orientation.c code on LIS2DWT12 Github repository. The procedure is the following one:

     /* Set full scale */
     lis2dtw12_full_scale_set(&dev_ctx, LIS2DTW12_2g);
     
     /* Configure power mode */
     lis2dtw12_power_mode_set(&dev_ctx, LIS2DTW12_CONT_LOW_PWR_LOW_NOISE_12bit);
     
     /* Set threshold to 60 degrees */
     lis2dtw12_6d_threshold_set(&dev_ctx, 0x02);
     
     /* LPF2 on 6D function selection. */
     lis2dtw12_6d_feed_data_set(&dev_ctx, LIS2DTW12_ODR_DIV_2_FEED);
     
     /* Enable interrupt generation on 6D INT1 pin. */
     lis2dtw12_pin_int1_route_get(&dev_ctx, &int_route.ctrl4_int1_pad_ctrl);
     int_route.ctrl4_int1_pad_ctrl.int1_6d = PROPERTY_ENABLE;
     lis2dtw12_pin_int1_route_set(&dev_ctx, &int_route.ctrl4_int1_pad_ctrl);
     
     /* Set Output Data Rate */
     lis2dtw12_data_rate_set(&dev_ctx, LIS2DTW12_XL_ODR_200Hz);

    -Eleon

    P.S.: I received an automatic e-mail with this content. Can you please confirm me it is the correct one?

    Good Morning,

     

    I'm trying to use 4d/6d recognition for a project. I configure the accelerometer registers like this:

    Reg 25h = 0x00

    Reg 3Fh = 0x21

    Reg 35h = 0x60

    Reg 34h = 0x08

    Reg 23h = 0x80

    Reg 30h = 0xE0

    Reg 20h = 0x20

     

    In register 30h I enable 4D detection, in register 3Fh I enable interrups and in register 23h I route 6d recognition to INT1.

     

    When I faced up or down the accelerometer and read the status register (27h) I don't see that a change position event is detected.

     

    Does anyone know what is wrong with the accelerometer configuration?

    Mcabe.1Author
    Visitor II
    September 23, 2020

    Yes, thank you. I change my configuration and works