21ic问答首页 - HC32L136K8TA,低功耗
HC32L136K8TA,低功耗
qgy10072024-06-12
目前使用的是gpio的低功耗例程,在HC32L136K8TA最小开发板上测试功耗始终降不下去,查看过寄存器bgr和adc这些外设都已关闭,我达不到10ua以内,最小只可以达到369ua,求指导一下还该咋样配置代码:
int32_t main(void)
{
delay1ms(5000);
///< 配置Demo板上所有不使用的IO为高阻输入,避免端口漏电
App_LowPowerModeGpioSet();
///< 进入低功耗模式——深度休眠(使能唤醒后退出中断自动休眠特性)
Lpm_GotoDeepSleep(TRUE);
while(1)
{
;
}
}
static void App_LowPowerModeGpioSet(void)
{
///< 打开GPIO外设时钟门控
Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE);
//swd as gpio
Sysctrl_SetFunc(SysctrlSWDUseIOEn, TRUE);
///< 配置为数字端口
M0P_GPIO->PAADS = 0;
M0P_GPIO->PBADS = 0;
M0P_GPIO->PCADS = 0;
M0P_GPIO->PDADS = 0;
///< 配置为端口输入
M0P_GPIO->PADIR = 0XFFFF;
M0P_GPIO->PBDIR = 0XFFFF;
M0P_GPIO->PCDIR = 0XFFFF;
M0P_GPIO->PDDIR = 0XFFFF;
///< 输入上拉
M0P_GPIO->PAPD = 0xFFFF;
M0P_GPIO->PBPD = 0xFFFF;
M0P_GPIO->PCPD = 0xFFFF;
M0P_GPIO->PDPD = 0xFFFF;
}
int32_t main(void)
{
delay1ms(5000);
///< 配置Demo板上所有不使用的IO为高阻输入,避免端口漏电
App_LowPowerModeGpioSet();
///< 进入低功耗模式——深度休眠(使能唤醒后退出中断自动休眠特性)
Lpm_GotoDeepSleep(TRUE);
while(1)
{
;
}
}
static void App_LowPowerModeGpioSet(void)
{
///< 打开GPIO外设时钟门控
Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE);
//swd as gpio
Sysctrl_SetFunc(SysctrlSWDUseIOEn, TRUE);
///< 配置为数字端口
M0P_GPIO->PAADS = 0;
M0P_GPIO->PBADS = 0;
M0P_GPIO->PCADS = 0;
M0P_GPIO->PDADS = 0;
///< 配置为端口输入
M0P_GPIO->PADIR = 0XFFFF;
M0P_GPIO->PBDIR = 0XFFFF;
M0P_GPIO->PCDIR = 0XFFFF;
M0P_GPIO->PDDIR = 0XFFFF;
///< 输入上拉
M0P_GPIO->PAPD = 0xFFFF;
M0P_GPIO->PBPD = 0xFFFF;
M0P_GPIO->PCPD = 0xFFFF;
M0P_GPIO->PDPD = 0xFFFF;
}
赞0
评论
2024-06-12
您需要登录后才可以回复 登录 | 注册