cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L431RCI: Why is the voltage on pin VDDA jumping from 1.85V (external voltage regulator) to 1.94V after ADC_CR1_ADEN bit is set?

MosRa42
Associate II

Source:

int main(void)

{

  HAL_Init();

  RCC_OscInitTypeDef RCC_OscInitStruct = {0};

  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};

  /** Initializes the CPU, AHB and APB busses clocks 

  */

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;

  RCC_OscInitStruct.MSIState = RCC_MSI_ON;

  RCC_OscInitStruct.MSICalibrationValue = 0;

  RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;

  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;

  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

  {

    Error_Handler();

  }

  /** Initializes the CPU, AHB and APB busses clocks 

  */

  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

               |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;

  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)

  {

    Error_Handler();

  }

  PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;

  PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_SYSCLK;

  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)

  {

    Error_Handler();

  }

  /** Configure the main internal regulator output voltage 

  */

  if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE2) != HAL_OK)

  {

    Error_Handler();

  }

  ADC_ChannelConfTypeDef sConfig = {0};

  hadc1.Instance = ADC1;

  hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;

  hadc1.Init.Resolution = ADC_RESOLUTION_12B;

  hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;

  hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;

  hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

  hadc1.Init.LowPowerAutoWait = DISABLE;

  hadc1.Init.ContinuousConvMode = DISABLE;

  hadc1.Init.NbrOfConversion = 1;

  hadc1.Init.DiscontinuousConvMode = DISABLE;

  hadc1.Init.NbrOfDiscConversion = 1;

  hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;

  hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;

  hadc1.Init.DMAContinuousRequests = DISABLE;

  hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED;

  hadc1.Init.OversamplingMode = DISABLE;

  if (HAL_ADC_Init(&hadc1) != HAL_OK)

  {

    Error_Handler();

  }

  HAL_ADC_Start(&hadc1);

  while (1)

  {

     

  }

}

1 ACCEPTED SOLUTION

Accepted Solutions

Do you have SYSCFG_CFGR1.BOOSTEN switched on?

JW

View solution in original post

8 REPLIES 8

Against which point do you measure? What is VSSA/VREF- voltage/change against that point?

JW

MosRa42
Associate II

Thank you waclawek.jan for the fast answer! I measure VDDA against GND, VSS and VSSA is bound to GND.

In real world, there are real resistances between different points of the same conductor.

Measure VSSA against the same point you called GND. Is there any voltage jump associated with switching on the ADC?

JW

MosRa42
Associate II

VSSA is at VSS and GND level. The problem is that the VDDA output of the STM32L431RCI is driving the linear voltage regulator (TPS7A02) output from 1.85V up to 1.94V.

The same is happening on the NUCLEO STM32L433RC-P board with external VDDA at 1.8V (desoldered SB78) but it is pushed up to 2.4V. So why is current flowing from the VDDA input to the linear voltage regulator output, as soon as the ADC is enabled?

Do you have SYSCFG_CFGR1.BOOSTEN switched on?

JW

MosRa42
Associate II

No it is not enabled! I guess that was the problem, as stated in the reference manual:0693W00000KdQ3JQAV.pngAfter I set the BOOSTEN bit the voltage dropped back down to 1.85V.

Thank you very much waclawek.jan you solved it!! 🙂

MosRa42
Associate II

For completeness if someone has the same problem...

The limitation is mentioned in the device errata (ES0320-Rev6, Page 9):

  • "Current injection from VDD to VDDA through analog switch voltage booster"

With the workarround:

  • "Enable the I/O analog switch voltage booster, by setting the BOOSTEN bit of the SYSCFG_CFGR1 register. when VDDA is below 2.4 V and VDD is above 3 V"

Thanks for that detail.

JW