How it works
An n-bit converter splits the reference into 2ⁿ steps:
LSB = Vref / 2ⁿ V = code × Vref / 2ⁿ
Many firmware helpers (including the STM32 HAL/LL __LL_ADC_CALC_DATA_TO_VOLTAGE macro) divide by 2ⁿ − 1 instead, so the top code maps exactly to Vref. The difference is under one LSB; pick the one your code uses.
An ideal converter’s quantization noise is LSB / √12 rms, so its best SNR is 6.02 n + 1.76 dB: 74 dB for 12 bits. Real ADCs lose some to noise and distortion; the datasheet’s SINAD gives the effective number of bits:
ENOB = (SINAD − 1.76) / 6.02
Tips
- Measuring an unknown supply? Divide it down below Vref first (voltage divider tool) and keep the divider’s impedance within the ADC’s limit.
- On STM32, measure VREFINT to compute the real VDDA instead of assuming 3.3 V.