2023-03-09 12:00 PM
Hi,
I have the following code to enter shutdown with UART interrupts for the wake up. The processor does shutdown briefly (confirmed with power measurements) and then wakes up after ~.5 seconds. I cannot see any traffic on the serial ports and I can't determine the source of the interrupt that is causing wake up.
I would like to view the PWR (or other?) register to see what source is causing the wake up. Is this possible through the ST Cube debugger with breakpoints or some other means?
Thank you in advance
Richard
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); //not sure this is the correct flag
HAL_SuspendTick();
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
2023-03-09 02:59 PM
So do you mean Shutdown or Stop mode? Yes, you have to read the reference manual to understand anything - clicking CubeMX is not enough! If it's the Stop mode, then most likely it is woken up by some interrupt. Just debug which one it is.
Anyway, all of ST's examples for low-power modes are broken, because the HAL/Cube team cannot understand and implement anything non-trivial. Here are the real explanations and examples:
https://community.st.com/s/question/0D53W00001nYvGgSAK/mc-sdk-not-work-with-mcu-stop-mode
2023-03-10 06:07 AM
Thank you for your reply,
I was using the IDE to interrogate the registers, and I was hoping that someone would know which register shows the interrupt source following a wake up from STOP. It seems like a straightforward task but it has defeated me thus far.
2023-03-10 01:30 PM
Put a breakpoint on __enable_irq() and look at NVIC_ISPRx registers.