Yiye Lv

12G128 Illegal BP issues

Discussion created by Yiye Lv on Dec 28, 2010
Latest reply on Dec 28, 2010 by kef

Hi experts,

I have a problem with 'Illegal BP' error. In my application, COP will be run in normal mode. and COP will be fed in 1ms

loop in normal mode. After CPU enter pesudo stop mode, after a period, 'illegal BP' error will be displayed in real-time debugger window. IP address is 0xFF13, PC address is 0XFF13, Assembly window displays 'FF13 LDS 0xFFFF'. If I disable COP in intializaiton or let ECU not in stop mode, there is no such error. So i doubt it is a watch dog reset. Why does watch dog reset? Any suggestion?

The code is as below,

/***************************************************************************************************

Normal mode COP initialization

***************************************************************************************************/

void MCU_Init(void)

{

    CPMUCLKS_COPOSCSEL = 1;
    SET_REG8(CPMUCOP, 0x07);  //COP time is 4.2s.

}

 

/***************************************************************************************************

Enter Stop mode

***************************************************************************************************/

void HW_SleepModeEnter(void)

{

    DISABLE_INTERRUPTS();
   
    CPMUOSC_OSCE = 1;
    while(CPMUFLG_UPOSC != 1);
    CPMUCLKS_PLLSEL = 0;   //use fosc as bus clock
    CPMUINT_LOCKIE = 0;
   
    ENABLE_MASK_INTERRUPT_WAKE();  //Set CCR 'I' bit
    CPMUCLKS_PCE = 0;  //disable COP in stop mode

    FEED_COP();
   
    CPMUCLKS = CPMUCLKS_PSTP_MASK + CPMUCLKS_PRE_MASK + CPMUCLKS_RTIOSCSEL_MASK;  //Enable pesudo stop and RTI in pesudo stop mode  
    CPMURTI = 0xC3;   //RTI frequency divide rates is 80*10^3, RTI period is 20ms 0xC3;60ms 0xCB
    CPMUINT_RTIE = 1;

 
    /* Explicitly invoke this function just before stop to make sure that MCU can be woken up */
    ENABLE_INTERRUPTS();  

    /* Enable the Stop Mode */
    ENABLE_STOP();  //set CCR 'S' bit
    
    /* Go to sleep (low power consumption mode) */
    STOP();  //asm STOP

}

 

 

/**************************************************************************************************
*   Function:       HW_SleepModeExit
**************************************************************************************************/
void HW_SleepModeExit(void)
{
    /* Disable the Stop Mode */
    DISABLE_STOP();
    
    /* Pet watchdog right after exit sleep mode */
    FEED_COP();

 

    /* Initialize crg module by using xckl as bus clock */
    MCU_InitCRGByXCLK();

    ......................
}

Outcomes