• AVR Freaks

PIC24FJ128GC010 Retention Deep Sleep with RTCC and INT0

Author
aliaskappa
New Member
  • Total Posts : 19
  • Reward points : 0
  • Joined: 2017/10/25 06:07:08
  • Location: 0
  • Status: online
2019/09/13 03:38:34 (permalink)
0

PIC24FJ128GC010 Retention Deep Sleep with RTCC and INT0

hello,
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? 
 
#1

1 Reply Related Threads

    aliaskappa
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2017/10/25 06:07:08
    • Location: 0
    • Status: online
    Re: PIC24FJ128GC010 Retention Deep Sleep with RTCC and INT0 2019/09/13 04:06:33 (permalink)
    0
    update:
    I implemented a counter in the interrupt routine
    //<editor-fold defaultstate="collapsed" desc="INTERRUPT INT0">
    void __attribute__((__interrupt__, no_auto_psv)) _INT0Interrupt(void){
        //**************************************************************************//
        //RELESE I/O after deep_sleep
        //**************************************************************************//
        #ifdef DEEP
        usr_RELEASE_IO();
        #endif
        //**************************************************************************//
        //clear the interrupt flag
        //**************************************************************************//
        _INT0IF=0;
        //**************************************************************************//
        interrupt_int0_event=true;
        
        cnt++;
    }
    //</editor-fold>

     
    I checked in debug and the counter increases, but if a resume the debug without restart it the counter result cleared...
     
     
    #2
    Jump to:
    © 2019 APG vNext Commercial Version 4.5