AnsweredAssumed Answered

Unhandled Exception for vector I have installed a handler for!?

Question asked by Tom Moulton on Apr 11, 2013
Latest reply on Apr 11, 2013 by Jerry Fan

I am using a K60


I do not understand why I am getting an Unhandled Exception for a vector I have installed a handler for!

 

I am using a pin on PortE and initialize as follows:

 

#ifdef __MQX__
 if (!lwgpio_init(&fpga_irq, BSP_FPGA_IRQ, LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE)) {
    sprintf(zarr, "Error opening FPGA IRQ %d\r\n", _task_errno);
    MON_PRINTF(zarr);
    _task_block();
 }
 lwgpio_set_functionality(&fpga_irq, 1); // MUX=1 is GPIO
 lwgpio_set_attribute(&fpga_irq, LWGPIO_ATTR_PULL_UP, LWGPIO_AVAL_ENABLE);
 if (!lwgpio_int_init(&fpga_irq, LWGPIO_INT_MODE_FALLING)) {
         MON_PRINTF("Initializing button GPIO for interrupt failed.\n");
         _task_block();
     }
 /* install gpio interrupt service routine */
 _int_install_isr(lwgpio_int_get_vector(&fpga_irq), FPGA_lisr, (void *) &fpga_irq);
 /* set the interrupt level, and unmask the interrupt in interrupt controller*/
 _bsp_int_init(lwgpio_int_get_vector(&fpga_irq), 3, 0, TRUE);
 /* enable interrupt on GPIO peripheral module*/
 lwgpio_int_enable(&fpga_irq, TRUE);
#endif

 

And my ISR looks like this:

 

 

VOID FPGA_lisr(void *pin) {
   FPGA_QUEUE_MSG msg;
   lwgpio_int_clear_flag((LWGPIO_STRUCT_PTR)pin);
   /* do stuff and send message (maybe) and return */
   msg.type = FPGA_IRQ;
   msg.arg[0] = HS_Flags;
   msg.arg[1] = IDLE_Flags;
   msg.arg[2] = pm_last_lisr;
   msg.arg[3] = pm_last_lisr;
   _lwmsgq_send(fpga_queue, (uint32 *)&msg, 0);
}

 

 

The interrupt does work but in short order I find myself getting a task exception set in _int_default_irs

 

I have a breakpoint set there and the vector is the same as the one I installed the handler for.

 

What could cause that?

 

Tom

Outcomes