- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Operating environment:
Win10
ModusToolBox Version: 2.4.0
Eclipse Build ID: 2460
Evk: CY8CKIT-062-WIFI-BT
if I'm using firmware to config the GPIO interrupt edge then doesn't work.
But when I to setting "Interrupt Trigger Type" through Device Configurator then works fine.
May I ask you seniors, what is the cause of this problem?
source code:
#include "cy_pdl.h" #include "cyhal.h" #include "cybsp.h" bool bf_LEDStatus = 0; void Interrupt_Handler_Port0(void) { Cy_GPIO_ClearInterrupt(P0_4_PORT, P0_4_NUM); bf_LEDStatus = !bf_LEDStatus; Cy_GPIO_Inv(P1_5_PORT, P1_5_NUM); } int main(void) { cy_rslt_t result; /* Initialize the device and board peripherals */ result = cybsp_init() ; if (result != CY_RSLT_SUCCESS) { CY_ASSERT(0); } __enable_irq(); // Interrupt config structure cy_stc_sysint_t intrCfg = { /*.intrsrc=*/ ioss_interrupts_gpio_0_IRQn, /* Interrupt source is GPIO port 3 interrupt */ /*.intrPriority =*/ 4UL /* Interrupt priority is 7 */ }; /* Initialize the interrupt with vector at Interrupt_Handler_Port3() */ Cy_SysInt_Init(&intrCfg, &Interrupt_Handler_Port0); // Send the button through the glitch filter Cy_GPIO_SetFilter(P0_4_PORT, P0_4_NUM); // Falling edge interrupt Cy_GPIO_SetInterruptEdge(P0_4_PORT, P0_4_NUM, CY_GPIO_INTR_FALLING); /* Enable the interrupt */ NVIC_EnableIRQ(intrCfg.intrSrc); for (;;) { } }
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @rsiigod ,
You missed to enable the interrupt mask for the GPIO pin.
Please add the below shown line above the Cy_GPIO_SetInterruptEdge() in the above shown code :
Cy_GPIO_SetInterruptMask(P0_4_PORT, P0_4_NUM, 1uL);
Hope this helps.
Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @rsiigod ,
You missed to enable the interrupt mask for the GPIO pin.
Please add the below shown line above the Cy_GPIO_SetInterruptEdge() in the above shown code :
Cy_GPIO_SetInterruptMask(P0_4_PORT, P0_4_NUM, 1uL);
Hope this helps.
Regards
Alen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @rsiigod ,
Glad your query is resolved.
Please feel free to post any queries or issues you may face on Infineon products on the community and we will be happy to help.
Regards
Alen