1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我无法在INT2引脚上产生中断。但我可以在INT1引脚上生成具有相同配置的中断。好像我错过了一些明显的东西,或者数据表缺少一些关键的东西!
我试图从Z轴检测180度翻转。在平坦的表面上,Z轴向上指向我约+ 1g(十进制65,FS = 2)。 180翻转会给我一个负值。这是在INT1引脚上工作的配置。 CTRL_REG1 = 0x5F // ODR = 100Hz,LPen = 1,所有轴启用CTRL_REG2 = 0x42 //参考过滤,中断2上AOI功能的过滤数据 REFERENCE = 50 //将z轴值接近15 CTRL_REG3 = 0x20 // INT1上的IA2中断 CTRL_REG5 = 0x08 //对于INT1的锁存 CTRL_REG6 = 0 INT2_THS = 100 // 180度翻转让我大约-112,参考50 INT2_DURAtiON = 50 // 500ms,ODR = 100Hz INT2_CFG = 0x20 // Z轴上的高电平中断使能 通过上述配置,我可以检测到INT1引脚上的中断。对于INT2引脚我改变了, CTRL_REG3 = 0 CTRL_REG5 = 0x02 // INT2的锁存 CTRL_REG6 = 0x20 // INT2引脚上的IA2中断 ......我没有收到任何打扰。我只是重定向了引脚。这应该工作。除非我遗漏了一些明显的东西。任何帮助都感激不尽。 #accelerometer #mems #interrupt 以上来自于谷歌翻译 以下为原文 I am unable to generate an interrupt on INT2 pin. But I can generate an interrupt with the same configuration on INT1 pin. Seems like I am missing something obvious or the datasheet is missing something crucial!! I am trying to detect a 180-degree flip from Z-axis. On a flat surface, Z-axis pointing upwards gives me approx +1g (decimal 65 with FS = 2). 180 flip will give me a negative value. Here is the configuration that worked on INT1 pin.
With above configuration, I can detect the interrupt on INT1 pin. For INT2 pin I changed,
...and I don't receive any interrupt. I just redirected the pin. This should work. Unless I am missing something obvious. Any help will be much appreciated. #accelerometer #mems #interrupt |
|
相关推荐
2个回答
|
|
你的配置是正确的,它正在工作,但我看到一个小问题可能会造成麻烦。
在第一种情况下,当中断指向INT1引脚时,进行设置 CTRL_REG5 = 0x08,此配置设置中断发生器1的锁存模式,而不是引脚INT1。并且因为您正在使用中断发生器2,所以不使用此设置,并且中断未被锁存(返回0,电路板被翻转回来)。 当您将中断指向INT2时,设置CTRL_REG5 = 0x02,此配置设置中断发生器2的锁存模式。当您使用此中断发生器时,INT2凹坑保持高电平,直到您读取INT2_SRC寄存器为止。 我尝试了两种情况,并且按照您的预期触发了中断,但在第二种情况下,我必须读取INT2_SRC寄存器以清除中断。 以上来自于谷歌翻译 以下为原文 You configuration is correct and it is working, but I see one small issue which probably makes the troubles. In the first case when the interrupt is directed to INT1 pin, you set CTRL_REG5 = 0x08, this configuration set the Latch mode for the interrupt generator 1 not for the pin INT1. And because you are using interrupt generator 2 this settings is not used and the interrupt is not latched (returns back to 0 wen the boards is flipped back). When you direct the interrupt to INT2 you set CTRL_REG5 = 0x02, this configuration set the Latch mode for interrupt generator 2. As you are using this interrupt generator, the INT2 pit remains high until you read INT2_SRC register. I tried both case and the interrupt is triggered as you would expect but in second case I have to read the INT2_SRC register to clear the interrupt. |
|
|
|
我懂了。这就说得通了。让我试试你的建议。
以上来自于谷歌翻译 以下为原文 I see. That makes sense. Let me try your suggestion. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2725 浏览 1 评论
3237 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1807 浏览 1 评论
3646 浏览 6 评论
6034 浏览 21 评论
1337浏览 4评论
197浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
350浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
442浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
273浏览 2评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 17:20 , Processed in 1.225390 second(s), Total 79, Slave 63 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号