ADC accuracy (offset and gain big errors)
- July 29, 2019
- 2 replies
- 3719 views
Hi,
I'm using the STM32L451VC microcontroller. I'm trying to measure the analog input with an internal ADC (12 bits resolution). The value is compensated with the vrefint (1.21V) of the microcontroller, following the next formula:
Vchannel = (3 V · (VREFINT_CAL) · (ADC channel read value)) / ((Vrefint read value) · 4095)
The analog reference voltage is 2.7V, isolated from the digital one with a ferrite and decoupling capacitors. The clock configuration and samplingTime is configured in the following way:
adcInit.ClockPrescaler = ADC_CLOCK_ASYNC_DIV4;
adcConfig.SamplingTime = ADC_SAMPLETIME_6CYCLES_5;
I think that all of these procedures are well done. However I'm obtaining very big errors (of 75 LSBs). My test is connect a DC voltage to the ADC input in the range of 0-2.7V and check the ADC captured value and measure the error. The file "errors" show the accuracy of the ADC and it is very bad.
I have attached also a graph that represents the ADC voltage read in function of the real value. In this way, we can see the gain (0,0408) and offset problem (-0,0545).
Where is the problem? Errors are very high. This could be noise? Which improvement can I do? There is a way to compensate these errors? (in different PCBs is suitable?)
Any help will be appreciated very much. Thank you in advance.
Luis
