ADC not running after wake from STOP2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-20 11:11 AM
I'm using STM32L412KBUx on NUCLEO-L412KB, STM32CubeIDE, Version: 1.8.0.
Design:
- ADC1 is set up to continuously poll several channels and update locations in RAM with DMA.
- After a period of inactivity, the application goes to sleep. COMP1 is used to detect a rising voltage on PA1 to wake up using an EVT.
Problem: After waking, the ADC does not seem to be running. The contents of the memory that holds the ADC readings just stay at their old values.
To enter STOP2, I'm using this:
HAL_SuspendTick();
__disable_irq();
__DSB();
__ISB();
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFE);
// sleeping until wakeup event...
To wake:
SystemClock_Config();
HAL_ResumeTick();
/* Exit with interrupts enabled. */
__enable_irq();
I suspect I need to do something to restart the ADC clock.
I tried adding this before the STOP2 entry code above:
if (HAL_OK != HAL_ADC_Stop_DMA(&hadc1))
Error_Handler();
and this following the exit code:
if (HAL_OK != HAL_ADC_Start_DMA(&hadc1, (void *)&raw_recs, ADC_RAW_REC_LEN))
Error_Handler();
but it doesn't seem to make any difference.
Do I need to call something like HAL_RCCEx_PeriphCLKConfig, or perhaps HAL_RCCEx_WakeUpStopCLKConfig?
Solved! Go to Solution.
- Labels:
-
Power
-
STM32L4 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-20 2:59 PM
Oh, never mind, I had a dumb logic error in my code. The ADC is indeed running.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-20 2:59 PM
Oh, never mind, I had a dumb logic error in my code. The ADC is indeed running.
