完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,
所以我有一个简单的应用程序,GPIO和一个中断。 我希望中断触发在任一边缘。因此,使用GUI I将PIN配置设置为具有上拉的输入,并且输入引脚在任一边缘上触发。然后,我连接了HW连接如上所示,并配置了中断示意组件使用GUI进行自动选择。 因此,在构建和测试之后,中断只在上升沿触发。 我把这个设定好了吗? 谢谢 斯科特 以上来自于百度翻译 以下为原文 Hi, So I have a simple application with a GPIO and an interrupt. I want the interrupt to trigger on either edge. So using the GUI I set the pin configuration as an input with a pull up, and the input pin to trigger on either edge. Then I connected the HW connection as shown above and configured the interrupt schematic component using the GUI for auto-select. So, after building and testing, the interrupt is only triggering on rising edge.... Am I setting this up correctly? Thanks Scott |
|
相关推荐
7个回答
|
|
可以选择这些类型的中断
中断类型 此参数配置组件将处理哪种类型的波形来触发中断。这个参数有三个可能的值: 自动选择触发器-这是默认设置。它检测信号的驱动,并根据信号源推断中断类型。对于大多数固定功能块,中断类型是水平的。对于UDB信号源,中断类型是上升沿。 上升沿触发-触发源信号上升沿上的中断。这种类型的连接使用UDB资源。 级别触发-选择连接到中断的源作为一个级别敏感的连接。所有固定功能外围设备都是电平触发的。 作为准则,在捕获信号改变(例如,周期性时钟)时使用RealIn边缘,并且在捕获外围设备的状态变化时使用电平(例如FIFO填充电平)。 以上来自于百度翻译 以下为原文 You can select these types of Interrupts Interrupt Type This parameter configures which type of waveform the Component will process to trigger the interrupt. There are three possible values for this parameter: ▪ Auto-Select Trigger – This is the default setting. It inspects the driver of the int_signal and infers the interrupt type based on the signal source. For most fixed-function blocks, the interrupt type is LEVEL. For UDB signal sources, the interrupt type is RISING_EDGE. ▪ Rising-Edge Triggered – Triggers the interrupt on the rising edge of the source signal. This type of connection uses UDB resources. ▪ Level Triggered – Selects the source connected to the interrupt as a level-sensitive connection. All fixed function peripherals are level triggered. As a guideline, use RISING_EDGE when capturing a signal change (for example, periodic clock), and use LEVEL when capturing a state change of a peripheral (for example, FIFO fill Levels. |
|
|
|
GPIO引脚 中断设置 此参数选择PIN是否可以产生中断,如果选择,则中断类型。端口上的所有引脚逻辑上或它们的中断在一起,并通过专用端口中断产生单个中断信号。也可以使用设备级组合端口中断(ALPORTIN)信号。这两种类型都可通过全球信号参考组件。 中断发生后,中断源必须在软件中清除,以清除锁存PIN事件,以检测未来事件。这是通过调用CysGPIO-CultSuffStutter()函数实现的。 支持以下选项: 没有默认值。 上升沿 下降沿 双刃 以上来自于百度翻译 以下为原文 The GPIO pin Interrupt settings This parameter selects whether the pin can generate an interrupt and, if selected, the interrupt type. All pins on a port logically OR their interrupts together and generate a single interrupt signal via a dedicated Port Interrupt. A device level Combined Port Interrupt (AllPortInt) signal can also be used. Both types are available through the Global Signal Reference Component. After an interrupt occurs, the interrupt source must be cleared in software to clear the latched pin events to enable detection of future events. This is accomplished by calling the Cy_GPIO_ClearInterrupt() function. The following options are supported: None is Default. Rising Edge Falling Edge Both Edges |
|
|
|
这里有一个小把戏。
如果你看一下NVIC,你会发现在P6中有147种可能的中断源给M4。 芯片上的每个I/O端口(不是PIN…端口)有一个中断信号,每一个引脚产生一个逻辑,或者一起产生端口中断。 此外,每个UDB都具有专用中断信号。 当你直接把插针连接到中断时,你告诉PSoC Creator你想把这个引脚放在UDB上,并在它上面做逻辑来创建和中断。因为某些原因(我不知道)在你的配置,你只能产生下降沿中断。 关于GPIO配置向导你配置端口中断(不是udb中断)。换句话说,你什么也没做。 所以。底线是,如果你需要上升和下降的边缘,你需要使用的端口中断。 你可以用PDL来配置它…或者像这样配置你的示意图: 以上来自于百度翻译 以下为原文 There is a bit of a trick here. If you look at the NVIC you will find that in P6 there are 147 possible sources of interrupts to the M4. Every I/O port on the chip (not pin... port) has one interrupt signal that is generated with a bunch of logic on an per pin basis and or-ed together to generate that ports interrupt. In addition each of the UDBs have dedicated interrupt signals. When you connect the pin directly to the interrupt like that you are telling PSoC Creator that you want to put the pin through a UDB and do logic on it to create and interrupt. For some reason (which I dont know) in your configuration you can only generate falling edge interrupts. On the GPIO configuration wizard you are configuring the PORT interrupt (not the UDB interrupt). In other words you aren't doing anything. So. The bottom line is if you need falling and rising edges you need to use the port interrupt. You can either configure it with PDL... or configure it your schematic like so: |
|
|
|
60user160 发表于 2018-9-27 09:57 你应该看一下中断的应用笔记 HTTP://www. CyPress .COM/DCONTISON/Appult- NoSeN/AN21766PSOC-6MCU-中断 以上来自于百度翻译 以下为原文 And you should look at the application note for interrupts http://www.cypress.com/documentation/application-notes/an217666-psoc-6-mcu-interrupts |
|
|
|
60user160 发表于 2018-9-27 09:57 你好, 再次感谢所有的细节… 所以在附加的图像中,用全局信号图标来显示。 连接到中断图标,它使用原生M4中断而不使用 UDB逻辑? 重申我的理解:根据需要在GUI中配置PIN 两个边,然后在图标中拖动,如图所示,并将其设置为 这个例子,是吗? 当使用PIN GUI设置两个边沿时,这是否等同于 函数调用 Cyg- GPIO-SET中断器(SW2P044L端口,SW2P044nUm,CygGiooIn内两者); CygGPIOSSET中断屏蔽(SW2OP044L端口,SW2OP044nUM,CygGioOi内隐面罩); 因此,代码中不再需要上述调用了吗? 电话之间的区别是什么? CYG-GPIO-OIL中断(PixxxLimiTi端口,PixxLimithnNm); 和 NVICI- CultPangIrrq(IrqxxLimITyFCF.InSrC); 如果闩锁信号被清除,第二个函数是什么? 第一个电话? ——史葛 以上来自于百度翻译 以下为原文 Hi, Again, thanks for all of the details.... So in the additional image you attached, shown with the global signal icon connected to the interrupt icon, that uses the native m4 interrupt and no udb logic? To reiterate my understanding : configure the pin in the gui as needed for both edges, then drag in the icon as you show, and set it up as shown in the example, yes? When you use the pin GUI to set up both edges, is this equivalent to these function calls Cy_GPIO_SetInterruptEdge(SW2_P0_4_PORT, SW2_P0_4_NUM, CY_GPIO_INTR_BOTH); Cy_GPIO_SetInterruptMask(SW2_P0_4_PORT, SW2_P0_4_NUM, CY_GPIO_INTR_EN_MASK); so therefore the above calls are no longer needed in the code? And what is the difference between the calls Cy_GPIO_ClearInterrupt( PIN_X_LIMIT_PORT, PIN_X_LIMIT_NUM ); and NVIC_ClearPendingIRQ( IRQ_X_LIMIT_cfg.intrSrc ); What is the second function used for if the latched signal is cleared with the first call? --Scott |
|
|
|
谢谢,我的代码现在工作如预期… 以上来自于百度翻译 以下为原文 Thank you, my code is now working as expected.... |
|
|
|
因此,在附加的图像中,用全局信号图标显示。 gt;连接到中断图标,使用本地M4中断和 UDB逻辑? 是的,这是正确的。在全局信号上选择你正在谈论的GPIO端口。 所有中断组件都将您的代码挂到NVIC中断表中的正确位置。给你几个API 请重申我的理解:根据需要在GUI中配置PIN 两个边,然后拖动图标,如图所示,并将其设置为 这个例子,是吗? 对的 当使用PIN GUI设置两个边沿时,这是否等同于这些? 函数调用 GygGPIOSSET中断(SW2OP044L端口,SW2P044nUm,CygGiooIn内两者); GygGPIOSSET中断屏蔽(SW2OP044L端口,SW2OP044nUM,CygGioOi内隐面罩); 它几乎是等价的。唯一的区别是那些设置变成二进制,然后当芯片启动时被复制到正确的位置。(我认为) 因此,代码中不再需要上述调用了吗? 对的 电话之间的区别是什么? GygGPIO-Oracle中断(PixxxLimiTi端口,PixxLimithnNm); 如果你在TRM中看,你会发现GPIO的照片。在GPIO端口中,您将找到一个寄存器,它保存端口中的一组信号。然后将该寄存器连接到NVIC。 因此,当您运行上述功能时,您正在清除该寄存器…换句话说,你正在阻止端口保持中断活动。如果你不清楚触发中断,当你完成ISR会马上回到它。 与 NVCI ClutStuangIrq(IrQuxxLimITyFCF.InSrC); 这是清除NVIC中断的CMSIS API。它在ISR中是有效的自动化的。 >;如果锁存信号清除用于第二功能是什么 第一个电话是什么? 你可能比如做这个如果你有中断,在你把中断回到你想清楚可能中断…换句话说,你想你把中断返回之前,把系统分为已知状态。 ——史葛 以上来自于百度翻译 以下为原文 >So in the additional image you attached, shown with the global signal icon >connected to the interrupt icon, that uses the native m4 interrupt and no >udb logic? YEs that is correct. On the global signal pick the GPIO port you are talking about. All the interrupt component does is hook your code up to the right place in the NVIC interrupt table.. and give you a few APIs >To reiterate my understanding : configure the pin in the gui as needed for >both edges, then drag in the icon as you show, and set it up as shown in >the example, yes? Correct >When you use the pin GUI to set up both edges, is this equivalent to these >function calls >Cy_GPIO_SetInterruptEdge(SW2_P0_4_PORT, SW2_P0_4_NUM, CY_GPIO_INTR_BOTH); >Cy_GPIO_SetInterruptMask(SW2_P0_4_PORT, SW2_P0_4_NUM, CY_GPIO_INTR_EN_MASK); It is almost equivalent. The only difference is those settings get turned into binary which are then coped into the right place when the chip boots. (I think) >so therefore the above calls are no longer needed in the code? Correct > And what is the difference between the calls >Cy_GPIO_ClearInterrupt( PIN_X_LIMIT_PORT, PIN_X_LIMIT_NUM ); If you look in the TRM you will find a picture of the GPIO. In the GPIO PORT you will find a REGISTER that holds the OR of a bunch of signals in the port. That register is then connected to the NVIC. So when you run the above function you are CLEARING that register... in other words you are stopping the port from keeping the interrupt active. If you dont clear the triggering interrupt, when you finish the ISR it will jump right back into it. >and >NVIC_ClearPendingIRQ( IRQ_X_LIMIT_cfg.intrSrc ); This is the CMSIS API to clear the NVIC interrupt. It is effectively automatic in an ISR. >What is the second function used for if the latched signal is cleared with >the first call? You might do this for instance if you have interrupts OFF and before you turn the interrupts back on you want to clear possible pending interrupts... in other words you want to put the system into a known state before you turn the interrupts back on. --Scott |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2074 浏览 1 评论
1829 浏览 1 评论
3643 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1765 浏览 6 评论
1517 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
513浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
364浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
413浏览 2评论
360浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
865浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 02:05 , Processed in 0.816446 second(s), Total 61, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号