Help with Interrupts / Stack error (MCF5282EVB)

Hi all,I m doing a simple timer project where I need DMA timer 0 to triggers an interrupt. It works but very badly.As you can see in the image I attached, the stack is going crazy as it does some weird routines, anddoes not unstack. The exception I get is CASE 14: Format error StackFramePC.

Now the interrupt routines are executed, at least in the internal SRAM (mcf5282). It rolls fine. But when I flash the code, the same interrupt routine is'nt triggerd at all. Its weird because in the SRAM, it is working, bit in the Internal FLASH, the Interrupt routine are'nt showing. We checked the mask register, the SR, ... everything seems ok. What could be wrong?

OK, just a guess... but maybe the exception vector table is not set up correctly?

Also, I did notice from the screen snapshot you posted, that you are calling the interrupt service routine in a slightly unusual way. Nothing wrong with it, but it's not the normal way to do things...

You appear to have all interrupts handled initially by a single routine 'asm_exception_handler', which is then checking the exception number and calling your interrupt-specific routine 'ref_reached_timer_isr'.

A more common way to do this would be to plug the appropriate interrupt-specific entry in the exception vector table, so that when the interrupt happens 'ref_reached_timer_isr' is called directly. The table entry should contain a pointer to your ISR. If the exception vector table is in Flash, the pointer will need to be assembled in.

Also, I did notice from the screen snapshot you posted, that you are calling the interrupt service routine in a slightly unusual way. Nothing wrong with it, but it's not the normal way to do things......

Simon

You are right about it, and thanks by the way. The way the interrupt routine is called is'nt very ...efficient.

So that has been corrected. The isr is now located in the vector table of the exception.c file.

Simon Marsden wrote:

...

A more common way to do this would be to plug the appropriate interrupt-specific entry in the exception vector table, so that when the interrupt happens 'ref_reached_timer_isr' is called directly. The table entry should contain a pointer to your ISR. If the exception vector table is in Flash, the pointer will need to be assembled in.

Hope this helps.

Simon

And finally, maybe in Flash, the isr is'nt called. So what should Ido to be sure that my isr entry in the vector table is good ?