cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSO Decompression Algorithm

BDiva.1
Associate II

Is there an algorithm to decompress the IIMU data that allows continuous collection of the FIFO data when timestamp, accelerometer and gyroscope buffering is enabled in FIFO? The App note gives some ideas how to decompress but not the algorithm - looks like we cannot predict any data coming from FIFO. Please help.

Thanks!

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi @BDiva.1​ ,

you can check the C code on Github, lsm6dso_compressed_fifo.c, that should fit your purpose: this file how to configure compressed FIFO and to retrieve accelerometer and gyroscope data. This sample use a FIFO utility library tool for FIFO decompression.

In particular, inside this code there is this function:

st_fifo_status st_fifo_decompress(st_fifo_out_slot *fifo_out_slot,
                                  st_fifo_raw_slot *fifo_raw_slot,
                                  uint16_t *out_slot_size,
                                  uint16_t stream_size)

It is defined in the FIFO_decompression_utility folder (always on Github), where you can check the detailed structure.

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.

-Eleon

They store data in separate arrays, acc_data[] and gyr_data[] each of them includes a timestamp. What is the way to store data in one array which includes a timestamp, accelerometer X,Y,Z and gyroscope X,Y,Z data? I need to store samples matching the same timestamp. Do you have such an example? Thanks!

Hi @BDiva.1​ ,

now you are considering the compression code, right?

If so, the timestamp is defined as:

// Axl
fifo_out_slot[j].timestamp =
              (timestamp - (2U * TIMESTAMP_FREQ / (uint32_t)bdr_xl));
 
//Gyro
fifo_out_slot[j].timestamp =
              (timestamp - (2U * TIMESTAMP_FREQ / (uint32_t)bdr_gy));

If you choose the same Batch data rate [Hz] for both accelerometer and gyroscope, you'll capture and store data at the same time so you'll have the same timestamp.

An example of the timings between data is described in the application note AN5192, p.94:

0693W00000AMxvAQAT.pngHowever, for a more detailed question I suggest you to post it in the "Issue section" on Github, that is periodically updated by ST experts.

-Eleon