ADC abnormality after STM32L071RB chip wakes up from STOP mode[Copy link]
In a recent project, I used the ADC of STM32L071RBT6 to convert and sample the external power supply voltage. Everything was normal after booting up, but once the system entered STOP mode, the ADC conversion data was abnormal after waking up. It was very unreliable, and it was flying all over the place from 0 to the maximum value. I don’t know why. After waking up, I initialized the clock with SystemClock_Config(), and the clock should be fine. In addition, I also tried ADC deinit & init, but they didn’t work. Has anyone encountered similar problems? /********************************************************************** * trigger MCU enter stop mode */ void powerSaving(void){ //config GPIO to analog mode (zero consumption for every analog GPIO) lightLed(LED_GREEN, false); //HAL_ADC_DeInit(&hadc); //clear wakeup flag __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); //call power function to enter "STOP" mode HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); //after stop, program continue run from here //config RCC SystemClock_Config(); //sysclkConfig_after_stop(); //adc init HAL_ADC_DeInit(&hadc); MX_ADC_Init(); HAL_ADCEx_Calibration_Start(&hadc, ADC_SINGLE_ENDED); //config GPIO }
After waking up and configuring the clock, you need to confirm whether the clock is configured correctly. Also, after configuring the clock, add a delay to see if it works.
Details
Published on 2018-5-3 08:33
After waking up and configuring the clock, you need to confirm whether the clock is configured correctly. Also, after configuring the clock, add a delay to see if it works.