2025-06-02 6:18 PM
Hi! I am working on a project in which I'd like to use an stm32U0 MCU. It'll be my first time with one of these, and I'm choosing it because my design includes a battery (+charger & fuel gauge), so I'm interested in learning about low-power things.
I have a single button on my device. I'd like to fashion a "hold to power on, hold to power off" functionality with this button. I also am using a fuel gauge that has some LEDs that can be triggered by a pushbutton. I'm trying to wrap my head around how to accomplish two things with a single button, and am considering the use of a MOSFET to accomplish this.
Here comes my question: I think that to "power off" my device, I want my MCU to enter Shutdown mode. I think that I can then wake it back up by connecting my button to a WKUP pin. But, I'm considering whether this pin is controlled directly by my pushbutton, or by way of a MOSFET.
ChatGPT is making a lot of fuss about the 'strict electrical characteristics' of WKUP pins, but I am unable to find a resource that elaborates on this (or, at least, I'm unsure where to look). I don't see anything obvious in the datasheet or the reference manual for the U0 devices, and I've read through a few application notes about low power GPIOs as well, none of which call out anything like strict rise times or thresholds for WKUP pins to serve their function when in a low power mode.
I'm well aware that any AI-based knowledge needs to be taken with a truckload of salt, but I do feel compelled to ask whether what I'm trying to do (activate a WKUP pin by way of a FET) is a reasonable way to handle this, or if I should strictly connect my button to the WKUP pin directly.
Thank you!
2025-06-02 6:59 PM
The chip doesn't know or care how the pin is driven, only that it's driven to the correct level to wake it up. Using a mosfet is fine provided the circuit functions appropriately.
2025-06-03 1:56 AM
I haven't used the U0 device (I mainly use the L4 devices), but I would just connect it to the WKUP pin (with some passive components to try and filter out glitches and protect it from ESD). The software will quietly determine if the button is being pressed long enough to enter a visible "ON" (or "OFF") state. Assume you will get random short pulses/glitches on the WKUP pin - that way your software will be more robust.