- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
xxx_ClearInterrupt() works for clearing a GPIO interrupt when connected to the Interrupt component. This is well documented in several example projects and technical articles. No problem there.
When logic is connected to Interrupt component, I expected xxx_ClearPending() would be used, as documented in Interrupt component datasheet. However, after building a simple project to test this, I found xxx_ClearPending() wasn't needed at all. It didn't hurt anything when the code was in place, but commenting it out made no difference. The project worked without issue.
I've attached my example project archive along with 'main' and a screen shot of schematic. It's just 2 switches, 2 LEDs (one is not actually used in this example code), KIT-049-42xx. Input GPIO's have resistive pullup. The switches are normally closed to ground (not to be confused with schematic drawing of switch). When SW1 is pressed, LED0 is ON for 5 seconds. When SW0 is pressed, LED0 is OFF for 5 seconds. During either of the 5 second intervals, the 'other' switch can be pressed and released. This was used to confirm the ISR's were working correctly, both with and without xxx_ClearPending().
Can anybody explain why xxx_ClearPending() is not needed to clear the interrupt?
Bill
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
ARM Cortex M0 has the provision where user can directly trigger the interrupts without the need for corresponding hardware. For this you can use SetPending() and ClearPending() APIs which basically writes to CYREG_CM0_ISPR and CYREG_CM0_ICPR registers.
Therefore it is better to clear the Clearpending() if somewhere in the project if you are using SetPending(). Else there is no need for calling Clearpending().
Please refer the section 4.2.4 from the Arm Cortex M0 generic user guide for more details.
http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/DUI0497A_cortex_m0_r0p0_generic_ug.pdf
The interrupts generated by hardware components are sticky and hence you need to Clear the interrupt from component side using Clearinterrupt() API.
Thanks
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
ARM Cortex M0 has the provision where user can directly trigger the interrupts without the need for corresponding hardware. For this you can use SetPending() and ClearPending() APIs which basically writes to CYREG_CM0_ISPR and CYREG_CM0_ICPR registers.
Therefore it is better to clear the Clearpending() if somewhere in the project if you are using SetPending(). Else there is no need for calling Clearpending().
Please refer the section 4.2.4 from the Arm Cortex M0 generic user guide for more details.
http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/DUI0497A_cortex_m0_r0p0_generic_ug.pdf
The interrupts generated by hardware components are sticky and hence you need to Clear the interrupt from component side using Clearinterrupt() API.
Thanks
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the explanation Ganesh.
Bill