5 Replies Latest reply on Sep 17, 2015 6:28 AM by user_285675076

    RTC Sleep Problems

    user_285675076

      Hello,

         

        I am sure I am missing something here.

         

        Could someone explain to me why the following code does not work? It works when I replace the sleep part with an one second delay.

         

      #include <project.h>

         


      int main()
      {
          
          CyGlobalIntEnable; /* Enable global interrupts. */
            
          //enable the 1 second interval for RTC interrupt
          RTC_WriteIntervalMask(RTC_INTERVAL_SEC_MASK);
          
          //start the RTC
          RTC_Start();
          
          RTC_EnableInt();
          
          /* Place your initialization/startup code here (e.g. MyInst_Start()) */
          
          LED1_Write(0);
          
          for(;;)
          {
              LED1_Write(~LED1_Read());
              
              
              CyPmSaveClocks();
              
              RTC_DisableInt();
              
              CyPmSleep(PM_SLEEP_TIME_NONE,PM_SLEEP_SRC_ONE_PPS);
              
              CyPmRestoreClocks();
              
              RTC_EnableInt();
          }
      }

         

      Thank you!

         

      George