可以的。en.DM00355687这个文件里有提到可以到stop下唤醒。且en.stm32cubel0的例程里有UART_WakeUpFromStop的代码。我是直接跑的,但就是唤醒不了!!不知道错在哪里!!
以下是官方的例程:
/* make sure that no UART transfer is on-going */
while(__HAL_UART_GET_FLAG(&UartHandle, USART_ISR_BUSY) == SET);
/* make sure that UART is ready to receive
* (test carried out again later in HAL_UARTEx_StopModeWakeUpSourceConfig) */
while(__HAL_UART_GET_FLAG(&UartHandle, USART_ISR_REACK) == RESET);
/* set the wake-up event:
* specify wake-up on RXNE flag */
WakeUpSelection.WakeUpEvent = UART_WAKEUP_ON_READDATA_NONEMPTY;
if (HAL_UARTEx_StopModeWakeUpSourceConfig(&UartHandle, WakeUpSelection)!= HAL_OK)
{
Error_Handler();
}
/* Enable the UART Wake UP from stop mode Interrupt */
__HAL_UART_ENABLE_IT(&UartHandle, UART_IT_WUF);
/* about to enter stop mode: switch off LED */
__HAL_RCC_PWR_CLK_ENABLE();
/* enable MCU wake-up by UART */
HAL_UARTEx_EnableStopMode(&UartHandle);
/* enter stop mode */
BSP_LED_Off(LED3);
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
/* ... STOP mode ... */
SystemClock_Config();
/* at that point, MCU has been awoken: the LED has been turned back on */
/* Wake Up based on RXNE flag successful */
BSP_LED_On(LED3);
HAL_UARTEx_DisableStopMode(&UartHandle);
/* wait for some delay */
HAL_Delay(1000);
/* Inform other board that wake up is successful */
if (HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer1, COUNTOF(aTxBuffer1)-1, 5000)!= HAL_OK)
{
Error_Handler();
}
HAL_Delay(1000);
BSP_LED_Off(LED3);
/*##-2- Wake Up second step ###############################################*/
/* make sure that no UART transfer is on-going */
while(__HAL_UART_GET_FLAG(&UartHandle, USART_ISR_BUSY) == SET);
/* make sure that UART is ready to receive
* (test carried out again later in HAL_UARTEx_StopModeWakeUpSourceConfig) */
while(__HAL_UART_GET_FLAG(&UartHandle, USART_ISR_REACK) == RESET);
/* set the wake-up event:
* specify wake-up on start-bit detection */
WakeUpSelection.WakeUpEvent = UART_WAKEUP_ON_STARTBIT;
if (HAL_UARTEx_StopModeWakeUpSourceConfig(&UartHandle, WakeUpSelection)!= HAL_OK)
{
Error_Handler();
}
/* Enable the UART Wake UP from stop mode Interrupt */
__HAL_UART_ENABLE_IT(&UartHandle, UART_IT_WUF);
/* about to enter stop mode: switch off LED */
BSP_LED_Off(LED3);
/* enable MCU wake-up by UART */
HAL_UARTEx_EnableStopMode(&UartHandle);
/* enter stop mode */
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
/* ... STOP mode ... */
/* at that point, MCU has been awoken: the LED has been turned back on */
/* Wake Up on start bit detection successful */
HAL_UARTEx_DisableStopMode(&UartHandle);
/* wait for some delay */
HAL_Delay(100);
/* Inform other board that wake up is successful */
if (HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer2, COUNTOF(aTxBuffer2)-1, 5000)!= HAL_OK)
{
Error_Handler();
}