Skip to main content
varo1111
Associate
May 18, 2020 9:10 AM UTC
Solved

Entering and exiting stand-by mode on interrupt

I'm a beginner in embedded systems. I'm creating a software where some leds are blinking in the main while loop. I would like to put the MCU into stand-by mode when connecting a certain pin. I want to return to normal execution when this pin is disconnected. Right now I'm using a SYS_WKUP pin to exit the stand-by mode. Could I somehow use the same pin to enter stand-by mode. What is the best way to implement this?

Right now i can enter stand-by mode in the middle of the main loop and exit stand-by mode when connecting the pin, but I don't know how to enter the stand-by mode as i connect the pin.

I have the NUCLEO G031K8 and I'm programming with STM32CubeIDE.

This topic has been closed for replies.
TDK
TDKBest answer
May 18, 2020 12:22 PM UTC

Can't you just read the value of the wakeup pin, and if it's high, enter standby?

if (HAL_GPIO_ReadPin(...)) {
 // enter standby
}

I could be missing something.

"If you feel a post has answered your question, please click ""Accept as Solution""."

1 reply

TDK
TDKBest answer
May 18, 2020 12:22 PM UTC

Can't you just read the value of the wakeup pin, and if it's high, enter standby?

if (HAL_GPIO_ReadPin(...)) {
 // enter standby
}

I could be missing something.

"If you feel a post has answered your question, please click ""Accept as Solution""."