Skip to main content
Visitor II
August 8, 2007
Question

STOP mode in STR71x

  • August 8, 2007
  • 3 replies
  • 783 views
Posted on August 08, 2007 at 12:03

STOP mode in STR71x

    This topic has been closed for replies.

    3 replies

    larry1Author
    Visitor II
    July 18, 2007
    Posted on July 18, 2007 at 18:56

    Greetings...

    I am having trouble exiting from STOP mode on an STR710FZ2. I have included my code below. It seems to go into STOP mode as evidenced by the current consumption, but bringing P0.15 (WAKEUP) high results in absolutely nothing. You'll note that I bring a debug line high when I go into STOP mode. You'll also notice that I bring that line low after resuming from STOP mode. That line never goes low. I've tried with and without disabling the MVR. I've also tried with and without shutting down the flash. Anybody have any ideas? TIA, Larry Wimble

    
    static volatile U32 delayctr; 
    void pwrctl_stop(void) 
    { 
     /* Config the pins for low power consumption */ 
     GPIO_Config(GPIO0, 0xAFF2, GPIO_IN_TRI_CMOS); 
     GPIO_Config(GPIO1, 0x250E, GPIO_IN_TRI_CMOS); 
     GPIO_Config(GPIO2, 0x9F00, GPIO_IN_TRI_CMOS); 
     GPIO_Config(GPIO0, 0x500D, GPIO_OUT_PP); 
     GPIO_Config(GPIO1, 0xDAF0, GPIO_OUT_PP); 
     GPIO_Config(GPIO2, 0x60FF, GPIO_OUT_PP); 
     GPIO_Config(GPIO0, 0x8000, GPIO_IN_TRI_TTL); 
     GPIO_WordWrite(GPIO0, 0x4208); 
     GPIO_WordWrite(GPIO1, 0x00B0); 
     GPIO_WordWrite(GPIO2, 0xE0DF); 
     /* Configure WAKEUP pin */ 
     XTI_Init(); 
     XTI_LineModeConfig(XTI_Line15, XTI_RisingEdge); 
     XTI_LineConfig(XTI_Line15, ENABLE); /* Enable line 15 Wake-Up int 
     */ 
     XTI_ModeConfig(XTI_WakeUp, ENABLE); /* Enable Wake-Up mode */ 
     /* Select the RTC as the system clock */ 
     RCCU_RCLKSourceConfig(RCCU_RTC_CLOCK); 
     RCCU->PLL1CR |= 0x7; /* Switch off PLL1 */ 
     /* Switch off PLL2 as well */ 
     PCU->PLL2CR |= 0x07; 
     /* Delay before stopping the oscillator */ 
     for (delayctr = 0; delayctr < 0x100; delayctr++); 
     /* Stop the external oscillator */ 
     GPIO_BitWrite(GPIO0, 14, 0); 
     /* Disable MVR during STOP mode */ 
     PCU->PWRCR |= 0x8000; 
     PCU->PWRCR |= 0x0010; 
     /* Stop the FLASH during STOP */ 
     FLASHR->CR0 |= 0x8000; 
     /* Set WKUP-int bit in XTI_CTRL register */ 
     XTI->CTRL = 0x01; 
     /* Enter Stop mode */ 
     GPIO_Config(GPIO0, 0x0002, GPIO_OUT_PP); /* DEBUG */ 
     GPIO_BitWrite(GPIO0, 1, 1); /* DEBUG */ 
     PCU_LPMEnter(PCU_STOP); 
     XTI_PendingBitClear(XTI_InterruptLineValue()); 
     GPIO_BitWrite(GPIO0, 1, 0); /* DEBUG */ 
     /* Re-enable the external oscillator */ 
     GPIO_BitWrite(GPIO0, 14, 1); 
     for (delayctr = 0; delayctr < 0x100; delayctr++); 
     /* Back on system clock */ 
     RCCU_PLL1Config(RCCU_PLL1_Mul_12, RCCU_Div_1) ; 
     while(RCCU_FlagStatus(RCCU_PLL1_LOCK) == RESET); /* Wait for lock */ 
     RCCU_RCLKSourceConfig(RCCU_PLL1_Output) ; 
     /* Now reset the MCU */ 
     RCCU->CCR |= (1 << 3); 
     RCCU->CCR |= (1 << 11); 
     RCCU->SMR = (1 << 1); 
    

    Visitor II
    July 19, 2007
    Posted on July 19, 2007 at 06:42

    is the external oscillator running before you come out of stop ?

    I see from your code you enable/disable it. Stop mode needs the external clock to be running in order to resume, you cant resume from stop on the RTC clock. Only WFI & LPWFI modes can do that.

    Ben

    Visitor II
    August 8, 2007
    Posted on August 08, 2007 at 12:03

    Yes, you need to the main oscilator is running before to resume from stop mode. In addtion, once the wakeup event occurs , the MCU resumes from stop mode after a delay of 2048 CLK clock periods which is derived from the external oscillator. ;)