1.6.3 The Device May Not Wake From Sleep When Using the MF Internal Oscillator

The device may not wake up from Sleep mode when using the Medium-Frequency Internal Oscillator (MFINTOSC) as the system clock.

Work around

To ensure the device wakes up from Sleep, Use one of the following work arounds:
  1. Use the Low-Frequency Internal Oscillator (LFINTOSC) instead of the MFINTOSC.
  2. If the MFINTOSC must be used as the system clock:
    1. Switch to the LFINTOSC before executing the SLEEP command
    2. Upon wake-up, switch to the 500 kHz MFINTOSC
    3. Wait for the oscillator start-up time to expire (approximately 2 μs)
    4. Check the MFIOFR status bit to ensure the MFINTOSC started up
    5. If the MFIOFR bit is clear, switch to the 500 kHz HFINTOSC
    6. Wait for the oscillator start-up time to expire (approximately 2 μs)
    7. When the HFIOFR bit is set, switch back to the 500 kHz MFINTOSC
OSCCONbits.IRCF = 0x0;         // Select the LFINTOSC
SLEEP();
NOP();
NOP();
OSCCONbits.IRCF = 0x7;         // Select the 500 kHz MFINTOSC
__delay_us(2);                 // Oscillator start-up delay
if(OSCSTATbits.MFIOFR == 0)
{
    OSCCONbits.IRCF = 0xA;     // Switch to the 500 kHz HFINTOSC
}
__delay_us(2);                 // Oscillator start-up delay
if(OSCSTATbits.HFIOFR == 1)
{
    OSCCONbits.IRCF = 0x7;     // Switch back to the 500 kHz MFINTOSC
}

Affected Silicon Revisions

A2A3A5A6A7A8A9
XXXXXXX