You are here

RTC Sleep Problems | Cypress Semiconductor

RTC Sleep Problems

Summary: 5 Replies, Latest post by George Mois on 17 Sep 2015 06:28 AM PDT
Verified Answers: 2
Last post
Log in to post new comments.
George Mois's picture
User
44 posts

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

user_14586677's picture
User
7648 posts

Post your project so forum can see all settings -

 

“File”                                                             Creator

“Create Workspace Bundle”

 

 

Regards, Dana.

George Mois's picture
User
44 posts

Hi Dana,

  I am sorry, but I don't have the project any more, since I changed to an external RTC with a 1Hz IRQ signal. However, I had the 32kHz clock activated and a RTC component instantiated. The project compiled without giving any error.

Thanks,

George

pvkv's picture
Cypress Employee
82 posts

Hi, Only thing I can see is there should be some delay after power up before you put device into sleep. CyDelay(100) before main loop might help. 

George Mois's picture
User
44 posts

Hello, 

  I attached the project. Maybe it's something electrical, since I have a separate source for the LED, controlled through another PSoC output. However, it does not work. Anyway, it was solved by the external RTC, which, I thing, is a better solution.

  Thank you for your time!

George

George Mois's picture
User
44 posts

THE RTC COMPONENT WAKES UP THE PSoC FROM SLEEP ONLY WITH EXTERNAL 32kHz CRYSTAL.

Sorry for the trouble!

Log in to post new comments.