CH579-PM(power manage)

Posted kingboy100

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CH579-PM(power manage)相关的知识,希望对你有一定的参考价值。

 1 /********************************** (C) COPYRIGHT *******************************
 2 * File Name       : Main.c
 3 * Author            : WCH
 4 * Version           : V1.0
 5 * Date               : 2018/12/15
 6 * Description      : 系统睡眠模式并唤醒演示:GPIOA_6作为唤醒源,共6种睡眠等级
 7 *******************************************************************************/
 8 
 9 #include "CH57x_common.h"
10 
11 void DebugInit(void)        
12 {
13     GPIOA_SetBits(GPIO_Pin_9);
14     GPIOA_ModeCfg(GPIO_Pin_9, GPIO_ModeOut_PP_5mA);
15     UART1_DefInit();
16 }
17 
18 int main()
19 {
20 /* 配置串口调试 */   
21     DebugInit();
22     PRINT( "Start @ChipID=%02X
", R8_CHIP_ID );
23     DelayMs(500);
24     
25 #if 1    
26     /* 配置唤醒源为 GPIO - PA6 */
27     GPIOA_ModeCfg( GPIO_Pin_6, GPIO_ModeIN_PU );
28     GPIOA_ITModeCfg( GPIO_Pin_6, GPIO_ITMode_FallEdge );        // 下降沿唤醒
29     NVIC_EnableIRQ( GPIO_IRQn );
30     PWR_PeriphWakeUpCfg( ENABLE, RB_SLP_GPIO_WAKE );
31 #endif    
32     
33 #if 1
34     PRINT( "IDLE mode sleep 
");   
35     DelayMs(1);
36     LowPower_Idle();
37     PRINT( "wake.. 
"); 
38     DelayMs(500);
39 #endif    
40     
41 #if 1
42     PRINT( "Halt_1 mode sleep 
");   
43     DelayMs(1);
44     LowPower_Halt_1();
45     PRINT( "wake.. 
"); 
46     DelayMs(500);    
47 #endif    
48     
49 #if 1
50     PRINT( "Halt_2 mode sleep 
");   
51     DelayMs(1);
52     LowPower_Halt_2();
53     PRINT( "wake.. 
"); 
54     DelayMs(500);    
55 #endif    
56 
57 #if 1
58     PRINT( "sleep mode sleep 
");   
59     DelayMs(1);
60     LowPower_Sleep( RB_PWR_RAM14K|RB_PWR_RAM2K );  //只保留14+2K SRAM 供电
61     PRINT( "wake.. 
");      
62     DelayMs(500);
63 #endif
64 
65 #if 1
66     PRINT( "shut down mode sleep 
");   
67     DelayMs(1);
68     LowPower_Shutdown( NULL ); //全部断电,唤醒后复位
69     PRINT( "wake.. 
");
70     DelayMs(500);
71 #endif
72 
73     while(1);    
74 }
75 
76 
77 void GPIO_IRQHandler(void)
78 {
79     GPIOA_ClearITFlagBit( GPIO_Pin_6 );
80       PRINT( "wake.. 
");
81 }

 

以上是关于CH579-PM(power manage)的主要内容,如果未能解决你的问题,请参考以下文章

Zephyr Power Management Subsystem详细介绍

Zephyr Power Management Subsystem详细介绍

Zephyr Power Management Subsystem详细介绍

ARM Cortex-A73 Power management

No cache manager could be auto-configured, check your configuration (caching type is ‘CAFFEINE‘)(代码片

Power Management开发的一般模型