2021-06-01 03:07 AM
Hi all,
I wan to use WKUP pin exit standby mode for low level trigger.
I set WKUP pin with low level polarity in HAL_PWR_EnableWakeUpPin() function and pull-up WKUP pin.
but the MCU alway wake-up when enter standby mode.
When set WKUP pin with high level polarity, the wakp-up function is working by standby mode.
Could you give some suggestion ? thanks.
WKUP Pin config as blow Bold code:
void RUN_PWR_Mode_Init(RTC_HandleTypeDef *hrtc)
{
//-------Wake up Pin setting---------------------
__HAL_RCC_PWR_CLK_ENABLE();//PWR APB1 clock enable
if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB)!=RESET)
{ // Clear the related wakeup pin flag
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
// Disable all used wakeup sources: Pin3(PE6)
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN3);
}
//-------RTC Wake up setting---------------------
// IT_source =__HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(hrtc, RTC_FLAG_WUTF);
// Wtmr_flag =__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF);
if ((__HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE (hrtc, RTC_FLAG_WUTF) != 0U && __HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF) != 0U)
|| __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE (hrtc, RTC_FLAG_WUTF) == 0U)
{
//Disable RTC WakeUpTimer
HAL_RTCEx_DeactivateWakeUpTimer(hrtc);
//Clear RTC flag
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(hrtc, RTC_FLAG_WUTF);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
}
}
void EnterStandbyPWR_Mode(RTC_HandleTypeDef *hrtc)
{
//-------Wake up Pin setting---------------------
// Disable all used wakeup sources: Pin3(PE6)
HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN3);
// Clear the related wakeup pin flag
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
// Re-enable all used wakeup sources: Pin3(PE6)
HAL_PWREx_EnableInternalWakeUpLine();
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN3_LOW);
//-------RTC Wake up setting---------------------
// IT_source =__HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE(hrtc, RTC_FLAG_WUTF);
// Wtmr_flag =__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF);
if ((__HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE (hrtc, RTC_FLAG_WUTF) != 0U && __HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF) != 0U)
|| __HAL_RTC_WAKEUPTIMER_GET_IT_SOURCE (hrtc, RTC_FLAG_WUTF) == 0U)
{
//Set StnadbyTime
PWRST.StandbyTime_Sec = 30;
//set RTC WakeUpTimer
if (HAL_RTCEx_SetWakeUpTimer_IT(hrtc, PWRST.StandbyTime_Sec, RTC_WAKEUPCLOCK_CK_SPRE_16BITS) != HAL_OK)
{
Error_Handler();
}
}
/* Request to enter STANDBY mode */
HAL_PWR_EnterSTANDBYMode();
}
2021-06-09 03:55 AM
Hello @WWU.807,
Please try this sequence :
Clear the wake up flag after enabling the wake up pin
Mohamed Aymen.
2022-10-26 07:47 AM
Hello WWU.807,
I would like to know if you have found a solution to your problem because I have exactly the same problem with an STM32WB15!.
Thanks,
Joël
2022-10-26 09:09 AM
The particular issue of the original topic is the issue 1 in my article.
@JGuir.1, Mohamed's post provides the same information, but you didn't read it...
EDIT: C'mon do you read anything at all?
https://community.st.com/s/question/0D53W00001t4YMKSA2/stm32wb15-wakeup-pin-polarity-issue