Skip to main content
Visitor II
July 3, 2025
Question

12 Bits ADC precision issue

  • July 3, 2025
  • 4 replies
  • 993 views

Hello,

We are working on a stm32f429.
The application uses ADC1 to sample data on Channel 0-7.

ADC1 and channels characteristics are:

- Mode: Independant
- Sampling clock: Around 2.8 Mhz
- No DMA access
- Sampling delay: 20 clocks periods (max value)
- Resolution: 12 bits
- No scan mode
- NO continuous conversion
- Single conversion mode
- Channel sampling time is 480 clock cyles (max value)
- Vref+ = Vdda = 3.3V
- VSS = 0V


Each channel is connected to a sensor with a voltage variation of 0-3.30V.

The signal on each channel is a low frequency.

The sampling period for all channel is 1 second.
Channels are sampled alternatively in the following order 0,1,2..7.

This works pretty well, with a very good precision for our application.

 

Now the specific issue we have is:

  • When the sensor voltage on channel N is >= 2V, The voltage measured by the ADC on Channel N+1
    is lower than the nominal value by 0.3V.
  • Only channel N+1 is affected all the other channels are not. And the change is always 0.3V.

Each channel has it owns conditionning chain independant from the others.


We have ruled out the conditionning chain as the source of the problem.
Because the input signal on Channel N+1 is stable when the voltage measured by the ADC is reduced by 0.3V.

Our Hypothesis:

We know that during each sampling phase, Channel N for example, the ADC
capacitors are charged up with the channel voltage: 3.3V for example.
At the end of the conversion, the capacitors are not discharged.

At the next sampling phase, Channel N+1, the new channel voltage is 1 V for example.
When the ADC sampling switch is closed, a charge transfer begins between the ADC
capacitors at 3.3V (Channel N value) and channel N+1 at 1V until equilibrium is reached or the adc
sampling time is reached.

If the sampling time is reached before the equilibrium, the ADC caps will holds
a voltage value different from the real channel value => which will produce an erroneous value.

To correct the problem, we have tested two solutions:

Solution 1: Using a dummy channel
We've set up an unused ADC channel tied to GND: let's say a dummy channel.
Then we sample this dummy channel before sampling any real channel.
This approach produce valid data on each channel and solves the problem.

 

Note: When the Dummy channel is tied to 3.3V, the problem remains.

 

Solution 2: Reducing the ADC frequency
By reducing the ADC frequency from 2.8 Mhz to 1.4 Mhz, The problem is solved.


We don't have a deep understanding on the problem at stake here. we have two question:
1 - Has anyone ever had this problem ?
2 - Is our hypothesis pointing to the problem root cause ?

 

    This topic has been closed for replies.

    4 replies

    Super User
    July 3, 2025

    This is an issue with high impedance sources. It takes a while for the capacitor to be charged up.

    See 3.2.7. Effect of the analog signal source resistance here:

    How to optimize the ADC accuracy in the STM32 MCUs - Application note

    Might be some secondary effects happening as well like charge current injection.

    KaremAuthor
    Visitor II
    July 7, 2025

    Thank you for the reply. The source for each ADC Channel comes from an Opamp which has a very low output impedance. Far less than the maximum value as state by the following equation:

    Karem_0-1751887341720.png

    Since the problem is occuring when switching from one channel to another, is there any know issue by ST on this specific point ?

     

    Graduate II
    July 7, 2025

    The sampling and hold capacitor takes time to charge (it never truly reaches the signal in theory if it is a pure RC circuit and there is no inductance).

    You need to wait until the error is lower than the resolution so for 12-bit. So charging more than 99.976% of the signal.

    By sampling a dummy channel there is still crossover from the dummy channel to the signal channel, but it is always towards zero.

    I suspect this may not be an issue since your sampling time is so long.

    But you are running the ADC outside the specified range:
    In stm32f437ai.pdf (DS9484 Rev 13) on page 160 it says Sampling rate can be max 2 Msps.

    KaremAuthor
    Visitor II
    July 8, 2025

    The exact ADC clock value is 2812500 Hz. We can compute the sampling rate:

    SR = ADCclk/ADCSampling time = 2812500/480 = 5859.375 Samples/s or 5,9 kSamples/s << 2 Msps

    Unless my calculation is wrong, the ADC is being run within the specified range.

    Graduate II
    July 8, 2025

    Try putting a small capacitor (a few nf) on each the ADC input channel.

    Super User
    July 9, 2025

    Prepare a minimal but complete compilable code exhibiting the problem, and post.

    JW