cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030C6 MCU Sleep Mode

K_P_D
Associate II

Hi All,

I am working on the STM32F030 MCU and developing code for the low power consumption for my application.

I need to develop code for the sleep mode, in which after few minutes it goes to sleep mode to save power. But some how I am not getting that how do I get this into my code.

So, I could like to request you to kindly guide me through this sleep mode functionality that how do I develop.

Looking forward for the Kind supports and guidance.

Thanks

7 REPLIES 7
Mohamed Aymen HZAMI
ST Employee

Hello,

  • You can refer to PWR ST example : " STM32Cube\Repository\STM32Cube_FW_F0_V1.9.0\Projects\STM32F030R8-Nucleo\Examples\PWR\PWR_CurrentConsumption ".
  • And also the RTC examlple : " STM32Cube\Repository\STM32Cube_FW_F0_V1.9.0\Projects\STM32F030R8-Nucleo\Examples\RTC\RTC_Alarm ".

You can develop your project based on both examlpes PWR_CurrentConsumption and RTC_Alarm. The RTC to program the MCU to enter sleep mode.

Best Regards,

Mohamed Aymen.

K_P_D
Associate II

Hi,

I have develop a small code for my basic understanding for sleep mode.

In code I have used toggle led with every 1 sec and then write the HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI) to push MCU in sleep mode.

But still it blinks the led at every 1 sec, it doesn't goes into sleep mode, after changing it to the HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFE) it stop the led toggling and hold led in one state(ON/OFF state) after pressing interrupt button once again begin to toggle and goes to stop_mode.

Please let know that how do I make sleep mode or if I was wrong then please guide & correct me.

Thanks

Hi Mohamed,

I have gone through your suggested "RTC" and "PWR" example but I didn't found any such information in available example.

Can you have some other examples too for the same to go into sleep mode.

Thanks

Mohamed Aymen HZAMI
ST Employee

Hello,

In Sleep mode, only the CPU is stopped. All peripherals continue to operate and can wake up the CPU when an interrupt/event occurs. In your case maybe you have a peripheral interrupt that force the MCU to wake-up from sleep mode but in stop mode several peripheral can be active, in this case the system work properly ( there is no unexpected interrupt ).

Best Regards,

Mohamed Aymen.

Hi Mohamed,

You are right but what I need is to stop all the peripheral as of my device is battery operated.

So I need to save power using the HAL APIs.

I have gone through the "Sleep mode", "Stop mode" and "Standby mode".

As I have tried with Sleep mode and stop mode but could not able to achieve the main goal( for example: goal stop LED blinking).

So can you let know which API may I use to completely closed or stop all the connected LED & peripherals to stop consuming power and save battery for long last.

In my condition I want to configure as input interrupt only one GPIO pin which can wake up MCU and continue with task.

In sleep mode all the peripherals and GPIO except wake up GPIO pin is active, So we can wake up the device.

Thanks

Mohamed Aymen HZAMI
ST Employee

Hello,

To reduce power consumption you need to :

  1. configure all the GPIOs in analog state except the Pins that you are using as interrupts to wake-up the MCU.
  2. Enter to the low power mode.

In this case you can save power and battery life.

Best Regards,

Mohamed Aymen.

Okay, I will check it & if I found any problem I will let you know and ask my concern for the same.

Thanks