Other Parts Discussed in Thread: ENERGYTRACE
器件型号:MSP432P401R
工具/软件:Code Composer Studio
我正在开发可穿戴产品、因此我对功耗有要求。 我必须使用深度睡眠。
我使用了 CCS 中嵌入的工具:Energy Trace,测量我的产品的功率。
通过测量、我发现激活模式和 LPM3模式下的产品功耗相同、达到了20mA 电流。
因此、我认为我的产品没有真正进入 LPM3模式。 您有什么提示提示吗?
我写的关于睡眠 和时钟的代码如下所示:
int main (void)
{
/*停止看门狗*/
MAP_WDT_A_HOLDTimer();
MAP_Interrupt_disableMaster();
//minimize_power_all_GPIO
MAP_GPIO_setAsOutputPin (GPIO_PORT_P1、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P2、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P3、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P4、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P5、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P6、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P7、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P8、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P9、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_P10、PIN_ALL16);
MAP_GPIO_setAsOutputPin (GPIO_PORT_PJ、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P1、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P2、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P3、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P4、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P5、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P6、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P7、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P8、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P9、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_P10、PIN_ALL16);
MAP_GPIO_setOutputLowOnPin (GPIO_PORT_PJ、PIN_ALL16);
//初始化 clk
MAP_PCM_setPowerMode (PCM_LDO_MODE);
MAP_PCM_setPowerState (PCM_AM_LDO_VCORE1);
MAP_PCM_setCoreVoltageLevel (PCM_VCORE1);
MAP_FlashCtl_setWaitState (FLASH_BANK0、1);
MAP_FlashCtl_setWaitState (FLASH_BANK1、1);
//为 DCO 频率计算启用 FPU
map_fpu_enableModule();
//将 DCO 频率设置为标准48MHz
//初始化时钟系统
MAP_CS_setDCOCenteredFrequency (CS_DCO_FREQUENCY 48);
for (indConfgClk = 0;indConfgClk < 1000;indConfgClk ++);
MAP_CS_initClockSignal (CS_MCLK、CS_DCOCLK_SELECT、CS_CLOCK _DIVIDER_1);// MCLK = 48M
MAP_CS_initClockSignal (CS_SMCLK、CS_DCOCLK_SELECT、CS_Clock_divider _1);// SMCLK = 48M
//使用所有 RAM 组
MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_BANK1);
MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_Bank2);
MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_BANK3);
MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_BANK4);
MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_BANK5);
MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_BANK6);
MAP_SYSCTL_enableSRAMBankRetention (SYSCTL_SRAM_BANK7);
//启用看门狗
WDT_A_CLOCKITERATIONS_2G);
init_dma();
init_uart();
init_spi();
/*禁用高侧电压监视器/监控器*/
MAP_PSS_disableHighSide();
/*启用“粗鲁”模式,无论设备如何,都强制设备进入睡眠状态
*未处理的时钟请求*/
MAP_PCM_enableRudeMode();
MAP_Interrupt_disableSlepOnIsrExit();
MAP_Interrupt_enableMaster();
while (1)
{
if (map_PCM_gotoLPM3 ())
{
}
其他
{
#ifdef __debug__
printf ("\r\nGoto Lpm3失败");
fflush (stdout);
#endif
}
}