SHUTDOWN mode WUP Pin works but no WUF is set at wakeup
I've a custom board that going to SHUTDOWN OFF mode
I'm using the LPM lib and it use PA0 as WAKEUP PIN
it wakes up on a High level signal
void PWR_EnterOffMode(void)
{
/* USER CODE BEGIN PWR_EnterOffMode_1 */
// refer to the following link for more details on how to go to Off Mode
// https://community.st.com/t5/stm32-mcus-embedded-software/how-to-enter-standby-or-shutdown-mode-on-stm32/m-p/145849
// https://community.st.com/t5/stm32-mcus-wireless/stm32wb55-shutdown-mode-standby-mode-wake-up-with-syswkup-pin/m-p/67480#M812
/* Enable Backup domain write */
HAL_PWR_EnableBkUpAccess();
/*Disable RTC */
CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
/* Disable LSE */
CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON);
/* Disabel Backup domain write */
HAL_PWR_DisableBkUpAccess();
/* See : https://community.st.com/t5/stm32-mcus-embedded-software/how-to-enter-standby-or-shutdown-mode-on-stm32/m-p/145849 */
/* USER CODE END PWR_EnterOffMode_1 */
/**
* The systick should be disabled for the same reason than when the device enters stop mode because
* at this time, the device may enter either OffMode or StopMode.
*/
HAL_SuspendTick();
EnterLowPower();
/************************************************************************************
* ENTER OFF MODE
***********************************************************************************/
/*
* There is no risk to clear all the WUF here because in the current implementation, this API is called
* in critical section. If an interrupt occurs while in that critical section before that point,
* the flag is set and will be cleared here but the system will not enter Off Mode
* because an interrupt is pending in the NVIC. The ISR will be executed when moving out
* of this critical section
*/
LL_PWR_ClearFlag_WU();
LL_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
LL_LPM_EnableDeepSleep(); /**< Set SLEEPDEEP bit of Cortex System Control Register */
/* Disable all used wakeup sources */
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1_LOW);
/* Clear all wake up Flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF1);
/* Enable WakeUp Pin PWR_WAKEUP_PIN1 connected to PA0 */
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_HIGH);
/* Clear all related wakeup flags*/
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF1);
// Disable debug, trace and IWDG in low-power modes
DBGMCU->CR = 0;
/**
* This option is used to ensure that store operations are completed
*/
#if defined (__CC_ARM) || defined (__ARMCC_VERSION)
__force_stores(); // comment : looks that CC_ARM or ARMCC_VERSION are not define and therefore not build
#endif
for(;;){
__DSB();
__WFI();
}
}it works ok for waking the cpu but I have no WF1 set in PWR->SR1 register at wakeup
so I'm not able to differenciate a WKUP of a BORRST
I've try different relative orders of actions and nothing seems to act on WUFx
any idea would be greatly appreciated
