[STM8] STM8L151k4t6低功耗测试问题

[复制链接]
 楼主| candyqmm 发表于 2015-9-10 17:23 | 显示全部楼层 |阅读模式
我用的是ST8L151K4T6 做实验,只焊了一个MCU。一个复位电路:10k电阻加一个103电容。3.45V供电,并用一个104滤波。程序的目的是为了测试单片机的功耗。在程序中将IO口输出低电平。其中SWIM 和复位脚输出高电平。然后进入停机状态。
运行如下代码:
                PD_ODR&=0x0f;
                PD_DDR|=0xf0;
                PD_CR1|=0xf0;
                PD_CR2|=0xf0;

                 PA_ODR&=0x83;
                 PA_ODR|=0x03;
                PA_DDR|=0x7f;
                PA_CR1|=0x7f;
                PA_CR2|=0x7f;

                 PB_ODR=0x00;
                PB_DDR|=0xFF;
                PB_CR1|=0xFF;
                PB_CR2|=0xFF;

                  PC_ODR&=0x80;
                PC_DDR|=0x7F;
                PC_CR1|=0x7F;
                PC_CR2|=0x7F;
delay(65530);
               while(1)
                       {
                            if(PWR_CSR2&0x01==0x01)
                                         break;
                       }
                PWR_CSR2 = 0x2;
        while(1)
                {
                   _asm("halt");  ;//进入停机状态
                }
发现电流有49.5uA。测试的时候是拨掉仿真器的。测试工具为:FLUKE 17B数字万用表的微安档
与手册上介绍的几个uA,差别很大。求各位支招。


pofu007 发表于 2015-9-16 09:31 | 显示全部楼层
看代码你是把没用到的IO口输出低电平,用到的IO口也要保证稳定的电平状态。
亚瑟的绿茶 发表于 2015-9-16 15:02 | 显示全部楼层
外设都可以关掉,IO口设置成推挽输出,关掉RTC。采用LSE或者LSI时钟。基本能保证到几个uA
ericw0ng 发表于 2015-11-3 16:41 | 显示全部楼层
可以把全部GPIO设置成输出低电平,确保测量的只是MCU部分电流,ST有专门测试功耗的例子如下,你可以修改成你需要的(去除LCD和按键部分功能):

由于我的账户暂时无法发链接,你可以到ST网站上搜索“STSW-STM8009”即可

10.5  Unused I/O pins
Unused I/O pins must not be left floating to avoid extra current consumption. They must be
put into one of the following configurations:
• connected to VDD or VSS by external pull-up or pull-down resistor and kept as input
floating (reset state),
• configured as input with internal pull-up/down resistor,
• configured as output push-pull low.
The I/O ports not present on smaller packages are automatically configured by a factory
setting (unless otherwise specified in the datasheet). As a consequence, no configuration is
required on these I/O ports. The bits corresponding to these ports in the configuration
registers Px_ODR, PxDDR, PxCR1 and PxCR2 can be written, but this will have no effect.
The value read in the corresponding bits of the PxIDR register will be '0'.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

2

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部