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.
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.