Got a illegal instruction interrupt

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

Got a illegal instruction interrupt

1,379 Views
douglaslps
Contributor I

Hi,

 

I have been working in this project that uses on DSC 56F8037. Summarizing it does send data to AD, reads some data from DA, process that data and repeats the cicle.

 

After a few seconds running I got a Cpu_Interrupt5 (ivINT_MisalignedLongWordAccess) that I was not able to find the problem source.

 

If I continue the execution I get a Cpu_Interrupt2 (ivINT_Illegal_Instruction).

 

I'm not used debugging this kind of error. By the way, my stack is all messed.

 

Can anyone give instructions to debug that? I read that CPU return address RA can be found at SP+6. But I don't know what to do with that, and I don't know if it is valid since my stack is not.

 

Thanks,

Douglas

Labels (1)
Tags (1)
0 Kudos
3 Replies

424 Views
J2MEJediMaster
Specialist I

Those errors are probably from when the CPU gets lost and goes out into the weeds as it executes random bits in memory. Are you using interrupts? If so, check to see that your handler code is cleaning up the stack properly when it exits.

 

---Tom

0 Kudos

424 Views
douglaslps
Contributor I

Hi Tom,

 

I'm not sure if my handler code is cleaning up the stack. Do I have to explicit clean that?

 

All I do is to insert my code inside the function created by Processor Expert. This ADC function "void Audio_Input_OnEnd(void)" has this pragma code before it "#pragma interrupt called ". I'm not sure if I need to comment this pragma instruction or not. But I does not change the behavior I described.

 

Can you help me?

Thanks,

Douglas

 

 

 

0 Kudos

424 Views
ProcessorExpert
Senior Contributor III

Hello,

 

This may came from various issues...

Please check that you have 'Interrupt preserve registers' set to 'yes'  in the ADC component properties (visible in 'expert' view mode that is selected by buttons at the bottom of the inspector). Then comment out or remove '#pragma interrupt called' from the event function.

 

The problem can be also caused by too small stack, you can try to increase it in currently active CPU component's properties at 'Build options' tab - use that property 'Stack size'.

I also recommend to set  'Unhandled interrupts' to 'Own handler for every' that causes that each interrupt will have its own routine and it's easier to diagnose which interrupt came.

 

best regards
Petr Hradsky
Processor Expert Support Team

 

 

0 Kudos