AnsweredAssumed Answered

STM32L4 ADC inaccuracy around VREF/2, ADC result gets 'stuck' at 2047

Question asked by Felix Sammer on Jan 13, 2018
Latest reply on Jan 26, 2018 by waclawek.jan

I am experiencing ADC inaccuracy around VREF/2 with the STM32L4. Measurement result gets 'stuck' at 2047 for a couple resolution steps, although signal that is measured increases further. At around approx. 2065 and upwards the ADC samples correctly again.


I already stripped down my code to exclude any influences from other peripherals (using ADC1 and ADC2 with multiple channels in DMA mode in original project) but even if I basically only initialize ADC2 and run it software trigger mode, sampling only one channel and increased sample time (47,5 cycles) I can still observe this phenomena. Checking in debug  mode as well, looking right at the ADC2->DR register.



 HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);

    for(;;) {
        if(HAL_ADC_PollForConversion(&hadc2, 1000) == HAL_OK) {
            ADC2Result = HAL_ADC_GetValue(&hadc2);



Anybody out there that can help me with this or have experienced this issue as well?


One more thing I have in mind I could do to verify this problem is to apply a function generator to the ADC and slowly step through measurement range of the ADC and at the same time dump the ADC result via the internal DAC and plot this with the function generator signal on a scope and see if the signal match.


Regards Felix