Showing results for 
Search instead for 
Did you mean: 

Sampling Time for ADC on STM32L432

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)?


In theory, the cap is discharged completely. In practice, the cap is discharged, but not completely and the reading will be affected slightly by the previous channel.

You should be able to get 4095 when connected to VDD. Perhaps sampling time is too low. Easy to test.

See this for a bunch of details on ADC accuracy:

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

Sampling time requirements for the temp sensor are in the datasheet, but a little hard to find if you don't know it's there.



If you feel a post has answered your question, please click "Accept as Solution".

Thanks for pointing out where to find the Ts_temp. I adjusted my Tsmpl time for that channel and am getting much better temperature readings now. I did observer that when my Tsmpl for the temperature sensor was too low, the counts coming from the AtoD were ~40 counts too high, even with oversampling set to 256x.

I have pretty much decided that the source of my counts not making it all the way up to 4095 nor all the way down to 0 is caused by rails of the amplifier that steps down large voltages to the 0 to 3V range. Now I'm trying to figure out how long my sample times need to be to get an accurate ±0.5 LSB reading. I knew about AN2834. It has some tables for the STM32H7 series. I'm looking for similar tables that would apply to the STM32L432KCU6.

Chief II

There is your "table":

T = R * C * ln(2^N / 0,5)

T - sampling time; R, C - input parameters, N - required accuracy in bits.

AN2834 section "4.4.3 Minimizing additional errors" presents the same formula, but expressed in ADC clock cycles. It's just sad that, instead of presenting the formula as the way to calculate the sampling time, they present it as some "workaround". Presenting a countless tables for a thing, that is not hardware specific and can be calculated by a simple formula, is just plain dumb and it only makes a people less capable of understanding things.

See Table 64 in the L432 datasheet.

The table is for an 80 MHz ADC clock. At 32 MHz, your equivalent sample cycles will be Table*32/80.

For channels connected to op amps, the impedance is low, you will probably find joy with the lower sample cycles.