2017-11-03 01:55 AM
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 everytimeSolved! Go to Solution.
2017-11-05 12:40 PM
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.
2017-11-05 12:40 PM
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.
2017-11-06 01:23 AM
I imagined an other solution using a timer and the DMA TC interrupt. I'll try both
2017-11-06 08:57 AM
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 ?
2017-11-08 05:42 AM
My understanding is
if the watermark is set for example to 20, you should read 21 samples each time the interrupt occurs but only after first interrupt all samples are valid, then you should discard first sample because it is equal to last sample from previous batch.
I'm currently checking this with sensor specialist and I will come back to you as soon as possible.
You can also check the
.2017-11-08 05:49 AM
Yes, I already checked the AN.
Thank you for your help, I'll wait his answer !2017-11-10 09:55 AM
Any news
Batek.Miroslav
?2017-11-17 06:34 AM
I got an answer from the sensor specialist. My understanding was correct, but they proposed me another approach:
If you want to have 20 values available when the interrupt occurs you should set 20 (14h) into FIFO_CTRL(FTH4:0) and read 20 samples each time the interrupt is triggered. The interrupt will be actually triggered when the FIFO reach 21 sample and one sample will always remain in the FIFO, but in this case you don't have to discard any sample.
2017-11-22 01:05 AM
Actually, I put the FIFO depth to 19 and I read 20 samples. It works because during DMA buffer filling, new samples are available, so I can read at least one more sample.
Thank you for your help, I now clearly understand this part of the datasheet and it may help other people !