Hello,
I've been trying to setup interruptions on PTB5 (Pin 12) of MKE16Z64VLD but it is not working. I am following the example called gpio_input_interrupt present on the SDK but still I cannot get it to work.
void PORTBCD_IRQHandler(void)
{
/*GPIOB5 PORTB PIN 12*/
GPIO_PortClearInterruptFlags(GPIOB, 1U << 5U);
INT= 1;
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
exception return operation might vector to incorrect interrupt */
#if defined __CORTEX_M && (__CORTEX_M == 4U)
__DSB();
#endif
}
int main(void) {
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
/* Init FSL debug console. */
BOARD_InitDebugConsole();
/* Define the init structure for the input pin */
gpio_pin_config_t sw_config = {
kGPIO_DigitalInput, 0,
};
#if (defined(FSL_FEATURE_PORT_HAS_NO_INTERRUPT) && FSL_FEATURE_PORT_HAS_NO_INTERRUPT)
GPIO_SetPinInterruptConfig(GPIOB, 5U, kGPIO_InterruptFallingEdge);
#else
PORT_SetPinInterruptConfig(PORTB, 5U, kPORT_InterruptFallingEdge);
#endif
EnableIRQ(PORTBCD_IRQHandler);
GPIO_PinInit(GPIOB, 5U, &sw_config);
while(1) {
if (INT)
{PRINTF (" Interruption");
INT=0;}
}
return 0 ;
}
As you can see the code I am using is almost the same one as the example. I am kind of clueless of why it may be failing, so any kind of help will be appreciated.
Best Regards,
Pablo Cosgaya