Hi
I am using fallowing config in my code , but once i entered sleep mode, the device is not getting wake up. I am using only internal clock in my board.
#pragma CODE_SEG NON_BANKED
#pragma TRAP_PROC
void interrupt VectorNumber_Vportp PORTPP_ISR(void)
{
unsigned char i=0;
rx_cnt=0;
interrupt_Flag = 1;
do
{
while(SPI1SR_SPIF == 0);
rx_data[rx_cnt] = SPI1DRL;
} while(rx_data[rx_cnt++]!=0xAB);
}
| | PIFP=0x01; //Clear the interrupt flag | | | | | |
}
#pragma CODE_SEG DEFAULT
void main(void)
{
unsigned int i=0;
// clock initialization
ECLKCTL_NECLK = 0; /* Enable ECLK = Bus Clock */
CPMUPROT = 0x26; /* Disable protection of clock configuration registers */
CPMUCLKS_PSTP = 0;
CPMUCLKS_PLLSEL = 1; /* Enable the PLL to allow write to divider registers */
CPMUSYNR = 0x58; /* Set the multiplier register */
CPMUPOSTDIV = 0x00; /* Set the post divider register */
CPMUREFDIV=0x00; //ABP
CPMUPLL = 0x00; /* Set the PLL frequency modulation */
while(!CPMUFLG_LOCK) { /* Wait until the PLL is within the desired tolerance of the target frequency */
}
CPMUPROT=0x00; /* Enable protection of clock configuration registers */
/***Interrupt pin configure****/
DDRP_DDRP0=0; // make as input
PERP_PERP0=1; // pull up enable
PPSP_PPSP0=0;
PIEP_PIEP0=1;
while(1)
{
static int k=0;
/***Controller all devices only when ign on ****/
if(interrupt_flag == TRUE)
{
//Do some task
}
else
{
// CPMUCLKS_COPOSCSEL1=1;
//DisplayString_deb("Bye\r\n");
CPMUCLKS_PSTP = 0; /* Set PSTP bit to enable Pseudo Stop Mode */
asm ANDCC #0x7F; /* Clear S-bit in the CCR to enable STOP instruction */
asm STOP; /* Enter Pseudo Stop mode */
//asm WAI; /* Enter Wait mode */
}
}/* Loop Forever.Code should never reach here */
But i am not able to wake up the device once enters in to sleep mode. Kindly help me regarding this. I want to reduce max current from primary controller. let me know what all things need to check to reduce max current. Any register need to set to make device to wake up from sleep?