_int_set_exception_handler issue

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

_int_set_exception_handler issue

1,025 Views
ghazy
Contributor I

I am using a kinetis K60 and MQX 3.8. I am trying to add a custom exception handler. Following the post General Technical MQX FAQ Q: How are exceptions or unhandled interrupts handled by MQX?

When I do the following:

- Enable divide by zero trap SCB_CCR |= 1<< SCB_CCR_DIV_0_TRP_SHIFT;

- _int_install_exception_isr();

-_task_set_exception_handler(_task_get_id(), task_exception_handler);

- divide by zero in my code (sum = 2/zero; for example)

It does indeed go to my task_exception_handler.

Here is something I am trying to do:

-SCB_SHCSR |= 0x00070000; // enable Usage Fault, Bus Fault, and MMU Fault

-SCB_CCR |= 1<< SCB_CCR_DIV_0_TRP_SHIFT;

- _int_install_exception_isr();

-_int_set_exception_handler(vectorNum, ISR_exception_handler); // vectorNum are the vector numbers I pass (3,4,5 and 6) hard,mem,bus, and usage fualt.

This doesn't work. What Am I doing wrong?

Thanks

0 Kudos
4 Replies

568 Views
soledad
NXP Employee
NXP Employee

Hello,

Please check the below thread.

Unhandled Interrupt

I hope this helps.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

568 Views
ghazy
Contributor I

After looking at this further I noticed I have MQX_SPARSE_ISR_TABLE defined as 1. This causes a NULL return when _int_get_exception_handler is called in the function _int_exception_isr. At this point I am not what approach I need to take.

0 Kudos

568 Views
ghazy
Contributor I

So I realized that in _int_set_exception_handler you put the vector number of the ISR where the exception occurs. So I divided by zero in a CAN ISR that I am using. In my main I did the following:

_int_install_exception_isr();

_int_set_exception_handler(0x2d, ISR_exception_handler);

I put a breakpoint in my CAN ISR where I divide by zero. I looked at the SCB_ICSR register and the active vector was 0x2d. When I step over it goes to the defualt ISR instead of the custom ISR_exception_handler That I created.

What Am I missing?

Thanks

0 Kudos

568 Views
ghazy
Contributor I

It doesn't talk about _int_set_exception_handler only _task_set_exception_handler. I am trying to replace the defualt ISR handler for usage, hard, mem, and bus faults in the vector table to use a custom one I create.

0 Kudos