ADC generates power consumption after stm32L4 enters stop mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-21 10:57 PM
I use STM32L431 to enter STOP1 mode, the original power consumption is 53uA. Before entering stop mode, I call HAL_ADC_DeInit(&hadc1) to disable ADC, and call MX_ADC1_Init() to re-enable ADC after exiting STOP1 mode. The measured power consumption is 66uA, which is about 10uA more. Why? If I do not call MX_ADC1_Init() after exiting STOP1 mode, the power consumption is still 53uA. Is it because ADC will generate power consumption?
Below is my code to enter and exit STOP1:
void EnterStop2ModeRTC(void)
{
HAL_RCCEx_WakeUpStopCLKConfig(RCC_STOP_WAKEUPCLOCK_MSI);
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
__HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG();
__HAL_RTC_TIMESTAMP_CLEAR_FLAG(&hrtc, RTC_FLAG_TSF);
__HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG();
HAL_ADC_DeInit(&hadc1);
HAL_SuspendTick();
// __HAL_RCC_DMA1_CLK_DISABLE();
cpuStopFlg = true;
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk;
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
}
void ExitStop2ModeRTC(void)
{
SystemClock_Config();
HAL_ResumeTick();
MX_ADC1_Init();
cpuStopFlg = false;
}
- Labels:
-
ADC
-
DMA
-
STM32L4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 2:00 AM
Hello @AlfRomeo,
HAL_ADC_MspInit() calls typically bus clock activation: __HAL_RCC_ADC_CLK_ENABLE().
Can you check whether you have implemented HAL_ADC_MspDeInit() in your application ?
If yes, does it contain bus clock deactivation: __HAL_RCC_ADC_CLK_DISABLE(); __HAL_RCC_ADC_FORCE_RESET(); __HAL_RCC_ADC_RELEASE_RESET() ?
I hope my answer has helped you. When your question is answered, please select this topic as solution that answered you, it will help others find that answer faster.
Thanks for your contribution.
Dor_RH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-25 4:05 PM
I did not use the HAL_ADC_MspInit() function, I directly used HAL_ADC_DeInit (&hadc1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-26 2:06 AM
Hello @AlfRomeo,
Could you try to Implement the HAL_ADC_MspDeInit() function: it frees the hardware resources used:
- Disable the Peripheral's clock
- Revert GPIO to their default state
I hope my answer has helped you. When your question is answered, please select this topic as solution that answered you, it will help others find that answer faster.
Thanks for your contribution.
Dor_RH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-26 5:28 PM
I tried it and the ADC works fine, but the power consumption is higher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-27 1:11 AM - edited ‎2024-11-27 1:11 AM
Hello @AlfRomeo,
Could you confirm if the HAL_ADC_MspDeInit() function you are using includes the following bus clock deactivation and reset instructions: __HAL_RCC_ADC_CLK_DISABLE(), __HAL_RCC_ADC_FORCE_RESET(), and __HAL_RCC_ADC_RELEASE_RESET()?
Additionally, it might be helpful to review the ADC examples available in the STM32CubeL4 package, as they can provide useful guidance.
I hope my answer has helped you. When your question is answered, please select this topic as solution that answered you, it will help others find that answer faster.
Thanks for your contribution.
Dor_RH
