Satish Perumal

IRQ interrupt Reseting at wake up

Discussion created by Satish Perumal on Oct 10, 2012
Latest reply on Oct 10, 2012 by Satish Perumal



i am using Mc9s12xEQ512, micro hsc12 compiler.

i am facing an issue with IRQ interrupt wake up, i am using three other wake ups, XIRQ and 2 kwp wakeup, i am not having any issue, but when i am waking up the system with IRQ interrupt, the system is Resetting instead of wake up,


i am writting the details about the initalization and code flow for sleep and wake up



Vector table location showing the Address for IRQ


    UnimplementedISR,                 /* 0xFFE0 Enhanced Capture Timer channel 7 */

        UnimplementedISR,                 /* 0xFFE2 Enhanced Capture Timer channel 6 */

        UnimplementedISR,                 /* 0xFFE4 Enhanced Capture Timer channel 5 */

        UnimplementedISR,                 /* 0xFFE6 Enhanced Capture Timer channel 4 */

        UnimplementedISR,                 /* 0xFFE8 Enhanced Capture Timer channel 3 */

        ECTCH2_ISR_Read_PlsInput,                 /* 0xFFEA Enhanced Capture Timer channel 2 */

        ECTCH1_ISR_Read_PlsInput,                 /* 0xFFEC Enhanced Capture Timer channel 1 */

        ECTCH0_ISR_Read_PlsInput,         /* 0xFFEE Enhanced Capture Timer channel 0 */

        UnimplementedISR,                 /* 0xFFF0 Real Time Interrupt */

        IRQ_ISR,                 /* 0xFFF2 IRQ */


        UnimplementedISR,                 /* 0xFFF6 SWI */

        UnimplementedISR,                 /* 0xFFF8 Unimplemented instruction trap */


        UnimplementedISR,                   /* 0xFFFA COP failure reset */

        UnimplementedISR,                  /* 0xFFFC Clock monitor fail reset */



Code involving the sleep and wake up



void Init_Wakeup_modules(void){


  IRQCR.byte = 0xC0;      //IRQ pin is connected to interrupt logic, interrupt is

                           //triggered on fallinge edge


  PPSP.byte =  0x01;       //Select active high interrupt for Parking lamp and active low interrupt for Door open

  PIEP.byte =  0x03;       //Enable KWP0 and KWP1 wakeup interrupts




/* This function checks for the sleep and wakeup control inputs, if not available controller is forced to STOP mode */

void DisableWakeupIntr(void){

  IRQCR.byte = 0;         //Disable external interrupts

  PIEP.byte = 0x00;       //Disable KWP0 and KWP1 wakeup interrupts


  Wkup_Int_Disabled = 1;




void EnableSleep(void){



    Wkup_Int_Disabled = 0;

//--------------------------Port pins disables for power down operation-----------------------


    SPI0.spicr1.bit.spe = 0;

    SPI1.spicr1.bit.spe = 0;


    IIC0.ibcr.bit.iben = 0;




    asm ANDCC #0x6F;  //clear S bit - enable the stop mode. If the S bit is not

                      //cleared then STOP instruction has no effect and is

                      //executed as a dummy instruction NOP.

                  asm STOP;         //Invoke the Stop mode


                  //_Startup();       //Go to startup


                  //Wakeup_Init();      // do only init variable which is required after sleep

    // commented to test the issue of no wakeup after sleep








#ifdef __MWERKS__

#pragma TRAP_PROC


static @interrupt @near


interrupt void IRQ_ISR(void)





i have also attached the power module of my micro and circuitry involving the IRQ for your REF.