1

I'm looking for guidance on how to select the Sampling Time for the ADC on my STM32L432KCU6. I found some tables in AN2834, but they are for the STM32H7 Series. I'm interested in getting ±0.5 LSB accuracy with 12-bit resolution. I'm running my ADC clock at 32 MHz.

One question I have is whether the ADC discharges (resets) the internal capacitor (C-adc) between every sample or not. If it does, then that tells me that I need to give the circuit enough time to charge C-adc up from 0 to the target voltage, with the worst-case time being when the target voltage is Vref (3 volts).

With my current configuration, I noticed that as I increase the voltage presented to the ADC, the counts value stops increasing near ~4086 which is less than the maximum value of 4095. Does this mean that my Sampling Time is too low?

Also, how do I determine Sampling Time for the internal Channel Temperature Sensor (IN17)?

Here's what I tried: With Sampling Time for all channels set to 12.5 cycles and maximizing the voltage applied to one of the ADC channels, the highest counts I see for that channel are ~4086. When I changed the Sample Time to 24.5 cycles, the highest counts I see for that channel are ~3856. I expected the longer Sampling Time to allow the counts value to go higher, but instead they were unexpectedly lower.

  • I don't know specifically for STM32, but ADC max precision is usually arround the middle of the range, the extremes are not so good (or outright terrible). – Mat Aug 21 '23 at 15:17

1 Answers1

1

One question I have is whether the ADC discharges (resets) the internal capacitor (C-adc) between every sample or not.

No. And you cannot assume anything about its state, it may be influenced by previous sample, i.e. it is not necessarily true that:

worst-case time being when the target voltage is Vref (3 volts)

Have a look also at the errata (I don't know if the 1ms erratum applies to this particular model), and make sure you have calibrated ADC before use.

The increased error at higher sampling time is unexpected, so that maybe requires some further investigation: describe your hardware (is it a "known good" hardware like Nucleo? How exactly are VREF+/VDDA/VSSA connected, are they rock stable? What are the voltages involved? Post a minimal but complete compilable example exhibiting the problem.

Also, how do I determine Sampling Time for the internal Channel Temperature Sensor (IN17)?

Given in Datasheet. Even throwing in calibration values etc., don't expect precisions below several deg.C, though.

JW

wek
  • 137
  • 3