Hello, guys,
I have a board with a module containing STM32L082. I have a HAL based code (yes, I know...) which is not written by me. When MCU goes to stop mode, for a while all looks good and stable, but after around 3 minutes current consumption starts fluctuating up to 3-10uA (normal is <2uA). The time until it happens varies a liitle, depends on temperature, certainly looks that the issue is caused by some leakage, drifting. If MCU wakes up, condition resets. I've checked everything around GPIO's and so on. No obvious issues. Tried setting all to analog input. Then I found that if I remove ADC initialization, the issue is solved. This striked me as weird.
I've finally isolated to this: initialization alone does not cause issue (HAL_ADC_Init). Enabling of ADC clock does not cause issue (__HAL_RCC_ADC1_CLK_ENABLE). But if the ADC peripheral is enabled by HAL_ADC_Start or in fact even a register write the issue happens and nothing can undo it. Disabling, stoping clock, even deinitialization by HAL_ADC_DeInit does not help. The next time MCU goes to stop mode, after a few minutes the weirdness starts. And if ADC was never enabled, all is good.
I've also tried manually disabling internal reference, temperature sensor, even rearranging the code thinking that maybe the issue is somewhere else and the ADC code just happens to add some delay, but it seems no. Seems that enabling the ADC peripheral affects something else, but I can not track what.
If you have ever seen something like this, whould be a great help. Could it be something regarding the MUX perhaps? Thanks.