打印
[STM32F1]

stm32f103 stop low power 低功耗降不下来--

[复制链接]
1237|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
hugo0chen|  楼主 | 2016-8-5 14:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请各位大侠指点下:
设置IO的中断输入触发方式为falling 触发;
电路:使用ldo产生3.3V供电给stm32f103rbt6,最小系统,reset电路;boot0 通过10kohm电阻下拉到GND;Vbat未连接;VDD1-VDD2-VDD3_Vdd4以及VDDA都是连接到3.3V 上;无外部crystal;
测量方法:测量位置是3.3V进入mcu最小系统串接进去的
测量工具:电流表ua tester QH-05 Ver 1.5,配合的万用表是 victor VC890D 使用200mv档;

软件测试
系统上电后进入systeminit(),设置时钟是HSI;--->
初始化一个gpioB.9作为输出,驱动LED点亮指示;--->
初始化一个GPIOB.6作为输出中断,进入stop模式使用---->
在while(1)中,执行LED_ON(LED_NO_1);---->
在EXTI中断函数中,LED_OFF(LED_NO_1),且执行Enter_StopMode(),
Enter_StopMode()__--->>
1、在进入stop模式前,GPIO设置为AIN模式;
2、关闭所有时钟GPIO、AFIO、SRAM以及FLITF时钟,但是使能PWR_Regulator clock
3、disable flash prefetch buffer;
4、进入low power 的stop 模式。PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI);
测试结果:
可以进入stop模式,我用led灯指示,进入后led熄灭。
测量的电流时0.4mA。为什么还这么高?
附code:
/********************************* STOP MODE **********************************/  
void Stop_MODE(void)
{
  /* Config the GPIO on Analog Input mode  disable all gpio clock and afio*/
  GPIO_Config_ALL_AIN();

  /* Desable the SRAM and FLITF clock in Stop mode */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_SRAM|RCC_AHBPeriph_FLITF, DISABLE);

        RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); // Enable PWR clock
         
        FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Disable);    // Disable Prefetch Buffer
        FLASH_SetLatency(FLASH_Latency_0);    // Flash 0 wait state
        
    /* Mode: STOP + Regulator in low power mode + Entry with WFI */
        PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI);
}

static void GPIO_Config_ALL_AIN(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  
  /* Disable the Serial Wire Jtag Debug Port SWJ-DP */
  GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);

  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_GPIOB
                         | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD| RCC_APB2Periph_AFIO
                         , DISABLE);
                                                                                                
        RCC_HSICmd(DISABLE);
        RCC_LSICmd(DISABLE);
        RCC_HSEConfig(RCC_HSE_OFF);
        ADC_Cmd(ADC1,DISABLE);
        ADC_Cmd(ADC2,DISABLE);
}
        
沙发
hugo0chen|  楼主 | 2016-8-5 14:20 | 只看该作者
我的系统中测量值也是这么多,所以我搭建个最小系统测量下

使用特权

评论回复
板凳
hugo0chen|  楼主 | 2016-9-9 15:45 | 只看该作者
注意systick 的关闭以及adc如果之前开启了,后面一定要关上disabled
达到了手册上的12ua,
void Stop_Mode(void)
{
        // RCC configration
        STOP_RCC_Configuration();
       
        STOP_PHERIAL_CONFIG();
       
        /* Enable PWR and BKP clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
       
        //Config the GPIO on Analog Input mode  disable all gpio clock and afio
   GPIO_Config_ALL_AIN();
       
        /* Config the EXTI to wake up from STOP Mode */
  STOP_EXTI_Configuration();
       
        /* NVIC configuration */
  STOP_NVIC_Configuration();

  // Desable the SRAM and FLITF clock in Stop mode  
   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_SRAM|RCC_AHBPeriph_FLITF, DISABLE);
       
        wakeupflag  = 0;       
        clearwakeupsource();
        systick_disable();
        // Mode: STOP + Regulator in low power mode + Entry with WFI  
        PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI);
               
        wakefromstopinitsystem();
               
        wakeupflag = 1;
}

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

15

主题

191

帖子

3

粉丝