本帖最后由 怀揣少年梦 于 2024-8-3 17:11 编辑
本篇测评主要是测试一下进入几种功耗模式的功耗。
一、功耗模式
1、查看用户手册MM32F5330一共有以下六种低功耗模式为:
- 低功耗运行模式:CPU、所有芯片外设包括 CPU 外设如 NVIC、SysTick 等在运行,系统工作时钟不能高于 2MHz。
- 睡眠模式:CPU 停止,所有芯片外设包括 CPU 的外设,如 NVIC、SysTick 等仍在运行。
- 低功耗睡眠模式:CPU 停止,所有芯片外设包括 CPU 的外设,如 NVIC、SysTick 等仍在运行,工作时钟不能高于 2MHz。
- 停机模式:CORE 域以低功耗模式工作,CPU 及所有外设时钟都停止,只保持寄存器和 RAM 的内容。
- 深度停机模式:CORE 域以更低功耗模式工作,CPU 及所有外设时钟都停止,只保持寄存器和 RAM的内容。
- 待机模式:CORE 域停止供电,此域寄存器和 SRAM 的内容全部丢失,备份域除外
2、几种功耗模式切换关系
- 运行模式可以进入低功耗运行模式,并且从低功耗运行模式退出到运行模式。
- 运行模式可以进入睡眠模式,并且从睡眠模式退出到运行模式。
- 运行模式可以进入停机模式,并且从停机模式退出到运行模式。
- 运行模式可以进入深度停机模式,并且从深度停机模式退出到运行模式。
- 运行模式可以进入待机模式,并且从待机模式退出到运行模式。
- 低功耗运行模式可以进入低功耗睡眠模式,并且从低功耗睡眠模式退出到低功耗运行模式。
- 低功耗运行模式可以进入停机模式,并且从停机模式退出到低功耗运行模式。
- 低功耗运行模式可以进入深度停机模式,并且从深度停机模式退出到低功耗运行模式。
- 低功耗运行模式可以进入待机模式,并且从待机模式只能退出到运行模式
切换图,如图
3、切换条件
4、降低功耗的方法:
1)在满足应用的条件下,尽可能地降低主频;
2)关闭不使用引进的时钟;
3)尽量共用一组IO口的GPIO;
4)可以选择用时打开外设,不用时关闭外设的策略。
二、功耗测试
本次测试将以时钟频率为2Mhz为基础,测试几种模式下的功耗
1、修改系统时钟
由于主频默认是180MHz.
将SYSCLK_HSI_XXMHz修改为低于25Mhz;则HSI默认将8M作为系统时钟
将系统分频为2Mhz;
2、编写主函数
- /***********************************************************************************************************************
- [url=home.php?mod=space&uid=288409]@file[/url] main.c
- [url=home.php?mod=space&uid=187600]@author[/url] FAE Team
- [url=home.php?mod=space&uid=212281]@date[/url] 08-May-2023
- [url=home.php?mod=space&uid=247401]@brief[/url] THIS FILE PROVIDES ALL THE SYSTEM FUNCTIONS.
- **********************************************************************************************************************
- @attention
- <h2><center>© Copyright(c) <2023> <MindMotion></center></h2>
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
- following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
- the following disclaimer in the documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or
- promote products derived from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *********************************************************************************************************************/
- /* Define to prevent recursive inclusion */
- #define _MAIN_C_
- /* Files include */
- #include "platform.h"
- #include "main.h"
- /**
- * @addtogroup MM32F5330_LibSamples
- * @{
- */
- /**
- * @addtogroup TIM2_5
- * @{
- */
- /**
- * @addtogroup TIM2_5_TimeBase
- * @{
- */
- /* Private typedef ****************************************************************************************************/
- /* Private define *****************************************************************************************************/
- #define DEEP_STOP_MODE 1
- #define STOP_MODE 0
- #define LOW_SLEEP_POWER_MODE 0
- #define SLEEP_MODE 0
- #define STADNY_MODE 0
- /* Private macro ******************************************************************************************************/
- /* Private variables **************************************************************************************************/
- /* Private functions **************************************************************************************************/
- /***********************************************************************************************************************
- * @brief This function is main entrance
- * [url=home.php?mod=space&uid=536309]@NOTE[/url] main
- * @param none
- * @retval none
- *********************************************************************************************************************/
- int main(void)
- {
-
- PLATFORM_Init(); //初始化串口以及LED;
- #if LOW_SLEEP_POWER_MODE
- PWR_LowPowerSleep_WFI_Wakeup_Sample();
- #elif DEEP_STOP_MODE
- PWR_DeepStop_EXTI_Wakeup_Sample();
- #elif SLEEP_MODE
- PWR_Sleep_WFI_Wakeup_Sample();
- #elif STOP_MODE
- PWR_Stop_EXTI_Wakeup_Sample();
- #elif STADNY_MODE
- PWR_Standby_RTC_Wakeup_Sample();
- #elif LOW_POWER_RUN_MODE
- PWR_LowPowerRun();
- #endif
- while (1)
- {
- }
- }
- /**
- * @}
- */
- /**
- * @}
- */
- /**
- * @}
- */
- /********************************************** (C) Copyright MindMotion **********************************************/
3、测量几种功耗模式的功耗
1、DEEP_STOP_MODE
467.80 uA
2、STOP_MODE
467.31uA
3、LOW_SLEEP_POWER_MODE
4.97mA
4、SLEEP_MODE
4.40mA
5、STANDY_MODE
2.64mA
总体来看,相比ST STM32L151系列还是挺高的。不过M5330主打性能。
|