完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好
我在配置LIS2DH12上的双击中断时遇到了一些困难。 上电后,我正在做以下事情: TEMP_CFG_REG = 0xC0 CTRL_REG4 = 0x80 CTRL_REG1 = 0x77 当PCB处于各种角度时,上述似乎可以工作并为xyz轴提供合理的值。这表明I2C总线正常运行。 接下来我想在y轴上启用点击检测(任何轴都可以开始证明函数有效)。当发生双击时,我想在INT1上发生中断。通过100 kOhm电阻将INT1上拉至3.3 V. 我正在执行以下操作以配置双击功能 CTRL_REG3 = 0x80 CLICK_CFG = 0x08 CLICK_THS = 0x88 tiME_LIMIT = 0xFF //不太确定这个的目的,数据表并不是很清楚 TIME_LATENCY = 0xFF //不太确定这个的目的,数据表并不是很清楚 TIME_WINDOW = 0xFF //不确定这个的目的,数据表并不是很清楚 所有其他寄存器保留其默认值。 然后我在循环中读取CLICK_SRC寄存器。我正在检查第6位是否为1,表示发生了中断。 查看示波器上的INT1引脚,它似乎是切换。我知道INT1将在读取CKICK_SRC后切换,但读回的值表示没有发生双(或单)点击中断。查看数据表我还认为默认情况下禁用了所有其他中断。 如果有人有任何建议或想法,甚至是有效的基本配置,我们将不胜感激。 谢谢 亲切的问候 Chithambaram 以上来自于谷歌翻译 以下为原文 Hi All I am having some difficulties in configuring the Double Click Interrupt on the LIS2DH12. After power up, I am doing the following: TEMP_CFG_REG = 0xC0 CTRL_REG4 = 0x80 CTRL_REG1 = 0x77 The above seems to work and provides sensible values for xyz axis when the PCB is at various angles. This suggests that the I2C bus is functioning correctly. Next I would like to enable click detection in the y- axis (any axis would do to start to prove the function works). I would like an interrupt on INT1 when a double click has occurred. INT1 is pulled up to 3.3 V via a 100 kOhm resistor. I am doing the following in order to configure the Double Click feature CTRL_REG3 = 0x80 CLICK_CFG = 0x08 CLICK_THS = 0x88 TIME_LIMIT = 0xFF //Not really sure the purpose of this, the datasheet is not really clear TIME_LATENCY = 0xFF //Not really sure the purpose of this, the datasheet is not really clear TIME_WINDOW = 0xFF //Not really sure the purpose of this, the datasheet is not really clear All other registers are left at their default values. I am then reading the CLICK_SRC register in a loop. I am checking to see if bit 6 is a 1, which indicates that an interrupt has occurred. Looking at the INT1 pin on the scope, it appears to be toggling. I understand that the INT1 will switch after CKICK_SRC is read, however the value read back indicates that no double (or single) click interrupt has occurred. Looking at the datasheet I also thought that all the other interrupts were disabled by default. If anyone has any suggestions or thoughts or even a working basic configuration, it would be much appreciated. Thank you Kind regards Chithambaram |
|
相关推荐
10个回答
|
|
嗨Chithambaram,
双击识别设置可能很棘手。 有关参数说明,请参阅应用说明http://www.st.com/resource/en/application_note/cd00290365.pdf中的第8章。 。它适用于LIS3DH,但单/双击设置基本相同。请注意时间设置与ODR设置相关联。 这是我的工作设置(ODR = 50Hz),仅供参考: LIR_Click位= 0: LIR_Click位= 1,CLICK_SRC读取后清除中断: 以上来自于谷歌翻译 以下为原文 Hi Chithambaram, double click recognition setup can be tricky. For the parameters explanation please check chapter 8 in application note http://www.st.com/resource/en/application_note/cd00290365.pdf . It is for LIS3DH, but the single/double click settings will be basically the same.Please be aware the time settings is linked with ODR settings. Here is my working setup (ODR=50Hz), just for reference: LIR_Click bit = 0: LIR_Click bit = 1, Interrupt is cleared after CLICK_SRC read: |
|
|
|
你好Miroslav
谢谢你的提示。但是我仍然没有取得多大成功。 回到基础,我只是试图在INT2上获得中断(我的PCB上的INT1有问题)当y轴的加速度超过某个值时。我的比例为+/- 2g。当INT2阈值设置为0x01时,当PCB处于工作台上时,事物似乎会触发。当设置为其他任何东西时,即使PCB受到震动,我也没有得到任何回应。查看静态数据,y轴的计数范围在-14到+10之间 - 来自我所进行的少数测试。 你有什么其他的建议? 谢谢 Chithambaram 以上来自于谷歌翻译 以下为原文 Hi Miroslav Thank you for you tips. However I am still not having much success. To go back to basics, I am simply trying to get an interrupt on INT2 (I have a problem with INT1 on my PCB) when the acceleration in the y-axis exceeds a certain value. I am on the +/- 2g scale. When the INT2 threshold is set at 0x01 the thing seems to trigger when the PCB is on the bench. When set as anything else, even when the PCB is shocked, I do not get any response. Looking at the static data, the y-axis has a count range of between -14 to +10 - from the few tested I have undertaken. Do you have any other suggestions? Thank you Chithambaram |
|
|
|
我想你现在不是在谈论双击配置,而是关于简单的阈值中断。我需要知道传感器的完整配置以及考虑到重力的传感器方向。我可以检查一下,也许我会看到一些问题。还请仔细检查所有与中断发生器设置相关的寄存器,并将中断发生器连接到INT引脚。
以下是简单中断设置的示例: 以上来自于谷歌翻译 以下为原文 I suppose you are not talking about double click configuration but about simple threshold interrupt now. I would need to know complete configuration of your sensor and also orientation of your sensor in consideration of gravity. I can check it, maybe I will see some problem. Please also double check all registers related to interrupt generator settings and linking interrupt generator to INT pins. Here is an example of simple interrupt settings: |
|
|
|
你好Miroslav
谢谢你的提示。很抱歉延迟回复。 我已经使用了您建议的配置并取得了一些成功。这涉及INT2_SRC寄存器,指示中断处于活动状态。不过我的问题是我仍然看不到INT2线上的中断。如前所述,由于短路,我无法在当前PCB上使用INT1线。 我也试过通过CFG6中的相关位来反转中断的极性。 中断线是否需要上拉到Vdd?我曾尝试过无拉动,两极都没有成功。 基于以上所述,看起来中断存在,但没有路由到引脚。我唯一附加到INT2系列的是上拉到Vdd和范围。上拉(使用时)为100 kOhm。 我已经读过读INT2_SRC会清除标志,所以我也尝试将微控制器保持在空循环中,但我仍然看不到示波器上的任何中断。我也试过启用中断锁存(有和没有读取INT2_SRC寄存器)。 这个原型板是内部构建的,因此可能会对部件造成一些损坏,但是引脚之间的连续性检查似乎与预期的一样。应该尽快提供新的电路板,这可能会更好地放置组件。 有关为什么INT2_SRC寄存器指示错误但同样没有反映在引脚上的任何建议。 谢谢 亲切的问候 Chithambaram 以上来自于谷歌翻译 以下为原文 Hi Miroslav Thank you for you tips. Sorry for the delay in responding. I have used the configuration you suggested and am getting some success. This involves the INT2_SRC register indicating that an interrupt is active. However my problem is that I still cannot see the interrupt on the INT2 line. As previously noted I am not able to use the INT1 line on my current PCB due to a short. I have also tried reversing the polarity of the interrupt via the associated bit in CFG6. Do the interrupt lines need to be pulled up to the Vdd? I have tried with and without pull-up and with both polarities with no success. Based on the above, it looks like the interrupt is there, but is not being routed to the pin. The only thing that I have attached to the INT2 line is the pull up to Vdd and a scope. The pull-up (when used) is 100 kOhm. I have read that reading the INT2_SRC will clear the flag, so I have also tried keeping the microcontroller in an empty loop, but still I cannot see any interrupts on the scope. I have also tried enabling the latching of the interrupt (both with and without reading the INT2_SRC register). This prototype board was built in-house, so there is potential for some damage to have occurred the part, however continuity checks between the pins seem to be as expected. New boards should be available soon, which may have better placement of the components. Any suggestions as to why the INT2_SRC register indicates an error but the same is not reflected on the pin. Thank you Kind regards Chithambaram |
|
|
|
是的,我将值0x20发送到寄存器0x25(CTRL_REG6)。
我通过向寄存器0x22(CTRL_REG3)发送0x00来禁用另一个。 谢谢 Chithambaram 以上来自于谷歌翻译 以下为原文 Yes, I am sending the value 0x20 to register 0x25 (CTRL_REG6). I have disabled the other one by sending 0x00 to register 0x22 (CTRL_REG3). Thanks Chithambaram |
|
|
|
你对CTRL_REG6寄存器的设置是什么?
应该有0x20来激活INT2引脚上的中断发生器2。 请注意,该器件有两个独立的中断发生器,可以连接到INT1或INT2引脚。 以上来自于谷歌翻译 以下为原文 What is your setting of CTRL_REG6 register? There should be 0x20 to activate Interrupt generator 2 on INT2 pin. Please be aware that the device has two independent interrupt generators which can be linked to INT1 or INT2 pins. |
|
|
|
好的,Chithambaram。
然后我不知道问题出在哪里。如果您看到中断被触发(基于INT2_SRC值)并且中断发生器连接到INT2(CTRL_REG6 = 0x20),您应该看到引脚上的信号。 为了解决上一个问题,中断引脚具有推挽输出,因此不需要上拉。 我们可以尝试的是检查您的完整传感器设置。如果您向我发送了配置传感器的部分代码,我可以尝试复制并测试它。 如果您不想在此处分享,可以将其作为私人消息发送。 以上来自于谷歌翻译 以下为原文 OK, Chithambaram. Then I don't know where is the problem. If you see the interrupt is triggered (based on INT2_SRC value) and the interrupt generator is connected to INT2 (CTRL_REG6 = 0x20), you should see the signal on the pin. To aswer your previous question, the interrupt pins have push-pull outputs, so pull-up is not needed. What we can try, is to check your complete sensor setup. If you send me part of your code where you configure the sensor, I can try to replicate it and test it. You can send it as private message, if you don't want to share it here. |
|
|
|
|
|
|
|
你好Miroslav
谢谢你的检查。我怀疑它现在可能是我的董事会的一个问题。 如上所述,这是在原型板上,我的“适当”板将很快到达。当他们到达时,我会测试回复的方式。 谢谢 Chithambaram 以上来自于谷歌翻译 以下为原文 Hi Miroslav Thank you for checking. I suspected that it now may be an issue with my board. As noted, this is on a prototype board and my 'proper' boards are due to arrive soon. When they arrive, I will test an reply as to how it went. Thanks Chithambaram |
|
|
|
嗨Chithambaram,
我检查了你的配置,我在我的主板上使用了相同的连接LIS2DH12。 我运作良好。我看到如果我按下或转动传感器,逻辑分析仪会在INT2引脚上触发中断。 如果此配置不起作用,我认为您的主板上存在一些硬件问题。 以上来自于谷歌翻译 以下为原文 Hi Chithambaram, I checked your configuration and I used the same on my board with connected LIS2DH12. I works well. I see the interrupt is triggered on INT2 pin by logic analyzer if I hit or turn the sensor. If this configuration is not working I suppose there is some hardware issue on your board. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2701 浏览 1 评论
3229 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1801 浏览 1 评论
3639 浏览 6 评论
6019 浏览 21 评论
1327浏览 4评论
1382浏览 3评论
201浏览 3评论
191浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
338浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-13 16:43 , Processed in 1.434370 second(s), Total 66, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号