I am using STM32L051 mcu. The mcu goes to STOP mode after initialization and only wakes up if there is any incoming byte at USART1. MCU wakes up with START_BIT_DETECTION on USART1 and goes back to sleep after it receives a byte. Everything works fine.
The problem occurs when I receive a frame error. The other device that is connected with the USART1 sometimes holding the Rx Bus low which leads to a frame error. If I get a frame error I cleared the Frame Error bit, read the byte anynway and go back to STOP mode. But after that no other USART byte can wake up the MCU.
I tried to debug through line by line. Interestingly, when I enable debug I don't have that problem. Maybe that's because I set DBGMCU->CR's DBGMCU_CR_DBG_STOP bit.
So, I am out of ideas why it doesn't wake up after frame error. Any hint, idea, direction would be much appreciated.