Skip to main content
Alexandre T
Associate III
Nov 3, 2017 8:55 AM UTC
Solved

LIS2HH12 with DMA

Posted on November 03, 2017 at 09:55

Hello,

I implemented a DMA with my LIS2HH12 to avoid losing datas.

The problem is that my DMA is too fast, I am able to read at 1.8kHz (1800 (x,y,z) datas in 1 second) thanks to my DMA but the max ODR that I can choose on my accelerometer is 800Hz.

So I am wasting a lot of memory with my DMA cause if I choose a 400Hz ODR if have a new data available each 4 or 5 sample.

As I understood, it is not possible to change the DMA speep. Did I miss something on the datasheet that could help me to solve my problem ? 

FIFO is interesting but while reading all the registers to get (x,y,z) datas, I will loose some datas ?

Note : I don't want an interrupt when new data available cause it will stop my program everytime
    This topic has been closed for replies.
    Miroslav BATEKBest answer
    ST Employee
    Nov 5, 2017 8:40 PM UTC
    Posted on November 05, 2017 at 21:40

    I think the best solution is to use FIFO and read the data in bursts. You can configure INT1 to generate an interrupt if FIFO reach a certain level and then read all the data in FIFO using DMA. This approach will reduce number of interrupts and avoid any data loss.

    8 replies

    Miroslav BATEKBest answer
    ST Employee
    Nov 5, 2017 8:40 PM UTC
    Posted on November 05, 2017 at 21:40

    I think the best solution is to use FIFO and read the data in bursts. You can configure INT1 to generate an interrupt if FIFO reach a certain level and then read all the data in FIFO using DMA. This approach will reduce number of interrupts and avoid any data loss.

    Alexandre T
    Associate III
    Nov 6, 2017 9:23 AM UTC
    Posted on November 06, 2017 at 09:23

    I imagined an other solution using a timer and the DMA TC interrupt. I'll try both

    Alexandre T
    Associate III
    Nov 6, 2017 4:57 PM UTC
    Posted on November 06, 2017 at 16:57

    I am currently trying to implement your solution but I don't really understand the 5.3.3 chapter in the datasheet. If I want to have 20 values available when the interrupt occurs. What should I put in FIFO_CTRL(FTH4:0) and how many samples I need to read ?