ST意法半导体
直播中

张大妍

8年用户 192经验值
私信 关注
[问答]

如何获得加速度样本对应于触发中断的确切时间

LIS3DH配置为当3轴中任何一个轴上的加速度值超过MCU设置的阈值时,使用INT1中断MCU。首先,据我所知,即使中断被触发,LID3DH也不会停止采样加速度数据(即使在流到fifo模式下,它也不会停止采样,直到fifo变满为止)。它是否正确?如果它是正确的,是否有一种很好的方法可以使加速度数据与触发中断的确切时间相对应?谢谢。

以上来自于谷歌翻译


以下为原文




The LIS3DH is configured to use INT1 to interrupt the MCU when the acceleration value on any of the 3 axis exceed the threshold that is set by the MCU. Firstly, as my understanding, the LID3DH does not stop sampling acceleration data even if the interrupt is triggered (even in stream-to-fifo mode, it does not stop sampling until the fifo gets full). Is this correct? If it's correct, is there a good way to get the acceleration data corresponds to the exact time when the interrupt is triggered? Thanks.

回帖(11)

曾玲娟

2019-3-19 06:35:10
您的理解是正确的,并且stream-to-fifo模式恰好是用于此目的的正确模式。
FIFO内容将由触发事件之前收集的#30个样本,生成中断事件的样本和触发后的一个样本组成。
请查看应用笔记中的9.3.4章
http://www.st.com/content/ccc/resource/technical/document/application_note/77/ed/e7/e1/28/5a/45/d6/CD00290365.pdf/files/CD00290365.pdf/jcr:内容/翻译/ en.CD00290365.pdf


以上来自于谷歌翻译


以下为原文




You understanding is correct and the stream-to-fifo mode is exactly the right mode for the purpose.
FIFO content will be composed of #30 samples collected before the trigger event, the sample that has generated the interrupt event and one sample after the trigger.
Please check chapter 9.3.4 in the application note
http://www.st.com/content/ccc/resource/technical/document/application_note/77/ed/e7/e1/28/5a/45/d6/CD00290365.pdf/files/CD00290365.pdf/jcr:content/translations/en.CD00290365.pdf
.
举报

张大妍

2019-3-19 06:51:05
谢谢回复。我的理解有点不同。在AN3308中,它描述了关于stream-to-fifo模式的以下内容:
因此,据我所知,如果案例2发生,我们仍然无法知道触发器数据在fifo中的位置。对?
那么我是否必须读回fifo中的所有32个数据样本并与我设置的阈值进行比较? fifo中超过阈值的第一个样本是触发数据。

以上来自于谷歌翻译


以下为原文




Thanks for the reply. My understanding is a bit different. In AN3308, it describes following about the stream-to-fifo mode:
So as my understanding, if the case 2 happens, we are still not able to know where in the fifo the trigger data is. Right?
So do I have to read back all the 32 data sample in the fifo and compare to the Threshold I set? The first sample in the fifo that exceed the threshold is the trigger data.
举报

曾玲娟

2019-3-19 07:02:42
您是对的,在第2种情况下,您需要确定哪个样本对应于中断,并且您必须将每个样本与阈值进行比较。但是这种情况只有在你开始测量时才会发生,在32个样本之后FIFO将满,而案例1将会发生。

以上来自于谷歌翻译


以下为原文




You are right, in case 2 you want be sure which sample corresponds to the interrupt and you have to compare each sample with threshold. But this case can happen only when you start your measurement, after 32 samples the FIFO will be full and case 1 will happen.
举报

张大妍

2019-3-19 07:09:00
谢谢回复。因此案例2只在初始状态下发生一次。大多数情况下都是1。
正如AN3308描述的那样,当fifo已满时,它会在触发后停止收集第一个样本的数据,因此触发中断的数据应为F [30]。但是当我在MCU中断时从lis3de读出32个数据(此时fifo应该已满,因为我等待足够的时间)并将数据与阈值进行比较,结果发现触发数据始终为F [ 26。为什么?我正在使用lis3de作为传感器。

以上来自于谷歌翻译


以下为原文




Thanks for the reply. So case 2 just happens once in the initial state. Most cases it's case 1.
As AN3308 describes, when the fifo is full, it stop collecting data at first sample after the trigger, so the data that trigger the interrupt should be at F[30]. But when I read out the 32 data from lis3de when the MCU is interrupted (the fifo should be full at this time because I wait for enough time) and compare the data with the threshold, it turns out the trigger data is always at F[26]. Why? I'm using lis3de as the sensor.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分