Hi,
the wake up from standby low power mode using the watchdog works for several times, but sometimes the DSP remains in standby mode. I added code to check the required register settings before executing the IDLE instrcution, but the malfunction also occurs. The emulator cannot be used because of the connection to the processor is lost if the IDLE instruction is executed. Is it a problem of the processor? Here are the related code:
-----------------------------------------------------------------------------------------
Initialization:
-----------------------------------------------------------------------------------------
/* Configure low power mode of DSP - wake up on watchdog event */
EALLOW;
SysCtrlRegs.LPMCR0.bit.WDINTE = 1u;
SysCtrlRegs.LPMCR0.bit.LPM = 1u;
EDIS;
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
Enter low power mode (RTOS task):
-----------------------------------------------------------------------------------------
if (wdogdrv_CfgPwrDwnWakeUp_bol())
{
/* DO NOT enter low power mode when the device is operating in limp mode */
if (0u == SysCtrlRegs.PLLSTS.bit.MCLKSTS)
{
CpuPowerDown_vd();
}
/* change watchdog mode back to reset (delay of min. 512 OSC CLK = 25.6µs) */
if (!wdogdrv_CfgResetMode_bol())
{
/* delay of 25.6µs */
utils_DelayUS_vd(WDOG_INIT_DELAY);
(void)wdogdrv_CfgResetMode_bol();
}
}
-----------------------------------------------------------------------------------------
#pragma CODE_SECTION(CpuPowerDown_vd, "ramfuncs")
static void CpuPowerDown_vd(void)
{
volatile uint16_t restoreIrq_u16;
restoreIrq_u16 = Hwi_enableInterrupt(39);
hw_TEST_PIN3_LOW;
asm(" RPT #7 || NOP "); /* flush instruction pipeline */
asm(" IDLE "); /* CPU goes into power down mode */
hw_TEST_PIN3_HIGH;
Hwi_restoreInterrupt(39, restoreIrq_u16);
}
-----------------------------------------------------------------------------------------
bool wdogdrv_CfgPwrDwnWakeUp_bol(void)
{
bool retVal_bol = false;
EALLOW; /* Enable EALLOW protected register access */
if (0u != (SysCtrlRegs.SCSR & WDINTSTATUS))
{
/* reset counter */
SysCtrlRegs.WDKEY = WDOG_RESET_SEQ1;
SysCtrlRegs.WDKEY = WDOG_RESET_SEQ2;
/* Set watchdog mode to "interrupt mode" */
SysCtrlRegs.SCSR = WDOG_INTR_MODE;
/* WDCR.WDPS: 7 -> WDCLK = OSCCLK/512/4 -> 26.2ms
* WDCR.WDCHK: ALWAYS write 1,0,1 to these bits
* WDCR.WDDIS: 0 -> watchdog is enabled
* WDCR.WDFLAG: 1 -> write a 1 to clear the condition. Writes of 0 are ignored.
*/
SysCtrlRegs.WDCR = (WDOG_ENABLE | WDOG_WDPS_DIV4);
retVal_bol = true;
}
EDIS; /* Disable EALLOW protected register access */
return retVal_bol;
}
-----------------------------------------------------------------------------------------
bool wdogdrv_CfgResetMode_bol(void)
{
bool retVal_bol = false;
EALLOW; /* Enable EALLOW protected register access */
if (0u != (SysCtrlRegs.SCSR & WDINTSTATUS))
{
/* reset counter */
SysCtrlRegs.WDKEY = WDOG_RESET_SEQ1;
SysCtrlRegs.WDKEY = WDOG_RESET_SEQ2;
/* Set watchdog mode to "reset mode" */
SysCtrlRegs.SCSR = WDOG_RESET_MODE;
/* WDCR.WDPS: 7 -> WDCLK = OSCCLK/512/64
* WDCR.WDCHK: ALWAYS write 1,0,1 to these bits
* WDCR.WDDIS: 0 -> watchdog is enabled
* WDCR.WDFLAG: 1 -> write a 1 to clear the condition. Writes of 0 are ignored.
*/
SysCtrlRegs.WDCR = (WDOG_ENABLE | WDOG_WDPS);
retVal_bol = true;
}
EDIS; /* Disable EALLOW protected register access */
return retVal_bol;
}
The sources are compiled and linked with the Code Composer Studio Version 5.3.00.90, Code Generation Tool: 6.1.10 and SYS BIOS Version: 6.34.02.18.
Thanks and regards
Thorsten