AnsweredAssumed Answered

Wake up timer does not work correctly.

Question asked by Daniel Chai on Sep 16, 2013
Latest reply on Sep 26, 2013 by Daniel Chen

Hi All,

I make the MCU MK60FN1M0VLQ12 to LLS mode and use the following function to set the wake up timer.

But every time, after I call the set_timer_wakeup fucntion, it will enter the timer_wakeup_isr intermediately.

And I put a LED_Toggle command after enter_lls() , it never run that instruction. It seems the wake up timer does not wake up the MCU.

 

Any ideas about this?

 

 

Thank you.

 

-Daniel

 

static void timer_wakeup_isr(pointer parameter)
{
    uint_32 timer = (uint_32)parameter;
   
    /* Stop the timer */
    _lpt_run (timer, FALSE);
    _lpt_clear_int (timer);
   
    /* Do not return to sleep after isr again */
    _lpm_wakeup_core ();
}

 


/*FUNCTION*-----------------------------------------------------
*
* Task Name    : install_timer_interrupt
* Comments     : Installs timer with period 10 seconds.
*
*END*-----------------------------------------------------------*/

 

static void install_timer_interrupt (void)
{
    LPM_REGISTRATION_STRUCT registration;
    uint_32                 dummy_handle;
   
    /* Install the timer */
    if (MQX_OK != _lpt_install (0, 10 * 1000000, LPT_FLAG_CLOCK_SOURCE_LPO, 2, timer_wakeup_isr, TRUE))
    {
        printf ("\nError during installation of timer interrupt!\n");
        _task_block();
    }
   
    /* Stop the timer */
    _lpt_run (0, FALSE);
}

 


/*FUNCTION*-----------------------------------------------------
*
* Task Name    : set_timer_wakeup
* Comments     : Run timer with period set to 10 seconds.
*
*END*-----------------------------------------------------------*/
static void set_timer_wakeup (void)
{
    _lpt_run (0, TRUE);
}

 

 

void main()

{

     install_timer_interrupt();

     set_timer_wakeup();

     enter_lls();

     LED_Toggle;          //It never run this.

}

Outcomes