Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
rsiigod
Level 3
Level 3
Distributor - WPG(GC)
25 replies posted 50 sign-ins First solution authored

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?

SAC_Ade_Chen_0-1642486034163.png

 

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 (;;)
 {
 }
}

 

0 Likes
1 Solution
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

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

View solution in original post

2 Replies
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

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

AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

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