AnsweredAssumed Answered

Strange ADC conversion for temp sensor and internal vref

Question asked by turk.andy on Sep 1, 2012
Latest reply on Jan 24, 2013 by baird.hal.001
I'm running some ADC tests on a VLDiscovery board. The values returned for sampling the internal temp sensor and voltage reference seem to move around in surprising ways. Here's some data:

> ADC samples:
 channel 16: 2401 1732 2047 2046 2046 2048 2048 2047 2048 2046
 channel 17: 1914 1931 2058 2059 2061 1803 1804 2061 1804 2061
 channel  4: 2044 2046 2045 2043 2045 2041 2046 2042 2045 2044
 channel  1:  978  979  978  978  979  978  980  978  978  978
 channel 16: 1307 1896 1895 1896 1896 1896 1897 1897 1897 1897
 channel 17: 1776 1994 1994 1994 1996 1996 1995 1995 1995 1994
ADC samples:
 channel 16: 2402 1733 2046 2045 2045 2046 2044 2045 2046 2047
 channel 17: 1916 1931 2057 2058 2059 2060 2059 2059 2060 2061
 channel  4: 2045 2046 2045 2043 2045 2044 2045 2043 2020 2046
 channel  1:  977  979  979  978  978  978  979  978  978  979
 channel 16: 1307 1896 1895 1896 1895 1895 1896 1895 1896 1896
 channel 17: 1775 1993 1994 1994 1994 1994 1995 1994 1995 1995
ADC samples:
 channel 16: 2401 1731 2045 2044 2045 2046 2046 2046 2045 2046
 channel 17: 1914 1928 2059 2057 2059 2058 2059 2060 2058 2059
 channel  4: 2043 2045 2043 2041 2046 2044 2046 2044 2023 2044
 channel  1:  978  979  978  978  977  978  980  978  978  978
 channel 16: 1308 1895 1894 1896 1895 1895 1896 1895 1896 1895
 channel 17: 1776 1992 1993 1994 1994 1994 1995 1993 1994 1993

These are three successive runs of code that collects 10 samples from six input channels. Channels 16 and 17 are the internal temperature sensor and voltage reference respectively, measured once at the beginning of the run and again at the end. Channel 4 is a voltage divider at 50% of VDD and Channel 1 is set by a potentiometer.

Notice that the external ADC inputs are quite stable (e.g., Channels 1 and 4). However, the internal inputs suggest that temperature and/or voltage are changing between the first sampling and the second. Every ADC sample in this code (regardless of which channel) gets 239.5 ADC clocks for sampling time.

The temp/vref values aren't particularly interesting in the long run, but I'd like to understand what the ADC is doing. Is there an explanation for why the internal stuff varies so much?

In case it matters, I've hacked this VLDiscovery board to use a STM32F103RG mcu instead of the original.

Outcomes