可以把全部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'.
|