cancel
Showing results for 
Search instead for 
Did you mean: 

Entering and exiting stand-by mode on interrupt

varo1111
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

View solution in original post

1 REPLY 1
TDK
Guru

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