cancel
Showing results for 
Search instead for 
Did you mean: 

lis2HH12 movement detect

WBria.1
Associate II

Hi All,

I have a prototype pcb with lis2hh12 + stm32 and i want to configure movement detection into the accell but all informations that i found was about ACT_THS (1Eh) and ACT_DUR (1Fh).

In my tests accel does not set INT1 (as desired)... Do anyone know how to make INT1 works accordingly with these THS + DUR ?

Here are my accel_init()

{

lis2hh12_pin_int1_route_t pinValue;

 

/* Wait sensor boot time */

HAL_Delay(20);

/* Check device ID */

lis2hh12_dev_id_get(&dev_ctx, &accelData.whoami);

 

// if (accelData.whoami != LIS2HH12_ID)

// {

// while (1); /* manage here device not found */

// }

 

/* Restore default configuration */

lis2hh12_dev_reset_set(&dev_ctx, PROPERTY_ENABLE);

 

do {

lis2hh12_dev_reset_get(&dev_ctx, &accelData.rst);

} while (accelData.rst);

 

/* Enable Block Data Update */

lis2hh12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);

/* Set full scale */

lis2hh12_xl_full_scale_set(&dev_ctx, LIS2HH12_2g);

/* Configure filtering chain */

/* Accelerometer data output- filter path / bandwidth */

lis2hh12_xl_filter_aalias_bandwidth_set(&dev_ctx, LIS2HH12_AUTO);

lis2hh12_xl_filter_out_path_set(&dev_ctx, LIS2HH12_FILT_LP);

lis2hh12_xl_filter_low_bandwidth_set(&dev_ctx, LIS2HH12_LP_ODR_DIV_400);

/* Accelerometer interrupt - filter path / bandwidth */

lis2hh12_xl_filter_int_path_set(&dev_ctx, LIS2HH12_HP_DISABLE);

/* Set Output Data Rate */

lis2hh12_xl_data_rate_set(&dev_ctx, LIS2HH12_XL_ODR_100Hz);

 

// pinValue.int1_drdy = 0;

// pinValue.int1_fth = 0;

// pinValue.int1_inact = 1;

// pinValue.int1_ig1 = 1;

// pinValue.int1_ig2 = 0;

// pinValue.int1_ovr = 0;

// lis2hh12_pin_int1_route_set(&dev_ctx, pinValue);

lis2hh12_act_threshold_set(&dev_ctx, 0x50);

lis2hh12_act_duration_set(&dev_ctx, 0x20);

//lis2hh12_xl_trshld_set(&dev_ctx, 20, 30, 20, 20);

}

1 REPLY 1
WBria.1
Associate II

i just found this lis2dw12-movement-detect example that i think should works for me.. but i have to migrate the code (if same or equivalent registers):

https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/lis2dw12_STdC/examples/lis2dw12_activity.c#L167