AnsweredAssumed Answered

Set up Deep Sleep, Sleep for Blackfin BF527 problems

Question asked by nick0mg on Sep 11, 2011
Latest reply on Oct 21, 2011 by JoeT

I am trying to use the Deep Sleep and Sleep modes on a Blackfin BF527. The code configures the RTC alarm then sets up Sleep Mode. But Sleep mode isn't entered and will eventually hang, this happens in both Sleep and Deep Sleep.

Can anyone spot any errors I am making?

 

before sleep initiated,

PLL_CTL 0x4201 PLL_STAT 0xa2 PLL_DIV 0x4 PLL_LOCK 0x200
VR_CTL 0xf0b0 CHIPID 0x227e40cb

 

after sleep,

PLL_CTL 0x4201 PLL_STAT 0xa2 PLL_DIV 0x4 PLL_LOCK 0x200
VR_CTL 0xf0b0 CHIPID 0x227e40cb


{
int x,save_iwr0,save_iwr1;
ADI_SYSCTRL_VALUES active;

 

ssync();
while ((*pRTC_ISTAT & (1<<14))) ;
*pRTC_ALARM = ((days << 17) | (hours << 12) | (minutes << 6) | seconds);
*pRTC_ICTL |= 0x2;
*pRTC_ISTAT = 0x807F;
ssync();
while ((*pRTC_ISTAT & (1<<14))) ;

 

*pSIC_IMASK0 |= (1);
*pIMASK      |= (1<<7);
save_iwr0 = *pSIC_IWR0;
save_iwr1 = *pSIC_IWR1;
*pSIC_IWR0    = (1);
*pSIC_IWR0   |= (1<<14);
    
if(1)
{
bfrom_SysControl(SYSCTRL_READ | SYSCTRL_INTVOLTAGE | SYSCTRL_PLLCTL | SYSCTRL_PLLDIV | SYSCTRL_VRCTL, &active, NULL);   
active.uwPllCtl |= PDWN;
active.uwPllCtl &= ~BYPASS;
bfrom_SysControl(SYSCTRL_WRITE | SYSCTRL_PLLCTL | SYSCTRL_INTVOLTAGE, &active, NULL);

x = cli();
idle();
sti(x);
}
else
{
bfrom_SysControl(SYSCTRL_READ | SYSCTRL_PLLCTL | SYSCTRL_VRCTL, &active, NULL);
active.uwPllCtl |= STOPCK;
active.uwPllCtl &= ~PLL_OFF;
active.uwPllCtl &= ~BYPASS;
bfrom_SysControl(SYSCTRL_WRITE | SYSCTRL_PLLCTL | SYSCTRL_VRCTL, &active, NULL);

x=cli();   
idle();
sti(x);
}

bfrom_SysControl(SYSCTRL_READ | SYSCTRL_PLLCTL, &active, NULL);
active.uwPllCtl &= ~BYPASS;
bfrom_SysControl(SYSCTRL_WRITE | SYSCTRL_PLLCTL, &active, NULL);
x=cli();
idle();
sti(x);

*pSIC_IWR0=save_iwr0;
*pSIC_IWR1=save_iwr1;
}

 

Thanks

Outcomes