STM8L151进入低功耗 halt模式, 功耗还有300uA,求个大神指点迷津

2019-07-19 20:21发布

外围没有接任何电路, 进入halt模式前所有端口都设置为开路 低电平输出,STM8L151进入低功耗 halt模式, 功耗还有300uA,怎样才能做到手册上说的( 停止模式  350nA),有哪位大神能指点迷津,我感激不尽,单片机型号是STM8L151C8(48管脚的),我的代码如下
#define MyGPIO_Mode_Type   GPIO_Mode_Out_OD_Low_Slow
void HardWarePort_Def(void)                                       
{
  GPIO_Init(GPIOA, GPIO_Pin_2, MyGPIO_Mode_Type);
  GPIO_Init(GPIOA, GPIO_Pin_3, MyGPIO_Mode_Type);
  GPIO_Init(GPIOA, GPIO_Pin_4, MyGPIO_Mode_Type);
  GPIO_Init(GPIOA, GPIO_Pin_5, MyGPIO_Mode_Type);
  GPIO_Init(GPIOA, GPIO_Pin_6, MyGPIO_Mode_Type);
  GPIO_Init(GPIOA, GPIO_Pin_7, MyGPIO_Mode_Type);

  GPIO_Init(GPIOB, GPIO_Pin_0, MyGPIO_Mode_Type);
  GPIO_Init(GPIOB, GPIO_Pin_1, MyGPIO_Mode_Type);
  GPIO_Init(GPIOB, GPIO_Pin_2, MyGPIO_Mode_Type);
  GPIO_Init(GPIOB, GPIO_Pin_3, MyGPIO_Mode_Type);
  GPIO_Init(GPIOB, GPIO_Pin_4, MyGPIO_Mode_Type);
  GPIO_Init(GPIOB, GPIO_Pin_5, MyGPIO_Mode_Type);
  GPIO_Init(GPIOB, GPIO_Pin_6, MyGPIO_Mode_Type);
  GPIO_Init(GPIOB, GPIO_Pin_7, MyGPIO_Mode_Type);

  GPIO_Init(GPIOC, GPIO_Pin_0, MyGPIO_Mode_Type);
  GPIO_Init(GPIOC, GPIO_Pin_1, MyGPIO_Mode_Type);  
  GPIO_Init(GPIOC, GPIO_Pin_2, MyGPIO_Mode_Type);
  GPIO_Init(GPIOC, GPIO_Pin_3, MyGPIO_Mode_Type);
  GPIO_Init(GPIOC, GPIO_Pin_4, MyGPIO_Mode_Type);
  GPIO_Init(GPIOC, GPIO_Pin_5, MyGPIO_Mode_Type);
  GPIO_Init(GPIOC, GPIO_Pin_6, MyGPIO_Mode_Type);
  GPIO_Init(GPIOC, GPIO_Pin_7, MyGPIO_Mode_Type);

  GPIO_Init(GPIOD, GPIO_Pin_0, MyGPIO_Mode_Type);
  GPIO_Init(GPIOD, GPIO_Pin_1, MyGPIO_Mode_Type);
  GPIO_Init(GPIOD, GPIO_Pin_2, MyGPIO_Mode_Type);
  GPIO_Init(GPIOD, GPIO_Pin_3, MyGPIO_Mode_Type);
  GPIO_Init(GPIOD, GPIO_Pin_4, MyGPIO_Mode_Type);
  GPIO_Init(GPIOD, GPIO_Pin_5, MyGPIO_Mode_Type);
  GPIO_Init(GPIOD, GPIO_Pin_6, MyGPIO_Mode_Type);
  GPIO_Init(GPIOD, GPIO_Pin_7, MyGPIO_Mode_Type);

  GPIO_Init(GPIOE, GPIO_Pin_0, MyGPIO_Mode_Type);
  GPIO_Init(GPIOE, GPIO_Pin_1, MyGPIO_Mode_Type);
  GPIO_Init(GPIOE, GPIO_Pin_2, MyGPIO_Mode_Type);
  GPIO_Init(GPIOE, GPIO_Pin_3, MyGPIO_Mode_Type);
  GPIO_Init(GPIOE, GPIO_Pin_4, MyGPIO_Mode_Type);
  GPIO_Init(GPIOE, GPIO_Pin_5, MyGPIO_Mode_Type);
  GPIO_Init(GPIOE, GPIO_Pin_7, MyGPIO_Mode_Type);

  GPIO_Init(GPIOF, GPIO_Pin_0, MyGPIO_Mode_Type);

}
void main()
{  
  disableInterrupts()   //关闭系统总中断
  //CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1); //内部时钟为1分频 = 16Mhz
  HardWarePort_Def();
  enableInterrupts();   //使能系统总中断
  CLK_DeInit();
  PWR_FastWakeUpCmd(DISABLE);
  PWR_UltraLowPowerCmd(ENABLE);
  halt();
  while(1)
  {

  }
}


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
18条回答
mon51
1楼-- · 2019-07-20 01:11
STM32L151进入停机状态都可以到几个uA,先检查外围电路是否有粘连!1、你把所有端口改成:高或模拟输入状态。2、降低内核、RAM、flash供电电压。
ouzhen
2楼-- · 2019-07-20 04:24
mon51 发表于 2017-5-21 09:47
STM32L151进入停机状态都可以到几个uA,先检查外围电路是否有粘连!1、你把所有端口改成:高或模拟输入状态 ...

外围没有焊接器件,只有几个滤波电容和 复位电路
阳光100
3楼-- · 2019-07-20 06:32
 精彩回答 2  元偷偷看……
lyons
4楼-- · 2019-07-20 10:49
 精彩回答 2  元偷偷看……
Owen
5楼-- · 2019-07-20 14:38
楼主,怎么测出来有300uA的?我现在做低功耗模式,电流小于1mA不好测试
赵士亮
6楼-- · 2019-07-20 20:07
 精彩回答 2  元偷偷看……

一周热门 更多>