Какая модель микроконтроллера?
например в ерате на STM32L162xD/C/C-A
Цитата
2.1.8 Debugging Stop mode with WFE entry
Description
When the Stop debug mode is enabled (DBG_STOP bit set in the DBGMCU_CR register)
this allows software debugging during Stop mode. However, if the application software uses
the WFE instruction to enter Stop mode, after wakeup some instructions could be missed if
the WFE is followed by sequential instructions. This affects only Stop debug mode with WFE
entry.
Workaround
To debug Stop mode with WFE entry, the WFE instruction must be inside a dedicated
function with 1 instruction (NOP) between the execution of the WFE and the Bx LR.
Example: __asm void _WFE(void) {
WFE
NOP
BX lr }