- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
The following is written in void ISR_ClearPending (void) explanation.
What does the NOTE description say other than "void ISR_ClearPending(void)" to clear interrupt pending in GPIOs?
Best regards,
Yocchi
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi YoIs_1298666,
I agree. ClearPending() clears the pending state of the interrupt in the NVIC controller to prevent them from being executed again by the CPU and Pin_ClearInterrupt() clears the interrupt at source. It is better to clear the interrupt at source using ClearInterrupt first and then clear the state (if pending) of the interrupt from the NVIC controller.
Regards,
Bragadeesh
Bragadeesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yoshi-san,
The description says to clear the interrupt bit of the corresponding IP block. Generally the interrupt bits of the IP blocks like GPIO, Timer are sticky. So the user has to call Pin_ClearInterrupt() API to clear the pin interrupt, Timer_ClearInterrupt() in case of timer.
If you refer the Interrupts code example in PSoC Creator the ISR definition will be as follows:
CY_ISR(GPIOIsrHandler)
{
/* Clear pending Interrupt */
isr_GPIO_ClearPending();
/* Clear pin Interrupt */
Pin_Sw_ClearInterrupt();
/* Turn On the LED */
LED_Isr_Write(LIGHT_ON);
/* Cause nested software interrupt after 1000 ms */
CyDelay(1000u);
CyIntSetPending(NESTED_ISR);
/* Turn Off the LED */
LED_Isr_Write(LIGHT_OFF);
}
Here please note that both isr_GPIO_ClearPending(); and Pin_Sw_ClearInterrupt(); should be called.
Hope this answers your question.
Thanks
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Ganesh-san,
Thank you very much for your help.
In case of GPIO interrupt, unnecessary interrupts will occur unless the order is as follows.
/* Clear pin Interrupt */
Pin_Sw_ClearInterrupt();
/* Clear pending Interrupt */
isr_GPIO_ClearPending();
What do you think?
Best regards,
Yocchi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi YoIs_1298666,
I agree. ClearPending() clears the pending state of the interrupt in the NVIC controller to prevent them from being executed again by the CPU and Pin_ClearInterrupt() clears the interrupt at source. It is better to clear the interrupt at source using ClearInterrupt first and then clear the state (if pending) of the interrupt from the NVIC controller.
Regards,
Bragadeesh
Bragadeesh