cancel
Showing results for 
Search instead for 
Did you mean: 

how to wake from standby mode using RTC 1 min alarm for stm32f030k6t6

Navaneethakannan
Associate

how to wake from standby mode using RTC 1 min alarm for stm32f030k6t6

I got up to stand by code with external wakeup pin interrupt but i dont know how to wake from RTC 1 mins alarm wake up pls any one can help on this

my sample code is

int main(void)

{

HAL_Init();

SystemClock_Config();

MX_GPIO_Init();

if(((PWR->CSR)&(PWR_CSR_SBF)))

{

PWR->CR |= PWR_CR_CWUF;

PWR->CR |= PWR_CR_CSBF;

HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_SET);

HAL_Delay(10000);

HAL_GPIO_WritePin(GPIOB,GPIO_PIN_5,GPIO_PIN_RESET);

HAL_Delay(10000);

}

while(1)

{

//gotosleep();

HAL_GPIO_WritePin(GPIOB,GPIO_PIN_4,GPIO_PIN_SET);

HAL_Delay(20000);

HAL_GPIO_WritePin(GPIOB,GPIO_PIN_4,GPIO_PIN_RESET);

HAL_Delay(20000);

gotosleep();

}

}

void gotosleep()

{

//enable the PWR control cloCk

RCC->APB1ENR |= (RCC_APB1ENR_PWREN);

//Set SleepDeep bit of cortex sys control register//

SCB->SCR |=SCB_SCR_SLEEPDEEP_Msk;

//select standby mode//

PWR->CR |= PWR_CR_PDDS;

//CLEAR WEAKUP FLAG//

PWR->CR |= PWR_CR_CWUF;

//ENABLE WEAKUP PIN//

PWR->CSR |= (PWR_CSR_EWUP1);

//REQUEST WAIT FOR INTERRUPT//

 __WFI();

}

__WFI is need to configure __WFE after that i donot know i am confusing so much how to wake using 1 min RTC alarm

0 REPLIES 0