Skip to main content
varo1111
Associate
May 18, 2020
Solved

Entering and exiting stand-by mode on interrupt

  • May 18, 2020
  • 1 reply
  • 1058 views

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.
Best answer by TDK

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.

1 reply

TDK
TDKBest answer
May 18, 2020

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""."