1.5.1 Entering Ultra Low-Power Sleep Mode By Setting RETEN = 0 and SRETEN = 1Will Cause the Device to Become Unprogrammable Through ICSP™

Entering Ultra Low-Power Sleep mode by setting RETEN = 0 and SRETEN = 1 will cause the device to not be programmable through ICSP™. This issue occurs when the RETEN bit in CONFIG1L is cleared to '0', the SRETEN bit in the WDTCON register is set to '1' and a SLEEP instruction is executed within the first 350 μs of code execution. This happens after a Reset event, causing the device to enter Ultra Low-Power Sleep mode.

Work around

Use Normal Sleep and Low-Power Sleep modes only, or on any Reset, ensure that at least 350 μs pass before executing the SLEEP instruction when ULP is enabled. To ensure the Ultra Low-Power Sleep mode is not enabled, the RETEN bit in CONFIG1L should be set to a '1' and the SRETEN bit in the WDTCON register should be cleared to a '0'. The following code can be used:
// This will ensure the RETEN bit is set to '1'
#pragma config RETEN = OFF
// This will ensure that the SRETEN bit is '0'
WDTCONbits.SRETEN = 0;

If the Ultra Low-Power Sleep mode is needed, the user must ensure that the minimum time, before the first SLEEP instruction is executed, is greater than 350 μs.

Affected Silicon Revisions

A2A3A4A6A7
X