STM32L476 measured VREFINT has wrong value
Hello all,
I followed the reference manual to determine VDDA for STM32L476VET6, using the VREFINT measured value together with the calibration value using following code:
if (HAL_ADC_PollForConversion(&hadc1,100) == HAL_OK)
{
ADC_measure_VREF = HAL_ADC_GetValue(&hadc1);
ADC_cal_value = (*VREFINT_CAL_ADDR);
VREF_VOLTAGE = 3000*ADC_cal_value/ADC_measure_VREF;
sprintf(str1,"VREF_CAL: %u\r\n",(unsigned int)ADC_cal_value);
sprintf(str2,"VREF_MEAS: %u\r\n",(unsigned int)ADC_measure_VREF);
sprintf(str3,"VDDA: %umV\r\n",(unsigned int)VREF_VOLTAGE);
HAL_UART_Transmit(&huart2, (uint8_t *)str1, 16, 100);
HAL_UART_Transmit(&huart2, (uint8_t *)str2, 17, 100);
HAL_UART_Transmit(&huart2, (uint8_t *)str3, 16, 100);
}
As result I get 3425mV - which is impossible...
VREFINT_CAL is 1658, that seems right. VREFINT_DATA (measured ADC value) is 1425. This value also doesn't change with time.
ADC clock is 32Mhz, Asynchronous clock mode with Prescaler 128 and I use 640.5 cycles conversion time. VDDA is connected to VDD 3.3V via ferrite bead, VDDA and Vref+ are connected via 47ohms resistor (in fact same as at 32L476GDISCOVERY), I measure at Vref+ 3.29V.
Any ideas to solve this issue are appreciated. Thanks!
