MPU Access Violation ISR

Showing results for 
Search instead for 
Did you mean: 

MPU Access Violation ISR

Contributor I

Hello All,


I am currently working on an S12XEP100. It was required to protect a certain area of the EEPROM ( 0x13F000'G - 0x13F036'G).  We started using the MPU module for protection. Configured the MPU module and protection seems to be working fine.

My problem is that when an write access to that protected areas occurs, the whole software resets. The Can signals stops working. I have to manually switch of and switch on my board.

I wrote an ISR which goes like this :


unsigned char mEep_V_FlashErrorCnt_u32[4]; /*Global variable array*/



  //read the status registers - what caused the error
  mEep_V_MPUBuffer_au32[0] = p_D_MPUFLG;
  mEep_V_MPUBuffer_au32[1] = p_D_MPUASTAT0;
  mEep_V_MPUBuffer_au32[2] = p_D_MPUASTAT1;
  mEep_V_MPUBuffer_au32[3] = p_D_MPUASTAT2;
  //readdesc();  // read descriptors to check  - only for debug
  //insert code to visualize access error, or what you want
  // you can do also nothing from above just clear the flag as below
  // Clear MPU AEF
 p_D_MPUFLG  &= 0x80;



Some how it doesnot go into the interrupt. I have configured the interrupt to MPU access interrupt.  I am using vectors OSCAN for configuring the OS and the ISRs.





P.S. Thanks in Advance,

Do pour in with your valuable suggestions.

Labels (1)
0 Kudos
2 Replies

Specialist I

 I'm not familiar with S12XE MPU, but


1) Isn't SVSEN=0 and CPU12X always in supervisor state? You won't get any MPU interrupt then.


2) What if access violation happens again and again? CPU may enter MPU ISR, return back to access violating code, go again to MPU ISR etc until COP will reset? Are you inspecting contents of emulated EEPROM to see if MPU ISR happened? What if COP reset happens sooner than EEE RAM is flushed to DFLASH?

0 Kudos

Contributor I

Thanks Kef for your repy.


1) Isn't SVSEN=0 and CPU12X always in supervisor state?


As per the datasheet , when the SVSEN bit = 0 : MPU is disabled for the CPU in supervisor state.

When I tried clearing the SVSEN bit, illegal access are not being caught and this is not what I want.I have enabled the MPU for protection certian part of the EEPROM which contains certian parameters needed for my application.


2) I am writing into a protected area only once. The moment, the statement for writing into the protected area is executed, the software stops functioning and the software hangs. Since this happens in the very first write, the question of  the access violation happening again and again doesnot arise.


My problems are as follows.

When I run my code in debugger mode, I am unable to put a breakpoint in the ISR of the MPU Illegal Access Interrupt. And I am incrementing a global variable, the moment the ISR is executed. But in none of the tests I have performed, does this global variable gets incremented which shows that the ISR is never called.


I hope the explanation was lucid enough.


Thanks in Advance.

Please do reply with your valuable suggestions.

0 Kudos