stm32f103 stop 低功耗测量值偏高

2019-03-23 18:02发布

请各位大侠指点下:
设置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);
}
        
此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。