Hello everybody
I have some problems waking up the CC2431 after sending him to PM 1 or 2, in fact it doesnt wake up, stay forever in the power modes.
Below is posted the code used, it's based on DN106. Anyone knows what's wrong?
Thanks in advance
_Pragma("vector=0x2B") __near_func __interrupt void ST_ISR(void); _Pragma("vector=0x2B") __near_func __interrupt void ST_ISR(void) { ///////////// Code section #2 begin: Switch to [HS XOSC] ///////////// // Power up [HS XOSC] (SLEEP.OSC_PD = 0) SLEEP &= ~0x04; // Wait until [HS XOSC] is stable (SLEEP.XOSC_STB = 1) while ( ! (SLEEP & 0x40) ); // Apply NOPs equivalent to 64 ìs asm("NOP"); // Switch system clock source to [HS XOSC] (CLKCON.OSC = 0) CLKCON &= ~0x40; // Wait until system clock source has actually changed (CLKCON.OSC = 0) while ( CLKCON & 0x40 ); // Power down [HS RCOSC] (SLEEP.OSC_PD = 1) SLEEP |= 0x04; // Clear IRCON.STIF (Sleep Timer CPU interrupt flag) IRCON &= 0x7F; SLEEP &= 0xFC; // Not required when resuming from PM0 ST0=1; ST1=0; ST2=0; } ///////////////////////////////////// //SLEEP //////////////////////////////////// static void sleep(void) { STIF=0;// Clear IRCON.STIF (Sleep Timer CPU interrupt flag) STIE=1; EA=1; ST0=1; ST1=0; ST2=0; SLEEP = (SLEEP & 0xFC) | 0x01; asm("NOP"); asm("NOP"); asm("NOP"); // Power up [HS RCOSC] (SLEEP.OSC_PD = 0) SLEEP &= ~0x04; // Wait until [HS RCOSC] is stable (SLEEP.HFRC_STB = 1) while ( ! (SLEEP & 0x20) ); // Switch system clock source to HS RCOSC (CLKCON.OSC = 1) CLKCON |= 0x40; // Wait until system clock source has actually changed (CLKCON.OSC = 1) while ( !(CLKCON & 0x40) ); // Power down [HS XOSC] (SLEEP.OSC_PD = 1) SLEEP |= 0x04; if (SLEEP & 0x03) { PCON |= 0x01; asm("NOP"); } }