AnsweredAssumed Answered

NMI management on MPC5602P

Question asked by Clement LAMBERT on Nov 16, 2015
Latest reply on Nov 17, 2015 by Clement LAMBERT

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?

Outcomes