standby modes This is a topic that many people are looking for. khurak.net is a channel providing useful information about learning, life, digital marketing and online courses …. it will help you have an overview and solid multi-faceted knowledge . Today, khurak.net would like to introduce to you STANDBY MODE in STM32 LOW POWER MODES CubeIDE. Following along are instructions in the video below:
“Everyone welcome to controllers tech. I have already covered sleep mode and stop mode today today in this video. I will cover the standby mode in stm32 let s take look at the data sheet. These are the common steps in other modes other than these the wake up flag must be cleared before going to standby mode.
If the rtc is chosen then rtc wakeup flag must also be cleared we can exit the standby mode using wakeup pin or rtc interrupt or watchdog timer. The latency of standby mode is same as reset. When the mcu wakes up from the standby mode. The spf flag in the power control register is set we will use this fact to perform some operations after waking up from the standby let s start by creating a project in the cube ide.
I am using stm32f4 for 6r ii controller. Give some name to this project and click finish. Here. Is the cube mx first of all i am selecting the external crystal for the clock.
Enable the uart for communicating with the computer. Pa5 is connected to the led enable the wake up pin let s go to the clock setup..
I have eight megahertz external crystal and i want the system clock of 180 megahertz click save to generate the project. When the mcu wakes up all these will be executed again to confirm if the system was resumed from standby mode. We will check this sv flag. If the flag is set means the mcu woke up from the standby mode.
You first thing. We will do is clear the flag next. We will display this string on the console. And then toggle the led few time with some small delay at last disable.
The wake up pin wake up pin. One is common in all mcu wakeup pin. Two and three are supported by these microcontrollers only i am using wakeup pin. One as its present in all the mcu and it is the pin pa zero.
Now. This is the procedure to enter the standby mode..
As mentioned in the datasheet. We must clear the wake up flag before entering the standby. I am going to display this string blink. The led for the indication this blinking rate is different from the initial one we must enable the wake up pin.
Before entering standby just to make sure now finally enter. The standby mode. You include the string dot h. File.
For string related operations. Let s build this code. I am going to use the debugger as you can see when i press the reset. The string got printed on the console led blinks at 750 milliseconds delay and the mcu goes into the standby mode.
When the button is pressed the mcu wakes up and string got printed and led blinks at 200 milliseconds to indicate the wakeup same thing happens. If i press the button again we can also use the rtc to wake the device up i have already covered the rtc set up in my stop mode video in rtc wake up select internal wake up make sure you turn on the interrupts..
Leave everything as it is we don t need to set the time. This is a periodic wakeup and setting time doesn t affect it now go to the rtc initialization function. And copy this function also commented out here just like we enabled the wake up pin. We are also going to enable the rtc wakeup inside the main function i have already explained this calculation in my sleep mode video you can check it out on the top right anyway.
This calculation is self explanatory. I am using the periodic delay of 5 seconds. Here as mentioned in the datasheet. If we are using rtc to wake the mcu up we need to clear the rtc wake up flag also after wake up just like disabling the wake up pin.
We must also deactivate the rtc wake up let s build this code and run. It you can see the current consumption on the ammeter also right now the range is set at 200 milliamps when the device is running normally the consumption is around 36 milliamps. But when it goes into the standby mode. It s showing zero let me reduce the range to 2 milliamps.
Now you won t be able to see the higher range. But you can see the current during standby mode..
Yes. It s around point zero zero two milliamps. Which is 2 micro ampere. This is extremely low consumption.
The mcu is waking up every 5 seconds. Because of the periodic wake up of rtc. We can also use the wake up pin to wake the controller you can see the spf flag and w. Uf flag described in the datasheet now all three low power modes are covered in stop mode.
There is one feature called under drive mode. It s not present in cortex m3 and maybe in other series also but its present in f4 for 6r ii. And i will cover it in few days you can use these low power modes according to your application this is it guys i hope you understood the video. You can download the code from the link in the ” .
Thank you for watching all the articles on the topic STANDBY MODE in STM32 LOW POWER MODES CubeIDE. All shares of khurak.net are very good. We hope you are satisfied with the article. For any questions, please leave a comment below. Hopefully you guys support our website even more.