Skip to main content
DIvan.1
Associate III
June 21, 2021
Question

How to Turn ON the STM32 with button?

  • June 21, 2021
  • 5 replies
  • 3209 views

Hello!

I have a question about power supply and ON/OFF capabilities of microcontroller.

Normally, When power supply is turned ON, the microcontroller Start executing the program.

In my case I want that after Power supply is turn ON, the microcontroller have power but not executing the program code. With powerON button I will start the program (like it is in the computer).

In short word. I want to turn ON the microcontroller with the button, like PC.

Is there any elegant solution for the problem written above?

All the best,

Domen

    This topic has been closed for replies.

    5 replies

    srikanth
    Associate III
    June 21, 2021

    Hello Dlvan

    At stage of board power on keep the reset pin to low by using on/off switch. When you want to run the code just make the reset pin high by using on/off switch.

    Tesla DeLorean
    Guru
    June 21, 2021

    Like it enters Standby and you Wake it?​

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    DIvan.1
    DIvan.1Author
    Associate III
    June 21, 2021

    Yes, something like this.

    Paul1
    Senior III
    June 21, 2021

    On powerup you may need to wait till the input signal is stable.

    So before the EnableWake, do a loop that waits till the PIN has been in non-wake state for several samples.

    Do you have any debounce on the switch input? A capacitor may take time to ramp up/down depending on resistor size.

    Write some code to sample to read the input to an array many times at powerup (array[1000] and then put breakpoint and look at how many cycles it takes for pin to stabilize. If just using a delay then wait double that time to be safe (temperature and component aging variations)

    (The world of digital - isn't always very digital)

    Paul