cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L433RCT6 - Which external interrupt GPIO pin can I used for wakeup ?

freeflyer
Senior

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

freeflyer_0-1751910670814.png

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

View solution in original post

15 REPLIES 15
MM..1
Chief III

Your info is catch 22. After a total of four clicks, the MCU will wake up = who counts clicks MCU is in standby?

Chris21
Senior III

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. 

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

 

Chris21
Senior III

"a low power mode" is not specific, these devices have as many as 7 available.

"low power" is a relative term...

Andrew Neil
Super User

@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:

AndrewNeil_0-1751971254930.png

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?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

You wrte must minimum power ... 

STM32L433 Standby Mode Overview

  • 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:

    1. Stays in Standby mode for ultra-low power.

    2. Wakes up on a Tamper (first pulse) event.

    3. Enters Low-Power Run mode temporarily.

    4. Increments a counter stored in backup registers (which survive Standby).

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

  • ALL this is your job
freeflyer
Senior

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:

  1. Initial wake up using external interrupt on GPIO pin (e.g. on falling or rising edge)
  2. Once woken, run the four-click switch-on cycle (as explained in original post) which requires running code that uses a timer
  3. If the four-click switch-on cycle passes, remain awake and run main code
  4. If the four-click switch-on cycle fails, go back into low power mode 

 

  1. freeflyer_0-1751983783342.png

 

freeflyer_1-1751983810744.png

freeflyer_2-1751983832110.png

 

 

freeflyer_4-1751983900840.png

 

 

 

 

 

 


@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

AndrewNeil_0-1751985262632.png

 

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

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
freeflyer
Senior

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.

 

freeflyer_0-1751985669465.png