Dear all
The ISR of a gpio interrupt triggers only once. I cleared the interrupt flag in the ISR and the interrupts are not disabled anywhere in the code. Does anyone how I can solve that issue? (I am using MQX 4.2 and the Vybrid VF61 Cortex M4)
Interrupt initialisation:
void gpio_init(void)
{
static LWGPIO_STRUCT temp_gpio;
lwgpio_init(&temp_gpio, LWGPIO_PTE14, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE);
lwgpio_set_functionality(&temp_gpio, 1); /*sets the gpio mux to gpio setting*/
lwgpio_set_attribute(&temp_gpio, LWGPIO_ATTR_OPEN_DRAIN, LWGPIO_AVAL_ENABLE);
lwgpio_int_init(&temp_gpio, LWGPIO_INT_MODE_FALLING );
_int_install_isr(lwgpio_int_get_vector(&temp_gpio), portE_int_handler , (void *)&temp_gpio);
_bsp_int_init(lwgpio_int_get_vector(&temp_gpio), 3, 0, TRUE); /*initialize the interrupt and set its priority. */
lwgpio_int_enable(&temp_gpio, TRUE); /*enable the interrupt for use*/
}
ISR:
static void portE_int_handler(void *pin)
{
printf("interrupt happened\n");
lwgpio_int_clear_flag((LWGPIO_STRUCT_PTR) pin);
}
I found out that: the IRQC bits in the corresponding port control register PORT3_PCR13 are reset after the interrupt service routine has been executed. The routine "lwgpio_int_enable" restores the register but after a while it gets set to 0 anyway. I had a look at the implementation in the lwgpio_vgpio.c file but I could not find any obvious errors. Does anyone know where and why the register gets reset?
Very weird. It is hard to locate the cause from your description, maybe resulted from somewhere else.
Regards
Daniel