cancel
Showing results for 
Search instead for 
Did you mean: 

why i get the VDDA value from VREFINT is wrong ?

lxiju
Associate II

I use MCU STM32L073, set VDDA=VREF+=3.29V, VSSA=VREF-=GND=0V.

I read Vrefint_cal for (0x1FF80078), get the value of Vrefint_cal = 0x680

get Vrefint_data from ADC_CHANNEL_17, get this value is Vrefint_data =0xbb7 

the code is here:

////////////////////////////////////////////////////////////

HAL_ADCEx_EnableVREFINT();

 sConfig.Channel = ADC_CHANNEL_17;

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

 {

  _Error_Handler(__FILE__, __LINE__);

 }

 //open adc

if (HAL_ADC_Start(&hadc) != HAL_OK)

{

Error_Handler();

}

 HAL_ADC_PollForConversion(&hadc, 100);

 if ((HAL_ADC_GetState(&hadc) & HAL_ADC_STATE_REG_EOC) == HAL_ADC_STATE_REG_EOC)

{

/* Get the converted value */

Vrefint_data = HAL_ADC_GetValue(&hadc);

Vrefint_cal=*(__IO uint32_t*)(0x1FF80078);

Vdda=3.3*(Vrefint_cal)/Vrefint_data;

printf("Vrefint_cal=%#x,Vrefint_data=%#x Vdda=%#f\r\n",Vrefint_cal,Vrefint_data,Vdda);

//////////////////////////////////////////////////////////

use Vdda=3.3*(Vrefint_cal)/Vrefint_data; I cout vdda = 1.831010, not 3.9V , why???

2 REPLIES 2
Uwe Bonnes
Principal III

Wow, VDDA = 3.9 V is very near the absolute maximum of 4.0 V. As VDDA- VDDx is 0.3 Volt Maximum, this means with VDDA=3.3 Volt you will get a lot of imjected current and nonsense ADC values. With some overshoot on VDDA, the snalig section may also be damaged already.

sorry, I tested the wrong place to get the VDDA value before . i already changed it , please help me to check the question again ,thanks