AnsweredAssumed Answered

STM32F030K6 Exit from sleep and stop mode

Question asked by service47.service47 on Dec 10, 2015
Latest reply on Dec 21, 2015 by service47.service47
Hi. Exit from sleep and stop mode not work. When STM32 in sleep mode and push to buttons on pins PA0, PA1, PA2, PA5, PA6, PA7, PA13 (low or high level) STM32 don't exit from sleep mode.

  sleep_counter++;
  if((sleep_counter>=400000)&&(lamp_start==0))
  { 
    GPIO_ResetBits(GPIOF, GPIO_Pin_0);  //A
    GPIO_ResetBits(GPIOF, GPIO_Pin_1);  //B
    GPIO_ResetBits(GPIOA, GPIO_Pin_3);  //C
    GPIO_ResetBits(GPIOB, GPIO_Pin_1);  //D
    GPIO_ResetBits(GPIOA, GPIO_Pin_9);  //E
    GPIO_ResetBits(GPIOA, GPIO_Pin_10);  //F
    GPIO_ResetBits(GPIOA, GPIO_Pin_13);  //G
    GPIO_SetBits(GPIOA, GPIO_Pin_14);  //DP
    
  PWR->CSR = PWR_CSR_EWUP1 | PWR_CSR_EWUP2 | PWR_CSR_EWUP5 | PWR_CSR_EWUP6 | PWR_CSR_EWUP7;
    RTC_AlarmTypeDef  RTC_AlarmStructure;
    RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
    RTC_ITConfig(RTC_IT_ALRA, ENABLE);
    RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
    PWR_WakeUpPinCmd(PWR_WakeUpPin_1,ENABLE);
  sleep_counter=0;
  // Clear Wakeup flag 
  PWR->CR |= PWR_CR_CWUF;
  // Select STANDBY mode 
  PWR->CR |= PWR_CR_PDDS;
  // Set SLEEPDEEP bit of Cortex-M0 System Control Register 
  SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
  // Request Wait For Interrupt 
  __WFI();
  }

Outcomes