ADC same values in Vref and CH0 (STM32F103C8T6) (CubeIDE)
Hello everyone! I can't figure out what my mistake is, from the next code, I have the same values for CH0 and VREF (I read others' replies but they don't work for me).
What I'm doing wrong?
//------------------------------------------------------------------------------------------
sConfigPrivate.Channel = ADC_CHANNEL_0;
HAL_ADC_ConfigChannel(&hadc1, &sConfigPrivate);
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1,100);
x = HAL_ADC_GetValue(&hadc1);
HAL_ADC_Stop(&hadc1);
V = x* 1.25 / vref;
sConfigPrivate.Channel = ADC_CHANNEL_VREFINT;
HAL_ADC_ConfigChannel(&hadc1, &sConfigPrivate);
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1,100);
vref = HAL_ADC_GetValue(&hadc1);
HAL_ADC_Stop(&hadc1);
//------------------------------------------------------------------------------------------
