cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 Series: Shutdown/Low Power Mode High-Level Question

KMew
Senior III

Hello,

I am working with the STM32H7B3IIT6 MCU and it is controlling many features (CANbus, BLE, LCD Display, push buttons, etc.).

One feature we're going to have on our system, naturally, is a simple on/off button that powers the overall system on and off (peripherals off, display off, etc.). However, I am unfamiliar on how to do this in a way that does not limit the user's ability. In other words, I want them to be able to turn everything off with one button, then turn it on again with the same button in a toggling setup.

I'm unsure of the best approach for handling this so I have some high level questions.

1) Is there a way to enter a "low power" state for the MCU that is in standby mode?

2) IF yes to (1), will the peripherals automatically (CANbus, BLE, LCD, etc.) turn off when the MCU is in standby mode? Or do I have to de-initialize them as well?

3) What are the important things to consider when powering the MCU down?

4) Does entering standby require the use of specific IO pins?

I apologize if this is broad, but I need somewhere to start.

11 REPLIES 11
Sarra.S
ST Employee

Hello @KMew​ 

1) If you're asking whether you can enter to a 'lower' mode (Shutdown) when the MCU is already in standby mode, the answer is no! the only way to exit standby mode is by generating a reset signal, such as a wakeup event from an external interrupt or a reset pin.

and shutdown mode can only be entered from the run mode.

But you can still optimize consumption in standby mode by other techniques!!

3) you need to consider that in standby mode, MCU disables its internal oscillator and all peripherals, and puts the CPU and RAM in a low-power state.

4) no it doesn't require any specific I/O pins, however you may need to configure certain IO pin to trigger a wakeup event that will bring the microcontroller out of standby mode(EXTI).

You only need to execute specific code to enter standby

Hope that helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

LCE
Principal

I would try to solve that by turning off device power completely. No standby currents, zero energy, clean power-up with an external reset controller.

Hello LCE,

Thank you for the reply!

Our customer desires the ability to turn the system on/off via the controller on this board, so if the power was lost via pressing the push button, then it would not be active and capable of receiving a turn on command.

We proposed having it control a mechanical connection that connects the battery to this board, but they did not want to go that avenue :(

So instead, we are trying to have it sit in idle standby mode to reduce power consumption as much as possible to slow depletion of the battery. Fortunately, it is a larger one (~1500 Wh), but we want to maximize the "standby" battery life into the months range.

Hello Sarra,

Thank you for the reply!

1) That wasn't quite my question. I was more asking about the states that exist that are shutdown. I did so some looking around and found three possible states (sleep, stop and standby) and tried to understand the differences between each state.

It seems Sleep doesn't reduce power consumption by much as it only turns off the CPU clock and it awakens easily (any event or interrupt)

Stop maintains RAM and Register content, but stops VCORE, PLL, HSE oscillators, etc. But the LSE oscillator is kept running to maintain a very basic signals.

Standby is the lowest power consumption, but also the hardest to wake up from (very specific pins only can wake it up)

Is the logic above all correct?

4) Based on what I described above, Stop sounds sufficient for my application. If that is acceptable, then I can activate Stop mode via HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWE_SLEEPENTRY_WFI), correct?

And my follow-up questions based on above:

1) If I use stop mode, if I only want to leave stop mode when a push button is pressed, how do I disable all interrupts except that one specifically?

2) My understanding is that interrupts can get it out of stop mode. Does it have to be a specific "wakeup" interrupt, or is it any interrupt?

Hello again @KMew​ 

Thanks for your clarifications

You can refer to this article ( it uses another STM32 board, but u can see the differences between each mode : consumption and code ) : it'll answer question 1) and 4)

Also for question 4) there are examples in the CubeFW that you can check.

regarding your follow-up questions :

1) Step1 : you should enable the interrupt of push button and configure it on the rising edge (or falling edge) of the button press. This will ensure that the interrupt is only triggered when the button is pressed.

Step2: disable all other interrupts before entering stop mode

Step3 : enter stop mode

Step4: When the push button is pressed, the corresponding interrupt will be triggered, and the microcontroller will exit stop mode and start executing the interrupt service routine ISR associated with the push button interrupt.

Step5: In the push button ISR, re-enable any interrupts that were disabled and clear the interrupt flag for the push button interrupt.

Once the ISR is complete, the MCU will return to the point in the main() where it left before entering stop mode (PS: unlike stop modes, exiting standby mode will generate a system reset)

2) Check the table in your product ref man for mode exit:

0693W00000aI9VDQA0.pngYou may also need to read the Low power mode paragraph in ref man.

Hope that helps a bit!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Sarra,

Sorry, I must have misunderstood. I thought that exiting Stop mode would generate a system reset too. That may not be ideal then.

If that's the case, then Standby would be more ideal, as I would like to start fresh when exiting the stop/standby mode.

Can any pin configured to a GPIO EXTI pin be used to exit standby mode?

After waking up from Standby mode, the program execution restarts in the same way as after a system reset (boot option sampling, boot vector reset fetched).

The system exits from Standby mode when an external reset (NRST pin), an IWDG reset, a WKUP pin event, a RTC alarm, a tamper event, or a timestamp event is detected

0693W00000aI9YvQAK.png

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Sarra,

Yes, I did see this part, but the part that is confusing me is the WKUP pin definition. Some sources have said that only very specific pins can be WKUP pins, while other sources are saying that any GPIO EXTI pin can be configured to a WKUP pin.

So my question is that, can I use another GPIO pin (i.e. PB11 on my current design) which is configured to GPIO_EXTI11 currently, to be that "WKUP" pin?

If yes, how do I do that?

any GPIO pin configured as an external interrupt (EXTI) can be used as a wakeup (WKUP) pin from standby mode. you can use PB11 which is configured as GPIO_EXTI11.

PS : to avoid conflicts, ensure that any other functionality associated with PB11, such as any peripherals or functions that are currently using it, are properly configured or disabled .

Please check this detailed Tutorial about EXTI using HAL.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.