cancel
Showing results for 
Search instead for 
Did you mean: 

Determination of the reason for wake up following shut down on STM32L471RGT6

rwils.1
Associate III

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);

3 REPLIES 3
Piranha
Chief II

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

https://community.st.com/s/question/0D53W00001bnh8dSAA/how-to-enter-standby-or-shutdown-mode-on-stm32

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.

Piranha
Chief II

Put a breakpoint on __enable_irq() and look at NVIC_ISPRx registers.