2025-07-07 11:05 AM - last edited on 2025-07-08 3:52 AM by Andrew Neil
I am using the STM32L433RCT6 and need to assign a GPIO pin as an external interrupt, which will be used to wake and shutdown the MCU (shutdown must use minimal power).
However, I am not sure if I have to use a specific GPIO pin, or if I can use any GPIO pin for the external interrupt ?
The external interrput will be connected to a momentary push button (net PWR_SWITCH)...
There will be a procedure to wake and shutdown the MCU as explained below (there is also a link to a video to demonstrate the procedure)...
Start the switch-on cycle by clicking the button once. After approx. one second, an LED will flash. You must
acknowledge the LED light immediately by clicking the button again. This sequence - a click as soon as the LED appears - will be repeated two more times. After a total of four clicks, the MCU will wake up.
If you do not act promptly after seeing the LED light, or if you push the button too soon, it will ignore the switch-on attempt. This four-click switch-on cycle has been designed to prevent the MCU from being switched on accidentally.
The proceudre to shutdown the MCU will consist of holding the button for a fixed time e.g. 10 seconds
An example is shown in this video...
https://www.youtube.com/watch?v=TpTqGVCbXGE
Solved! Go to Solution.
2025-07-08 8:09 AM
@freeflyer wrote:Using a WKUP pin becuase it allows for lower sleep currents is the sort of advice I am lookng for
You can see that from the tables: the "deeper" sleep modes have only WKUP (not GPIO) as possible wakeup sources.
If that's now answered your question, please mark the solution.
@freeflyer wrote:I believe the 32.768kHz low speed external crystal reduces power consumption ?
That's a whole new question - please start a new thread for a new question.
TL;DR: it depends ...
2025-07-07 11:25 AM
Your info is catch 22. After a total of four clicks, the MCU will wake up = who counts clicks MCU is in standby?
2025-07-07 11:33 AM
I think you need to spend some time reading the Reference Manual for the microcontroller to understand the low-power modes and pick one.
Depending on the mode, a WKUP pin can be used or an EXTI line; capabilities of specific pins are defined in the microcontroller Datasheet.
2025-07-07 11:49 AM
The MCU needs to be in a low power mode where its able to wake from an external interrupt and run the procedure to determine if it can fully wake and operate.
I originally implemented this on the Microchip dSPIC, where it went into a 'sleep' mode but was still able to monitor the external interrupt
2025-07-07 11:56 AM
"a low power mode" is not specific, these devices have as many as 7 available.
"low power" is a relative term...
2025-07-08 3:48 AM - edited 2025-07-08 3:54 AM
@freeflyer wrote:I am using the STM32L433RCT6
So, as the others have said, look at its datasheet to see the low power modes available - there are seven to choose from:
https://www.st.com/resource/en/datasheet/stm32l433rc.pdf#page=23
via: https://www.st.com/en/microcontrollers-microprocessors/stm32l433rc.html#documentation
The modes - including their available wake-up sources - are described in Table 4 on the following pages.
See also the Reference Manual, RM0394.
@freeflyer wrote:I originally implemented this on the (sic) Microchip dSPIC, where it went into a 'sleep' mode but was still able to monitor the external interrupt
Microchip have a whole range of dsPICs.
dsPICs also have a number of different low-power modes - so you must have been through a similar process there?
2025-07-08 7:01 AM
You wrte must minimum power ...
All clocks are stopped (HCLK, PCLKs, etc.)
SRAM and registers are lost (except for backup domain and optionally SRAM2 if configured)
Only Backup domain, RTC, IWDG, and Wake-up pins remain powered
Power consumption is very low (down to ~250 nA)
result to two ways : 1. RTC periodic wake and check pin (any) 2. Only dedicated pin use to wake
OR special combine mode RTC tamper or WU pins
hybrid low-power flow where the STM32L433:
Stays in Standby mode for ultra-low power.
Wakes up on a Tamper (first pulse) event.
Enters Low-Power Run mode temporarily.
Increments a counter stored in backup registers (which survive Standby).
Returns to Standby to wait for the next pulse.
:white_heavy_check_mark: This is very efficient: you use Tamper to wake from Standby, keep processing minimal, store state in retained registers, and go back to ... manage LED in the middle
2025-07-08 7:20 AM
I did see low power modes and how there are 7 types.
But Im not sure which low power mode I need and dont fully understand the information.
Which low power mode would be most suitable for:
2025-07-08 7:28 AM - edited 2025-07-08 7:41 AM
@freeflyer wrote:But Im not sure which low power mode I need and dont fully understand the information.
The key thing that you want is to wake up using a GPIO pin.
So look at the 'Wakeup Source' column to find which modes give the option to wake on a GPIO pin.
This is the only thing that's relevant - the counting of the 4 clicks, etc, is all done once the chip is awake.
Note that waking on a WKUP pin will allow lower sleep currents.
PS:
See Tables 41 and on for the current consumption in the various "low-power" modes
https://www.st.com/resource/en/datasheet/stm32l433rc.pdf#page=113
PPS:
Note that "WKUP Pins" is a Proper Subset of "GPIO Pins";
ie, all WKUP Pins are GPIO Pins, but not all GPIO Pins are WKUP Pins
2025-07-08 7:49 AM
Thanks Andrew
Using a WKUP pin becuase it allows for lower sleep currents is the sort of advice I am lookng for (this device is battery powered so effeciency is critical).
This is why I need to find the most appropriate pin and route it on the PCB. I'm trying to avoid PCB respins as its expensive, so I'm aiming to get tthe design right first time.
I am also using the 32.768kHz low speed external crystal, which I understand generates an 8MHz clock (I copied the design used on the NUCLEO-L433RC-P). I believe the 32.768kHz low speed external crystal reduces power consumption ?
I have allowed provision for an HSE oscillator clock, but its not fitted.