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条回答
qiousanxi
1楼-- · 2019-07-21 16:18
本帖最后由 qiousanxi 于 2018-8-2 15:36 编辑

首先,你先弄个最小系统,电源 BOOT脚 和芯片就行了,这样能确定到底是你芯片 功耗没降  还是外围
骓枫
2楼-- · 2019-07-21 20:56
 精彩回答 2  元偷偷看……
卢明
3楼-- · 2019-07-22 01:48
 精彩回答 2  元偷偷看……
默默莱
4楼-- · 2019-07-22 01:53
卢明 发表于 2018-11-29 13:21
楼主,问题解决了没? 我现在关闭了外设,GPIO管脚设置成推晚低速低压输出了,但Halt后还是在350uA,能指点 ...

你有使用LDO芯片吗,我使用了 STAND-EXIT  2.7UA左右
szczyb1314
5楼-- · 2019-07-22 04:11
STM8所有的外设时钟默认是打开的,进入低功耗的时候先提前把不用的时钟关掉
szczyb1314
6楼-- · 2019-07-22 07:29
 精彩回答 2  元偷偷看……

一周热门 更多>