cancel
Showing results for 
Search instead for 
Did you mean: 

ADC in Low power run mode

vitthal muddapur
Associate II

Hi,

I have configured ADC like

 ADC_ChannelConfTypeDef sConfig;

  /**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion) 

  */

 hadc.Instance = ADC1;

 hadc.Init.OversamplingMode = DISABLE;

 hadc.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV2;

 hadc.Init.Resolution = ADC_RESOLUTION_12B;

 hadc.Init.SamplingTime = ADC_SAMPLETIME_7CYCLES_5;

 hadc.Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD;

 hadc.Init.DataAlign = ADC_DATAALIGN_RIGHT;

 hadc.Init.ContinuousConvMode = DISABLE;

 hadc.Init.DiscontinuousConvMode = DISABLE;

 hadc.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;

 hadc.Init.ExternalTrigConv = ADC_SOFTWARE_START;

 hadc.Init.DMAContinuousRequests = DISABLE;

 hadc.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

 hadc.Init.Overrun = ADC_OVR_DATA_PRESERVED;

 hadc.Init.LowPowerAutoWait = ENABLE;

 hadc.Init.LowPowerFrequencyMode = ENABLE;

 hadc.Init.LowPowerAutoPowerOff = ENABLE;

 if (HAL_ADC_Init(&hadc) != HAL_OK)

 {

  _Error_Handler(__FILE__, __LINE__);

 }

  /**Configure for the selected ADC regular channel to be converted. 

  */

 sConfig.Channel = ADC_CHANNEL_9;

 sConfig.Rank = ADC_RANK_CHANNEL_NUMBER;

 if (HAL_ADC_ConfigChannel(&hadc, &sConfig) != HAL_OK)

 {

  _Error_Handler(__FILE__, __LINE__);

 }

/* Select PCLK/4 for ADC clock if CKMODE[1:0]=00 as HSI16 */

SET_BIT(ADC1->CFGR2,ADC_CFGR2_CKMODE_1);

My MCU is in Low power Run mode.

In Low power run mode ADC not working..

but i have resume Low power run mode that time is work..

 /*Disable the Low Power Run mode For ADC*/

HAL_PWREx_DisableLowPowerRunMode();

/*ADC Initialization*/

MX_ADC_Init();

/* Get the Battery Perc */

Get_Battery_Status(); //ADC conversion done here

/*Disable the Low Power Run mode*/

HAL_PWREx_EnableLowPowerRunMode();

/*Disable ADC*/

HAL_ADC_MspDeInit(&hadc);

This scenario okay or not ?

My MCU system clock is MSI = 65.536 KHz

0 REPLIES 0