AnsweredAssumed Answered

STM32L152 - can't woke from stop mode

Question asked by farkash on Jun 23, 2015
Latest reply on Jun 24, 2015 by farkash
Hi everyone,

I'm trying to write code that  :

1) Enter STOP mode every falling of specific  EXTi pin.
2) Wake up every rising of this pin.

This is my code :


void
EnterStopMode(void)
{
/*
// ASSERT(false); // Code is not written yet
*/
  
  PWR_VoltageScalingConfig(PWR_VoltageScaling_Range3);
  PWR_UltraLowPowerCmd(ENABLE);
  PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);

}


/////////Interrupt routine :

void EXTI4_IRQHandler(void)
{
    /// Falling ///
    if(!(GPIOA->IDR & GPIO_Pin_4))
    {
         EnterStopMode();
    }
   
    /// Rising ///
    if(GPIOA->IDR & GPIO_Pin_4)
    {
           ///Test point/// ---> debug probe
       l_index^=1;
       GPIO_WriteBit(GPIOD,GPIO_Pin_10, (BitAction)l_index);
       //////////////////////////////
       ///////////////////////////////////
    }
    // Clear the  EXTI line 4 pending bit
     EXTI_ClearITPendingBit(EXTI_Line4);
}

///////////////////////////////////////////////////////////////////////
The device is entring stop mode ( I can see it using breakpoints ) , but it doesn't wake.

It stuck there and i can't see any EXTi occur.

Please advice.


Outcomes