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条回答
Julius007
1楼-- · 2019-07-20 21:12
大神  后面解决了功耗问题吗?
ChaserMCU
2楼-- · 2019-07-21 00:42
你的GPIOA0(如果此脚为SWIM)和GPIO1A(如果此脚为RST)也要设置成 GPIO_Mode_Out_OD_Low_Slow才行
ssssssssssss
3楼-- · 2019-07-21 05:11
 精彩回答 2  元偷偷看……
张可
4楼-- · 2019-07-21 09:50
之前使用STM8L152C6T6做个一个水浸探测器,RTC定时唤醒指示灯点亮一下,低功耗时电流约1uA,基本与手册里的参数吻合!
张可
5楼-- · 2019-07-21 10:10

之前使用STM8L152C6T6做个一个水浸探测器,RTC定时唤醒指示灯点亮一下,低功耗时电流约1uA,基本与手册里的参数吻合!
张可
6楼-- · 2019-07-21 11:14
 精彩回答 2  元偷偷看……

一周热门 更多>