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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
735 Views
w2vy
Contributor V

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

0 Kudos
1 Solution
415 Views
JerryFan
NXP Employee
NXP Employee

Hi Tom,  Please be very careful when _lwmsgq_send used in the ISR.

1, If LWMSGQ_SEND_BLOCK_ON_FULL set, then _task_block maybe called.

2. If LWMSGQ_SEND_BLOCK_ON_FULL not set but the MSGQ is full, the function will fail with LWMSGQ_FULL.

I would like suggest that

1. Just sent a event to a task in the ISR.

2. Send the msg in the task.

View solution in original post

0 Kudos
1 Reply
416 Views
JerryFan
NXP Employee
NXP Employee

Hi Tom,  Please be very careful when _lwmsgq_send used in the ISR.

1, If LWMSGQ_SEND_BLOCK_ON_FULL set, then _task_block maybe called.

2. If LWMSGQ_SEND_BLOCK_ON_FULL not set but the MSGQ is full, the function will fail with LWMSGQ_FULL.

I would like suggest that

1. Just sent a event to a task in the ISR.

2. Send the msg in the task.

0 Kudos