none
CeRunAppAtTime not waking up System from Suspend RRS feed

  • Question

  •  Hi,

    I am trying to use CeRunAppAtTime function to resume from suspend mode and run an application couple of seconds after the system enter into suspend mode. I followed the example here: http://geekswithblogs.net/BruceEitman/archive/2008/11/25/windows-ce-waking-the-system-using-the-rtc.aspx

    After suspending the system using SetSystemPowerState(NULL, POWER_STATE_SUSPEND, POWER_FORCE), the application does not run at the specified time. But, if I set the time to run the application but I don't call SetSystemPowerState(NULL, POWER_STATE_SUSPEND, POWER_FORCE), the application runs at the specified time in CeRunAppAtTime.

    How can I set CeRunAppAtTime to wake up and run an application when the system is in suspend mode?

    I am currently using WINCE 7, VS2008 and BSP for i.MX537 from Adeneo.

    Thanks,

    Miguel L.

    Tuesday, September 22, 2015 5:57 PM

Answers

  • Hi Miguel,

    The CeRunAppAtTime() function is used to trigger an event in an application at a specific system time in the future. It's implementation in the BSP relies on the BSP's implementation of the OEMSetRealTime, OEMGetRealTime, and OEMSetAlarmTime functions. In this example, when the CeRunAppAtTime() function is called the kernel will call OEMSetAlarmTime(), which is implemented in oal_rtc_$(SOCDIR).lib which uses the i.MX537's internal RTC to keep track of time. This library uses the i.MX537's internal RTC and enables the alarm interrupt which triggers the SYSINTR_RTC_ALARM sysintr when the time is met. Once the interrupt occurs and the sysintr is triggered, the kernel will be notified and it will then set your event that you gave it with CeRunAppAtTime.

    In the case of suspend, the kernel calls OEMPowerOff() in the OAL to power off controllers, disable clocks, mask interrupts, etc. If an interrupt is not registered with the OAL as a wake up source, then it is automatically masked. I checked the RTC OAL library's implementation, and it does not register the SYSINTR_RTC_ALARM as a wake up source. This means that the RTC is not capable of waking the device from suspend, which means that any alarms that are registered will never fire.

    Regards,

    Adeneo Support team

    Contact us at sales@adeneo-embedded.com

    Thursday, December 10, 2015 9:55 PM

All replies

  • First, does your hardware/OS wake from the RTC, this is necessary to use CeRunAppAtTime().

    Second, what happens if you set the wake time to 120 seconds from when you start to suspend?  (this is just a test, I am not saying that 2 minutes is required.)



    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Eurotech

    Tuesday, September 22, 2015 6:48 PM
    Moderator
  • Hi Bruce,

    Yes, the hardware/OS supports waking up from RTC. I double checked this information with the BSP manufacturer. When I tried using 120-seconds, the system still did not resume from suspend after the time expired. I have to an external wake-up source. But , if I change the mode to user-idle, the application loads after the specified time (after 20-30 seconds) which could be an indication that the RTC is not able to wake up the system.

    Is there any test I can perform to test/confirm the RTC capabilities to wake up the system?

    Thanks,

    Miguel Lopez

    Wednesday, September 23, 2015 6:48 PM
  • The test that I use is the one that you just ran. It would seem that your system is not waking from the RTC.

    You could send your test app to your Vendor(s) and have them confirm that the RTC wakes the system.



    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman
    I work for Eurotech

    Wednesday, September 23, 2015 8:57 PM
    Moderator
  • Hi Miguel,

    The CeRunAppAtTime() function is used to trigger an event in an application at a specific system time in the future. It's implementation in the BSP relies on the BSP's implementation of the OEMSetRealTime, OEMGetRealTime, and OEMSetAlarmTime functions. In this example, when the CeRunAppAtTime() function is called the kernel will call OEMSetAlarmTime(), which is implemented in oal_rtc_$(SOCDIR).lib which uses the i.MX537's internal RTC to keep track of time. This library uses the i.MX537's internal RTC and enables the alarm interrupt which triggers the SYSINTR_RTC_ALARM sysintr when the time is met. Once the interrupt occurs and the sysintr is triggered, the kernel will be notified and it will then set your event that you gave it with CeRunAppAtTime.

    In the case of suspend, the kernel calls OEMPowerOff() in the OAL to power off controllers, disable clocks, mask interrupts, etc. If an interrupt is not registered with the OAL as a wake up source, then it is automatically masked. I checked the RTC OAL library's implementation, and it does not register the SYSINTR_RTC_ALARM as a wake up source. This means that the RTC is not capable of waking the device from suspend, which means that any alarms that are registered will never fire.

    Regards,

    Adeneo Support team

    Contact us at sales@adeneo-embedded.com

    Thursday, December 10, 2015 9:55 PM