AnsweredAssumed Answered

How to enter STOP mode in KE04?

Question asked by Abdullah Kahraman on Mar 4, 2015
Latest reply on May 14, 2015 by Abdullah Kahraman

Hello,

 

I am trying to make the KE04 wait in STOP mode for about 1 sec, however it wakes up every 800 us. I have set the RTC timer with 100ms interrupt and I have checked that this is correct by toggling a pin in RTC interrupt. I have SysTick interrupt set at 1 ms and I have checked that this is correct by toggling a pin in SysTick interrupt. Also, when the WFI command is given, SysTick interrupt doesn't toggle the pin that should be toggled in the interrupt, so that means the SysTick timer is stopped.

 

Here is the code I use for testing and the pin is toggled about every 800 us:

 

_100_ms_ctr = 0;
while (_100_ms_ctr < 11) // 1 sec
{
    //Cpu_SetOperationMode(DOM_STOP, NULL, NULL);

    /* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
    SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;
    /* WFI instruction will start entry into STOP mode */
    asm("WFI");
    // Toggle pin
    GPIOA_PTOR = (1 << 10);
}


 

Here is my interrupt code:

 

PE_ISR(RTC_Interrupt)
{
    RTC_SC |= RTC_SC_RTIF_MASK;
    WDOG_CNT = 0x02A6; // write the 1st refresh word
    WDOG_CNT = 0x80B4; // write the 2nd refresh word to refresh counter
    _100_ms_ctr++;
}

 

What is the reason for this?

Outcomes