Skip to main content
Visitor II
April 24, 2023
Solved

LSM6DSO FIFO Pedometer

  • April 24, 2023
  • 1 reply
  • 2178 views

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

    This topic has been closed for replies.
    Best answer by Federica Bossi

    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!

    1 reply

    Technical Moderator
    April 24, 2023

    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!

    BenG142Author
    Visitor II
    April 24, 2023

    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

    Visitor II
    August 13, 2024

    Hi BENG,
    I'm trying to develop a pedometer application using the LSM6DSOX sensor, but I haven't been successful. Could you share your project files with me? I'd like to know which registers you used.