High Current Consumption in Low-power MCU application

Sometime, it may be troublesome to deal with high current consumption in Low-power applications. Microcontrollers (MCU) are a complex device in a low-power application design.
3

The following considerations may help to simplify MCU-related power losses.
1. Check all unused GPIO are properly configured and not floating.
In most cases, you should follow the datasheet’s mentioned instructions to configure unused GPIOs to output low or high levels, or use internal pull-up or pull-down resistors if switched to input. Any improperly configured GPIOs may result in high-current situations which are difficult to locate, because this situation will vary depending on the device and environmental conditions such as temperature and humidity.

2. Check the level of GPIO inputs
Most likely, the level of GPIO inputs must be in the range described in the datasheet, such as DVss or DVcc ±300mV. If a GPIO is used for analog function such as ADC input, it may not apply.

3. Check how the device runs in Low Power Mode
If an MCU draws too much current due to damage, you can investigate the issue by running some code in a low power mode. Like Texas Instruments MCUs, which can be programmed in LPM3 or LPM4 mode to see if the device still draws too much current. During current measurement, you can set simple port toggles on software points in IDE to check where the problem is.

Configuration of GPIO pins is a point where HW meets SW in embedded design. GPIO init code must reflect real connections on PCB. Unused peripherals need to be turned off prior to changing settings of the pins. It can be recommended to have a template function that configures all available GPIOs as if they were not connected (if such configuration differs from poweron/reset default settings) Then for each particular project the template can be modified to set direction, PU/PD and initial states for inidvidual pins as needed.
Before GPIO desing, at HW design stage, power path needs to be planned. Using a battery with a setp-up may result in longer runtime. Running at lower frequencies allows lower voltage to be supplied, and so on. These and other methods are demonstrated and explained at Qoitech/Resources

Often, especially on reduced-pincount versions of MCUs, not all GPIO signals are brought out to actual pins. These ports STILL physically exist on the chip, and the registers for them STILL need to be initialized properly.