cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSO FIFO Pedometer

BenG142
Associate II

Hi guys,

This has likely been covered before so please feel free to point me to it.

I'm trying to set up the LSM6DSOX Pedometer to store count to FIFO, but having no luck.

I am not using the Library, as it is not easily ported to my uC.

Would anyone be able to highlight for me the registers I need to set up for basic operation, so that I can tinker from there?

I have been able to set up the pedometer to interrupt, but not write to FIFO.

I'd also be interested in the steps to read from the FIFO, but imagine that this will be easier once I'm writing correctly..

Thanks,

Ben

1 ACCEPTED SOLUTION

Accepted Solutions
Federica Bossi
ST Employee

Hi @BenG142​ ,

The FIFO can be configured to store pedometer data.

Data can be retrieved from the FIFO through six dedicated registers, from address 79h to 7Eh: FIFO_DATA_OUT_X_L, FIFO_DATA_OUT_X_H, FIFO_DATA_OUT_Y_L, FIFO_DATA_OUT_Y_H, FIFO_DATA_OUT_Z_L, FIFO_DATA_OUT_Z_H.

Through the FIFO_MODE[2:0] bits of the FIFO_CTRL4 register you can choose the FIFO operating modes you prefer. To monitor the FIFO status two dedicated registers are available: FIFO_STATUS1 and FIFO_STATUS2.

About the pedometer, you should:

1. Enable the step counter sensor (set the P EDO_EN bit to 1 in the EMB_FUNC_EN_A embedded functions register);

2. Enable step counter batching (set the P EDO_FIFO_EN bit to 1 in the EMB_FUNC_FIFO_CFG embedded functions register).


_legacyfs_online_stmicro_images_0693W00000bii8QQAQ.pngIf 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!

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Federica Bossi
ST Employee

Hi @BenG142​ ,

The FIFO can be configured to store pedometer data.

Data can be retrieved from the FIFO through six dedicated registers, from address 79h to 7Eh: FIFO_DATA_OUT_X_L, FIFO_DATA_OUT_X_H, FIFO_DATA_OUT_Y_L, FIFO_DATA_OUT_Y_H, FIFO_DATA_OUT_Z_L, FIFO_DATA_OUT_Z_H.

Through the FIFO_MODE[2:0] bits of the FIFO_CTRL4 register you can choose the FIFO operating modes you prefer. To monitor the FIFO status two dedicated registers are available: FIFO_STATUS1 and FIFO_STATUS2.

About the pedometer, you should:

1. Enable the step counter sensor (set the P EDO_EN bit to 1 in the EMB_FUNC_EN_A embedded functions register);

2. Enable step counter batching (set the P EDO_FIFO_EN bit to 1 in the EMB_FUNC_FIFO_CFG embedded functions register).


_legacyfs_online_stmicro_images_0693W00000bii8QQAQ.pngIf 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!

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi Frederica,

Thank you - I was half way there!

My mistake was in the CFG_ACCESS!

To clarify for anyone else, the order of operations I followed to finally get this was;

LSM6DSOX_FUNC_CFG_ACCESS //open access to embedded functions

LSM6DSOX_EMB_FUNC_EN_A //enable pedometer

LSM6DSOX_EMB_FUNC_EN_B //enable FP Rejection

LSM6DSOX_EMB_FUNC_FIFO_CFG //enable step counter batching

LSM6DSOX_FUNC_CFG_ACCESS //close access to embedded functions

LSM6DSOX_FIFO_CTRL4 //Set FIFO Mode

You can then read FIFO_STATUS1 and FIFO_STATUS2 to find the number of samples stored in the FIFO, which for me is conveniently the number of steps!

Thank you for your help (again)

Ben