12G128 Illegal BP issues

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

12G128 Illegal BP issues

963 Views
grace
Contributor I

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();

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

Labels (1)
0 Kudos
Reply
1 Reply

391 Views
kef
Specialist I

You have CPMUCLKS_COPOSCSEL0 = 1  .  And CPMUCLKS_COPOSCSEL1 is probably in its default '0' state.

Reading PCE bit description, it seems that with this COPOSCSELx configuration PCE bit doesn't affect operation in pseudostop mode. To make COP stopped in pseudostop mode yuou need both COPOSCSELx bits  set to zero. This is how I interpret what I see in S12G manual. Since you selected COP clock = oscilator clock, and since it is not stopped in pseudostop mode, I think COP should be running in pseudostop mode.

 

Regarding Illegal BP. Did you set up COP reset vector? If you did it properly, then I would check if your MCU is really stopped on illegal BP. I would not assume debugger is operating properly with new target until proved. I think I saw some debugger (don't remember if it was CW) claiming that target MCU was reset and is halted, but in reality it was running.

0 Kudos
Reply