AnsweredAssumed Answered

Full-On to Deep-Sleep Query

Question asked by stephenf on Sep 23, 2010
Latest reply on Sep 29, 2010 by PrasanthR

Hi all,

I carried out the PowerDemo in the Power Management examples on my BF537 EZKit which rund from Full-On, to Active (PLL Enabled to Disabled), to Sleep, wake up to Full-On, to Deep-Sleep, wake up to Full-On. This works fine.

 

I wrote my own version which carried out the Full-On to Active to Sleep, wakeup to Full-On, to Deep-Sleep, wakeup to Full-On, and repeat. The changes in state were triggered by the RTC, as were the wakeups from sleep. This works fine.

 

Now I want an example where I just go from Full-On straight to Deep-Sleep. So using the same code I just changing the interrupt handler so that the first interrupt by the RTC causes a Full-On to Deep-Sleep change. Now in this case the processor goes into Deep-Sleep, but doesn't wake up with the RTC. All commands etc are as with the previous example. The only difference being that I don't do the other power mode changes first.

 

Any ideas as to why this doesn't wake up from Deep-Sleep? Code examples below....most of which is copied from the power management example.

 

 

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

This works fine

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

 

ADI_INT_HANDLER(RealTimeClockHandler)
{
// Check to see if the RTC caused this interrupt, return if not
if ( !adi_int_SICInterruptAsserted(ADI_INT_RTC) )
return ADI_INT_RESULT_NOT_PROCESSED;
*pRTC_ISTAT = CLEAR_RTC_IRQS; // Acknowledge RTC Interrupt Request
*pRTC_SWCNT = 0x0005; // Reset Stopwatch for 5 Seconds
//if coming from sleep or deep sleep turn back to full on
if((CurrentState==2)|(CurrentState==3))
{
//turn to full on
adi_pwr_SetPowerMode(ADI_PWR_MODE_FULL_ON);
if(CurrentState==3) //deep sleep
{
// Access SDRAM to take it out of self-refresh
AccessSDRAM();
}
}
ADI_PWR_RESULT PWRResult;
switch(CurrentState)
{
case 0: //Full on -> Active
CurrentState++;
PWRResult = adi_pwr_SetPowerMode(ADI_PWR_MODE_ACTIVE);
break;
case 1: //Active -> Sleep
CurrentState++;
adi_int_SICDisable(ADI_INT_RTC);
PWRResult = adi_pwr_SetPowerMode(ADI_PWR_MODE_SLEEP);
adi_int_SICEnable(ADI_INT_RTC);
break;
case 2: //Full on -> Deep Sleep
CurrentState++;
adi_int_SICDisable(ADI_INT_RTC);
PWRResult = adi_pwr_SetPowerMode(ADI_PWR_MODE_DEEP_SLEEP);
adi_int_SICEnable(ADI_INT_RTC);
break;
case 3:
CurrentState = 0;
break;
}
return ADI_INT_RESULT_PROCESSED;
}

 

 

 

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

This doesn't work.

Order of states 0 and 2 is just switched around.

All other code is the same.

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

 

ADI_INT_HANDLER(RealTimeClockHandler)

{

ezTurnOnLED(5);

ezTurnOnLED(CurrentState);

ezDelay(100);

ezTurnOffAllLEDs();

 

// Check to see if the RTC caused this interrupt, return if not

if ( !adi_int_SICInterruptAsserted(ADI_INT_RTC) )

return ADI_INT_RESULT_NOT_PROCESSED;

 

*pRTC_ISTAT = CLEAR_RTC_IRQS; // Acknowledge RTC Interrupt Request

*pRTC_SWCNT = 0x0005; // Reset Stopwatch for 5 Seconds

 

//if coming from sleep or deep sleep turn back to full on

if((CurrentState==1)|(CurrentState==2))

{

//turn to full on

adi_pwr_SetPowerMode(ADI_PWR_MODE_FULL_ON);

 

if(CurrentState==1) //deep sleep

{

// Access SDRAM to take it out of self-refresh

AccessSDRAM();

}

}

 

 

ADI_PWR_RESULT PWRResult;

switch(CurrentState)

{

case 0: //Full on -> Deep Sleep

CurrentState++;

adi_int_SICDisable(ADI_INT_RTC);

PWRResult = adi_pwr_SetPowerMode(ADI_PWR_MODE_DEEP_SLEEP);

adi_int_SICEnable(ADI_INT_RTC);

break;

case 1: //Active -> Sleep

CurrentState++;

adi_int_SICDisable(ADI_INT_RTC);

PWRResult = adi_pwr_SetPowerMode(ADI_PWR_MODE_SLEEP);

adi_int_SICEnable(ADI_INT_RTC);

break;

case 2: //Full on -> Active

CurrentState++;

PWRResult = adi_pwr_SetPowerMode(ADI_PWR_MODE_ACTIVE);

break;

case 3:

CurrentState = 0;

break;

}

 

 

return ADI_INT_RESULT_PROCESSED;

}

Outcomes