STM32低功耗STOP模式,电流有点大(1ma),正常吗?

2019-12-20 21:32发布

最近试了一下STM32f103c6t6的低功耗,用的官方的例子里面的,电流用万用表测了流经stm32的电流还有1ma,管脚都设为了模拟输入模式,一开始因为78L05不工作时的竟然有3.6ma的电流,总电流用5ma,所以电池用不久,随后拆除了78L05,只用3.3V芯片供电这样的话整个电路的的电流还有1.4ma,但是流经STM32的电流也为1ma,功耗还是有点大。不知道各位大侠是如何做到低功耗的,看到很多人都到达几十ua的功耗,不知道如何才能做到?程序中需要注意什么吗?当然stm32于430无法相比。



我使用的是


int main(void)
{
  //初始化

  while(1)
  {
     if(低功耗条件)
    {
       Stop_MODE();
       while(1)
       {
         if (退出低功耗条件)
         {
            //初始化时钟和端口
            break;
          }
       }
    }
}

}

void Stop_MODE(void)
{
/********************************* STOP MODE **********************************/  
#ifdef STOP
  
  /* Config the GPIO on Analog Input mode */
  GPIO_Config_ALL_AIN();
  
  /* Config the EXTI to wake up from STOP Mode */
  
  
  EXTI_Configuration();
  NVIC_Config_EXTI(ENABLE);
  /* Desable the SRAM and FLITF clock in Stop mode */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_SRAM|RCC_AHBPeriph_FLITF, DISABLE);

  /* Request to enter STOP mode with regulator in low power mode */
  #ifdef STOP_Regulator_LowPower
  

    #ifdef Entry_WFI
    /* Mode: STOP + Regulator in low power mode + Entry with WFI */
    PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
   
    #endif  
  
   #endif /* Stop Mode with Regulator in low power mode */

#endif /* End of STOP test */   
}



void GPIO_Config_ALL_AIN(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;

  /* Enable GPIOD and GPIOE clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB
                         | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD
                         | RCC_APB2Periph_AFIO, ENABLE);
  
  
  /* Disable the Serial Wire Jtag Debug Port SWJ-DP */
  GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
  
    /* PA  */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
      /* PB  */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
  GPIO_Init(GPIOB, &GPIO_InitStructure);
      /* PC  */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
  GPIO_Init(GPIOC, &GPIO_InitStructure);
        /* PD  */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
  GPIO_Init(GPIOD, &GPIO_InitStructure);
  
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA  
                         | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD  
                         , DISABLE);

}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。