完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
我用LIS2HH12实现了DMA,以避免丢失数据。 问题是我的DMA速度太快,我能够在1秒内读取1.8kHz(1800(x,y,z)数据),这要归功于我的DMA,但我可以在加速度计上选择的最大ODR是800Hz。 因此,如果我选择400Hz ODR,如果每4或5个样本有一个新数据可用,那么我浪费了大量的内存。据我所知,不可能改变DMA速度。我是否遗漏了数据表上可以帮助我解决问题的内容? FIFO很有意思,但在读取所有寄存器以获取(x,y,z)数据时,我会丢失一些数据? 注意:当新数据可用时,我不希望中断,因为它会每次都停止我的程序 以上来自于谷歌翻译 以下为原文 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 |
|
相关推荐
8个回答
|
|
我认为最好的解决方案是使用FIFO并以突发方式读取数据。如果FIFO达到某个级别,则可以将INT1配置为生成中断,然后使用DMA读取FIFO中的所有数据。这种方法将减少中断次数并避免任何数据丢失。
以上来自于谷歌翻译 以下为原文 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. |
|
|
|
我想到了另一种使用定时器和DMA TC中断的解决方案。我会试试两个
以上来自于谷歌翻译 以下为原文 I imagined an other solution using a timer and the DMA TC interrupt. I'll try both |
|
|
|
我目前正在尝试实施您的解决方案,但我并不真正理解数据表中的5.3.3章节。如果我想在发生中断时有20个值可用。我应该把什么放在FIFO_CTRL(FTH4:0)中以及我需要读取多少个样本?
以上来自于谷歌翻译 以下为原文 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 ? |
|
|
|
我的理解是
如果将水印设置为例如20,则每次中断发生时应读取21个样本但仅在第一次中断后所有样本都有效,则应丢弃第一个样本,因为它等于上一批中的最后一个样本。 我目前正在与传感器专家一起检查,我会尽快回复你。 你也可以检查一下 http://www.st.com/content/ccc/resource/technical/document/application_note/60/52/bd/69/28/f4/48/2b/DM00165265.pdf/files/DM00165265.pdf/jcr:内容/翻译/ en.DM00165265.pdf 。 以上来自于谷歌翻译 以下为原文 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 http://www.st.com/content/ccc/resource/technical/document/application_note/60/52/bd/69/28/f4/48/2b/DM00165265.pdf/files/DM00165265.pdf/jcr:content/translations/en.DM00165265.pdf . |
|
|
|
是的,我已经检查了AN。
谢谢你的帮助,我等他的回答! 以上来自于谷歌翻译 以下为原文 Yes, I already checked the AN. Thank you for your help, I'll wait his answer ! |
|
|
|
任何新闻
Batek.Miroslav ?? 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Any news Batek.Miroslav ‌ ? Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
我从传感器专家那里得到了答案。我的理解是正确的,但他们提出了另一种方法:
如果要在发生中断时有20个值可用,则应将20(14h)设置为FIFO_CTRL(FTH4:0),并在每次触发中断时读取20个样本。当FIFO达到21个样本且一个样本将始终保留在FIFO中时,实际上会触发中断,但在这种情况下,您不必丢弃任何样本。 以上来自于谷歌翻译 以下为原文 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. |
|
|
|
实际上,我将FIFO深度设置为19,并且我读取了20个样本。它的工作原理是因为在DMA缓冲区填充期间,可以使用新的样本,因此我至少可以读取一个样本。
感谢您的帮助,我现在清楚地了解了数据表的这一部分,它可能对其他人有所帮助! 以上来自于谷歌翻译 以下为原文 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 ! |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2827 浏览 1 评论
3267 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1844 浏览 1 评论
3693 浏览 6 评论
6098 浏览 21 评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
395浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
487浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
316浏览 2评论
使用STM32F407VET6的USB2.0功能,发现ctl后芯片无数据返回,是什么原因可能导致的呢?
232浏览 2评论
用STM32G431开发工程,1.50版本的Package包文件无法输出项目工程
339浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-2 20:03 , Processed in 1.053995 second(s), Total 56, Slave 51 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号