How do I wake from Stop mode using UART?
Hello all,
After successfully entering Stop mode with my STM32F051, I cannot wake it up. I have referenced this article heavily, but cannot get it to work for me (I see that it is for an F072B): https://github.com/STMicroelectronics/STM32CubeF0/blob/master/Projects/STM32F072B-Discovery/Examples/UART/UART_WakeUpFromStop/Src/main.c
I have been using this method of wakeup:
WakeUpSelection.WakeUpEvent = UART_WAKEUP_ON_ADDRESS; WakeUpSelection.AddressLength = UART_ADDRESS_DETECT_7B;
WakeUpSelection.Address = 0x29;
__HAL_UART_ENABLE_IT(&UartHandle, UART_IT_WUF);
HAL_UARTEx_EnableStopMode(&UartHandle);
After entering Stop mode by sending "stop", how can I wake it up? I cannot get "HAL_UART_RxCpltCallback" to call again. Is that even how I can wake it up, or how do I send 0x29?
uint8_t Rx_data[4]; // creating a buffer of 4 bytes
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
HAL_UART_Receive_IT(&huart1, Rx_data, 4);
if (Rx_data[0] == 's' && Rx_data[1] == 't' && Rx_data[2] == 'o' && Rx_data[3] == 'p') {
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON,
PWR_STOPENTRY_WFI);
}
if (Rx_data[0] == 'w' && Rx_data[1] == 'a' && Rx_data[2] == 'k' && Rx_data[3] == 'e') {
SystemClock_Config();
HAL_UARTEx_DisableStopMode(&huart1);
}
}Any help or tips are appreciated. Thank you in advance!