Regarding machine exception behavior

cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding machine exception behavior

162 Views
Contributor V

Hi Team,

I am using S12ZVML64 MCU.

I have not implemented the machine exception ISR in my code.

Then,I want to know that,

what will be the behavior of code if machine exception occurred in software?

Thanks in advance.

4 Replies

26 Views
NXP TechSupport
NXP TechSupport

Hello,

I would like to mention that the Machine Exception is not a standard interrupt. 

"machine exception causes the CPU to not perform any stack operations, so it is not possible to return to application code by simply using an RTI instruction."

For more details, please, refer to the S12ZCPU RM section "7.3.3 Machine Exception"

https://www.nxp.com/webapp/Download?colCode=S12ZCPURM 

The Machine Exception routine will result in a crash. The interrupt can be used for MCU reset. Also, it is useful for debugging and check what is the source of the machine exception before the crash.

I hope it helps.

Best regards,

Diana

26 Views
Contributor V

dianabatrlova‌,

Thank you for the response.

I understand the routine will result in crash.

I have a few queries regarding the term crash.

Q1. What exactly does it mean? Will the software behaviour be known or unknown.?

Q2. From the CPU RM : "A Machine Exception causes the S12Z CPU to jump to the address in the Machine Exception vector as
soon as the current instruction finishes execution."

- Now considering that I have not defined the handler of machine exception in my software, when the CPU jumps to the vector of machine exception, it will not find any code to execute . So will CPU try to execute the code/opcode which is present and what is the effect of executing such pre-existing code/opcode ? and is it known what opcode/code is present in such scenario? [example : 0xFF(erased)]. I am not sure it is just an example.

Can you please clarify, if possible on those queries?

Thank you.

0 Kudos

26 Views
NXP TechSupport
NXP TechSupport

Hello,

I have made some tests and when the handler is not defined the code jumps at the 0xFFFFFF address (defined by the erased machine exception vector) which triggers another machine exception.

See the note in the S12ZCPU RM below:

pastedImage_2.png

I hope it helps.

Best regards,

Diana

26 Views
Contributor V

dianabatrlova‌,

Hello,

I understood the above obsevration

So, does it mean that recursive machine exception will be thrown(issued) and the execution of code will be stuck at this erased machine exception vector (0xFFFFFF)

Thank you! 

0 Kudos