PIC24FJ128GC010 Retention Deep Sleep with RTCC and INT0
I have problems in finding the correct entry and exit procedure for Retention Deep Sleep.
After consulting the datasheet of PIC24FJ128GC010, the section 39 of the Family Reference Manual
and some post in this forum, I'm full of doubt!
I isolated from the documents 3 procedures for entry in Retention Deep Sleep, all in assembly and all similar,
but that work differently!
I attach the code of a test project that presents the problem
-if I use the internal RTCC to wake up the device everything works correctly (consumption ~80µA, good for my device).
-if I use the int0 with the same procedure I get a good consumption but it doesn't wake up from Retention Deep Sleep, specifying: I saw a peak of consumption when I triggered an int0, it makes me think that it doesn't execute correctly the I/O release.
-if I use one of the other procedures it works with a not optimal consumption (consumption ~400µA), both with RTCC and INT0
this thing is driving me crazy, what is the correct procedure for entering deep? and which one to get out of it?
why haven't they created a macro like for sleep or idle?