AnsweredAssumed Answered

STM32F042: ADC conversion keeps getting ~.3 - .4V even with 0V input

Question asked by vu.andy on Nov 13, 2017
Latest reply on Nov 13, 2017 by vu.andy

I am not sure why I keep getting around .3 - .4 V even when the measured input is at 0V using a hand-held DMM.  It's hard to imagine my ground noise is that high.  Do you think it could be a software issue? 

Here are the codes for reading ADC value.  The reference voltage is 3.3V.

void StartADCConversion(void)
{
        G_ADC_conv_ready = 0;    
        HAL_ADC_Start_IT(&L_hadc);    
}

 

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)  
{
  double temp_volt = 0;
    if (__HAL_ADC_GET_FLAG(hadc, ADC_FLAG_EOC))
    {
            temp_volt = HAL_ADC_GetValue(hadc);
            G_PackVoltage = (temp_volt/4095.0) * 3.30;
            G_ADC_conv_ready = 1;
    }
}

Outcomes