LSM6DS3TR-C Reading more than one pattern from FIFO
Hi,
I'm working with a LSM6DS3TR-C.
Currently I've a working app where I configure a FIFO threshold for accel, gyro and timestamp data, and a THS interrupt in INT1.
Once the interrupt occurs, I can read all the patterns, one at a time like this:
#define PATTERN_LEN_WORDS 9
lsm6ds3tr_c_fifo_data_level_get(&stmdev_ctx, &fifo_data_level);
uint16_t num_pattern = fifo_data_level / PATTERN_LEN_WORDS;
while (num_pattern--)
{
lsm6ds3tr_c_fifo_raw_data_get(&stmdev_ctx, buff, 18);
}
This code is working OK, I can do num_pattern i2c reads of 18 bytes each (9 words).
However, I wanted to somehow optimize the i2c reading, and read all patterns at one go:
#define PATTERN_LEN_WORDS 9
lsm6ds3tr_c_fifo_data_level_get(&stmdev_ctx, &fifo_data_level);
uint16_t num_pattern = fifo_data_level / PATTERN_LEN_WORDS;
lsm6ds3tr_c_fifo_raw_data_get(&stmdev_ctx, buff, num_pattern*18);
But the above code is not working correctly.
Do I have to read at most one pattern at a time from the FIFO output registers?
Thanks,
Martxel
