最近在弄深度睡眠发现功耗实在降不下来,高手能否指点下。使用的LM3S5T36, 进入深度睡眠状态时候功耗为6.674mA ,测试代码如下:
void main()
{
//
// Set the clocking to run directly from the external crystal/oscillator.
// TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
// crystal on your board.
//
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_GPIOC);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_GPIOD);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_I2C0);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_I2C1);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_PWM0);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_CAN0);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_UART0);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_UART1);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_UART2);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_SSI1);
SysCtlPeripheralPowerOff(SYSCTL_PERIPH_USB0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinTypeGPIOInput (GPIO_PORTB_BASE, GPIO_PIN_7); /* 设置PJ0为输入 */
GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_HIGH_LEVEL); /* 配置下降沿触发中断 */
GPIOPinIntEnable(GPIO_PORTB_BASE, GPIO_PIN_7); /* 使能PJ0中断 */
IntEnable(INT_GPIOB); /* 使能PJ口中断 */
IntMasterEnable(); /* 使能总中断 */
SysCtlPeripheralClockGating(true); //置位ACG,开启自动时钟门控
// Shutdown the USB PHY
HWREG(0x40050001) = 0x21;
SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOB);
SysCtlDeepSleepClockSet(0x00000030);
SysCtlDelay(500000);
SysCtlDeepSleep(); //等待定时器溢出中断唤醒处理器
while(1)
{
SysCtlDelay(50000);
}
} |