Open Source Firmware Technician Certification (OSFTC.018) • Super-Fundamentals
A microcontroller’s analog-to-digital converter (ADC) translates a physical voltage into a number. Temperature sensors, battery monitors and industrial controllers depend on that translation. An incorrect reading can originate in the sensor, analog circuitry, voltage reference, sampling configuration or software rather than a defective microcontroller. The goal is to isolate the failure with evidence.
Key objectives
- Calculate ADC resolution and estimate input voltage from a raw code.
- Explain how reference voltage, source impedance and acquisition time affect readings.
- Distinguish clipping, offset, gain error, noise and configuration faults.
- Prepare a safe diagnostic record and interpret a simulated fault.
1. Convert raw codes to voltage
An ideal unipolar 12-bit ADC has 4,096 quantization levels and codes from 0 to 4,095. With a 3.3 V reference, one least significant bit (LSB) represents 3.3 / 4,096 = 0.8057 mV. Code 2,048 corresponds approximately to 1.650 V. Quantization limits resolution; actual accuracy also depends on calibration, noise and component tolerances. Device-specific transfer functions may differ. Consult STMicroelectronics’ ADC introduction before interpreting raw registers.
2. Reference voltage and acquisition time
A SAR (successive approximation register) ADC charges a sampling capacitor from the input during acquisition, then determines a digital code. High source impedance or an acquisition window that is too short can prevent adequate settling, particularly after switching channels. Longer acquisition may improve settling but reduce maximum throughput. Review the board schematic and ADC clock, then compare configured sampling cycles against the device manual. The previous timer and PWM lesson and clock diagnostics lesson explain related timing fundamentals.
If a nominal 3.3 V reference actually measures 3.0 V, a 1.5 V input produces an ideal code near 2,048. Software assuming 3.3 V reports about 1.65 V, a 10% overestimate. The ADC may be operating correctly while conversion software uses the wrong scale.
3. Recognize fault signatures
Clipping: repeated near-zero or maximum codes may indicate saturation, incorrect channel selection or an electrical fault. Offset: a similar voltage error at multiple test points suggests an offset. Gain error: error growing with input magnitude suggests scaling or reference problems. Noise: readings fluctuate around a steady value; averaging can reduce uncorrelated noise, not a systematic error. Verify channel, resolution, data alignment, calibration and trigger settings before blaming hardware. For supply instability, review brownout diagnostics.
4. Simulated diagnostic exercise
A fictional sensor produces 1.50 V on a low-voltage training board. Firmware reports 1.65 V and the independently measured reference is 3.00 V. The raw code is 2,048. Calculate the expected voltage using the measured reference: 2,048 × 3.00 / 4,096 = 1.50 V. The result supports a software reference-scaling mismatch, not proof of defective silicon. Confirm the intended reference configuration and compare several safe test points before recommending a correction.
Record board revision, MCU part number, firmware build, channel, raw code, reference voltage, sampling cycles, instrument uncertainty, expected result and observed result. Preserve logs using the crash-log and recovery workflow. Use only authorized, isolated low-voltage equipment with approved probes and input limits. Never connect a grounded instrument to an unknown energized circuit.
Knowledge check
What does a 12-bit ADC provide? 4,096 levels. Why can a longer acquisition window help? It allows additional capacitor settling time. Can averaging correct a wrong reference assumption? No; the scale must be corrected and validated.
Primary references
STMicroelectronics ADC measurement recommendations; STM32G4 ADC tips (AN5346); Texas Instruments Precision Labs ADC series.
Elementary conclusion
An ADC converts voltage into numbers. Accurate measurements require a reliable reference, enough settling time and correct software interpretation. A technician compares expected and observed values before deciding where a fault originates.
Editor’s Note: Numerical examples are instructional calculations, not measured hardware results. Consult the exact device documentation and approved service procedures.
We volunteer daily to ensure the credibility of the information on this platform is Verifiably True. If you would like to support to help further secure the integrity of our research initiative, please scan the QR code below.


Leave a Reply