NMI management on MPC5602P

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

NMI management on MPC5602P

Jump to solution
1,297 Views
clemNantes
Contributor I

Hi everyone,

 

I'm trying to use NMI on MPC5602P to wakeup the mcu while in sleep mode.

 

I do the folowing :

#pragma push /* save the current state */

#pragma force_active on

#pragma function_align 16 /* We use 16 bytes alignment for Exception handlers */

__declspec(interrupt)

__declspec(section ".__exception_handlers")

void NmiSubRoutine(void)

{

  //uint8_t Reg;

  WKUP.NSR.B.NIF0 = 1;

  WKUP.NSR.B.NOVF0 = 1;

  //MCSR = 0;

  (*NMIHandler)();//call proc

  INTC.EOIR.R = 0;

}

#pragma force_active off

#pragma pop

 

And i have register this function in the ivor branch table :

 

asm void ivor_branch_table_p0(void) {

nofralloc

  .align SIXTEEN_BYTES

IVOR0trap:  b   IVOR0trap /* Critical Input interrupt handler */

  .align SIXTEEN_BYTES

IVOR1trap:  b NmiSubRoutine /* Machine check / (NMI) interrupt handler */

  .align SIXTEEN_BYTES

IVOR2trap:  b IVOR2trap /* Data Storage interrupt handler */

  .align SIXTEEN_BYTES

IVOR3trap:  b IVOR3trap /* Instruction Storage interrupt handler */

ETC...

 

when the mcu is in sleep mode, i assert the NMI pin (making a falling edge) and the procedure show bellow is corectly calling but it look like the function doesn't return properly : after the code bellow is executing the mcu fall in IVOR2trap and doesn't exit from it...

Is anybody know an issue?

Labels (1)
0 Kudos
Reply
1 Solution
989 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Machine check exception requires to use se_rfci instruction for returning from machine check what you achieve by directive __declspec(interrupt critical). Note that this directive is needed to use with e200z0, z1, z3 and z6 cores.

For e200z4 and z7 it is needed to use se_rfmci returning instruction what CodeWarrior achieves by directive __declspec(interrupt machine).

View solution in original post

0 Kudos
Reply
2 Replies
990 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Machine check exception requires to use se_rfci instruction for returning from machine check what you achieve by directive __declspec(interrupt critical). Note that this directive is needed to use with e200z0, z1, z3 and z6 cores.

For e200z4 and z7 it is needed to use se_rfmci returning instruction what CodeWarrior achieves by directive __declspec(interrupt machine).

0 Kudos
Reply
989 Views
clemNantes
Contributor I

Hello David,

Thanks a lot it work very well!!!

0 Kudos
Reply