ADC getvalue() not giving values
Hello,
I am using STM32L011G4U7 and wants to get the adc value where it showed once and not it is giving 0 for the adc raw values. Also please let me know that in order to read the vcc that is 3.3 volts do I need to select VREFINT channel as well along with ADC pin?
Here's my code:
void ReadVCC(byte ATR[])
{
HAL_ADC_Start_IT(&hadc);
HAL_ADC_PollForConversion(&hadc, HAL_MAX_DELAY);
adcval = HAL_ADC_GetValue(&hadc);
HAL_Delay(1);
VDDA = VREF * (VREFINT_CAL / adcval);
ATR[6] = (uint8_t) (VDDA>>8); // MSB
ATR[7] = (uint8_t) (VDDA & 0x00FF); // LSB
}
result: adcval 0
VDDA 1
