cancel
Showing results for 
Search instead for 
Did you mean: 

WUF flag when exiting Standby

Akoli.2
Associate III

Hello.

STM32G070C

I'm having some issues with the WUF flag when exiting Standby. Exit mode is set to WKUP1 (PA0).

I poll the register after exiting standby and in the PWR->SR1 register, the SBF flag is set, but the WUF1 flag is cleared.

I also noticed an error in RM0454 Rev 5, on page 103 in the description of exiting the mode, it says that the SBF flag is in the PWR-> CR3 register, but it is in the SR1 register.

Code example.

void sleep()

{

RCC->APBENR1 |= RCC_APBENR1_PWREN ;

PWR->CR3 = 0x8001;

PWR->CR4 = 0x1;

PWR->CR1 &=~ PWR_CR1_LPMS_Msk;

PWR->CR1 |= 1 | (1 << 1);

PWR->SCR = PWR_SCR_CSBF | PWR_SCR_CWUF1;

SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;

__SEV();

__WFE();

asm("nop");

__WFE();

asm("nop");

}

int main()

{

ClockInit();

_delay_init();

RCC->APBENR1 |= RCC_APBENR1_PWREN ;

if((PWR->SR1 & (PWR_SR1_SBF)) != 0)

{

// I get here

if((PWR->SR1& (PWR_SR1_WUF1)) != 0)

{

// I don't get here

1 ACCEPTED SOLUTION

Accepted Solutions
Akoli.2
Associate III

I figured out the problem today, but did not have time to write here. The problem was that I was parsing the debug data incorrectly. The WUF1 flag is set. I also checked WUF2, this is also set.

thanks for support.

View solution in original post

3 REPLIES 3
Sarra.S
ST Employee

Hello @Community member​,

Are you sure that you're exiting standby mode?

SBF is set which means the device entered standby mode but WUF is cleared means probably you didn't exit the standby mode.

A power-on reset occurs when exiting from standby, all registers [except the ones in the backup domain] are reset, this includes the PWR_SR1 register. The WUF1 flag is only set after exiting standby modes.

I also noticed an error in RM0454 Rev 5, on page 103 in the description of exiting the mode

>> Thank you for reporting the typo, it is tracked internally with ticket number: 154097 (This is an internal tracking number and is not accessible or usable by customers).

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Akoli.2
Associate III

I figured out the problem today, but did not have time to write here. The problem was that I was parsing the debug data incorrectly. The WUF1 flag is set. I also checked WUF2, this is also set.

thanks for support.