cancel
Showing results for 
Search instead for 
Did you mean: 

FIFO usage and tap interrupt.

ASoni.2
Associate III

Hi, I am working with LSM6DS3TR sensor and need some advice on FIFO usage. I have followed sample code from the ST's GitHub page but still have some questions. I am using continuous-to-FIFO mode and tap interrupt.

  1. I see samples on my screen when interrupt happens. Do these samples come from FIFO or from the present state of the IMU?
  2. If coming from FIFO, I am unable to get more than 350 patterns. In code below, it prints 300 samples. How do I get more patterns?
  3. The FIFO can memorise 4096 samples of 16 bits each. Does this mean I can have 4096 samples of data or 4096/16 samples?
//Set FIFO watermark to a multiple of a pattern
pattern_len = 6;
pattern_numbers = 300;
lsm6ds3tr_c_fifo_watermark_set(&lsm6ds3, pattern_numbers*pattern_len);
lsm6ds3tr_c_fifo_stop_on_wtm_set(&lsm6ds3, PROPERTY_ENABLE);
 
//Set FIFO mode to Stream-to-FIFO mode
lsm6ds3tr_c_fifo_mode_set(&lsm6ds3, LSM6DS3TR_C_STREAM_TO_FIFO_MODE);
 
//Enable FIFO watermark interrupt generation on INT1 pin
lsm6ds3tr_c_pin_int1_route_get(&lsm6ds3, &int_1_reg);
int_1_reg.int1_single_tap = PROPERTY_ENABLE;
lsm6ds3tr_c_pin_int1_route_set(&lsm6ds3, int_1_reg);
 
//Set FIFO sensor decimator
lsm6ds3tr_c_fifo_xl_batch_set(&lsm6ds3, LSM6DS3TR_C_FIFO_XL_NO_DEC);
lsm6ds3tr_c_fifo_gy_batch_set(&lsm6ds3, LSM6DS3TR_C_FIFO_GY_NO_DEC);

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @ASoni.2​ , let me try to answer to some of your questions:

  1. In the continuous-to-FIFO mode, the FIFO buffer starts operating in Continuous mode and switches to FIFO mode when an event condition occurs (see p.99 of AN4650)
  2. Let me check if I well understood... if you set "300" as FIFO watermark, and your device is running, when the tap interrupt is risen the FIFO starts collecting up to 300 samples, and when this watermark is reached the FIFO itself rises an interrupt and it stops filling. If you want to acquire more samples, you have to increase the FIFO watermark value.
  3. The LSM6DS3 FIFO is 8 kbyte sized (p.1 of AN4650), meaning you can store up to 4096 samples of 16 bits each.

Regards

0690X00000Bw9S9QAJ.png

View solution in original post

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @ASoni.2​ , let me try to answer to some of your questions:

  1. In the continuous-to-FIFO mode, the FIFO buffer starts operating in Continuous mode and switches to FIFO mode when an event condition occurs (see p.99 of AN4650)
  2. Let me check if I well understood... if you set "300" as FIFO watermark, and your device is running, when the tap interrupt is risen the FIFO starts collecting up to 300 samples, and when this watermark is reached the FIFO itself rises an interrupt and it stops filling. If you want to acquire more samples, you have to increase the FIFO watermark value.
  3. The LSM6DS3 FIFO is 8 kbyte sized (p.1 of AN4650), meaning you can store up to 4096 samples of 16 bits each.

Regards

0690X00000Bw9S9QAJ.png

ASoni.2
Associate III

Hi @Eleon BORLINI​ , Thank you for your answer. I have managed to get maximum number of samples supported by FIFO.

Kind regards