2021-09-03 03:52 PM
My test:
I want to set up the FIFO for bypass->stream, and then just move (shouldn't have to be a violent shake) the PCB that has the lis2ds12 on it and see the FIFO have data.
I'm only able to detect violent shaking... could you please advise / suggest more sensitive settings?
Right now it only (KIND OF) works if I leave datarate set to ```c
/* Set XL Output Data Rate */
lis2ds12_xl_data_rate_set(&dev_ctx, LIS2DS12_XL_ODR_50Hz_HR);
```
In this mode, if I VIOLENTLY SHAKE the lis2ds12, I get data in the FIFO.
If I change this to closer to the settings that I already have working on the other ST chip (lis2dtw12), eg `LIS2DS12_XL_ODR_200Hz_LP` - it doesn't work at all.
My set up is based on the github example here:
Edits:
```c
lis2ds12_fifo_mode_set(&dev_ctx, LIS2DS12_BYPASS_TO_STREAM_MODE);
```
And then enabled the wakeup functions to be pretty sensitive (i think):
```c
lis2ds12_wkup_dur_set(&dev_ctx, 0);
lis2ds12_act_sleep_dur_set(&dev_ctx, 0);
lis2ds12_wkup_threshold_set(&dev_ctx, 0x01);
```
And then, assuming this works like the LIS2DTW12, I enabled interrupts for wakeup:
```c
//FIFO Bypass to Continuous Mode MAYBE? (at least on the dtw) requires
/* Enable activity detection interrupt */
lis2ds12_pin_int1_route_get(&dev_ctx, &int_route);
int_route.int1_wu = PROPERTY_ENABLE;
lis2ds12_pin_int1_route_set(&dev_ctx, int_route);
```
I've also tested w/ a 200Hz data rate (in the HR mode), but same result. If I go from HR to LP, even violent shaking doesn't get me any results... in a different (the lis2DTW part) I am using 200hz with threshold of 2, and it works relatively fine - detects movement w/o needing to violently shake.
2021-09-04 05:48 PM
I tried ramping up the sample rate to 800Hz_HR just to see if that helps but - no dice, still need to violently shake to trigger the BYPASS -> STREAM to turn start.
Latest code snippet to set up the device:
/* Restore default configuration */
lis2ds12_reset_set(&dev_ctx, PROPERTY_ENABLE);
do {
lis2ds12_reset_get(&dev_ctx, &rst);
} while (rst);
/* Set XL Output Data Rate */
lis2ds12_xl_data_rate_set(&dev_ctx, LIS2DS12_XL_ODR_800Hz_HR);
/* Set 2g full XL scale */
lis2ds12_xl_full_scale_set(&dev_ctx, LIS2DS12_2g);
/* Configure FIFO */
lis2ds12_fifo_watermark_set(&dev_ctx, 4);
/* Set FIFO mode to */
lis2ds12_fifo_mode_set(&dev_ctx, LIS2DS12_BYPASS_TO_STREAM_MODE);
// /* Enable Block Data Update */
// lis2ds12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
/* Set wake-up duration:
* this field is set to 0010b, corresponding to 10 ms (= 2 * 1 / ODR)... but i updated from 2->0 to match dtw */
lis2ds12_wkup_dur_set(&dev_ctx, 0);
/* Set sleep duration:
* this field is set to 0010b, corresponding to: 5.12 s (= 2 * 512 / ODR).
* After this period of time has elapsed, the accelerometer ODR is internally set to 12.5 Hz
*/
lis2ds12_act_sleep_dur_set(&dev_ctx, 0);
/* Set Activity wake-up threshold:
* set to 000010b, therefore the activity/inactivity
* threshold is 62.5 mg(= 2 * FS / 64)
*/
lis2ds12_wkup_threshold_set(&dev_ctx, 0x01);
//FIFO Bypass to Continuous Mode MAYBE? (at least on the dtw) requires
/* Enable activity detection interrupt */
lis2ds12_pin_int1_route_get(&dev_ctx, &int_route);
int_route.int1_wu = PROPERTY_ENABLE;
lis2ds12_pin_int1_route_set(&dev_ctx, int_route);