WUF flag when exiting Standby
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
