本帖最后由 murphy.he 于 2015-7-22 10:13 编辑
执行完初始化代码后就执行进入stop mode的代码了
可以确定是进入stop mode了,因为外部晶振都停振了
电流也从50多降到了5mA,还是太大了,不知道是否有东西还需要关
初始化代码
int driver_systemclock_init( void )
{
RCC_ClocksTypeDef RCC_Clocks;
GPIO_InitTypeDef GPIO_InitStructure;
/*disable all unused pins*/
RCC_APB2PeriphClockCmd(RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_GPIOG ,
DISABLE);
/*end of disable all unused pins*/
/* SysTick end of count event each 10ms */
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000);
NVIC_SetPriority(SysTick_IRQn, 0x0);
return 0;
}
进入stop mode 代码
void Sleep_test()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);//add for debug 2015-07
-20
RCC_APB2PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOD |RCC_AHB1Periph_GPIOE,
ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_Init(GPIOE, &GPIO_InitStructure);
RCC_APB2PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB |
RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD |RCC_AHB1Periph_GPIOE ,
DISABLE);
delay_ms(5000);
PWR_FlashPowerDownCmd(DISABLE);
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
}
|