cancel
Showing results for 
Search instead for 
Did you mean: 

Best ADC accuracy that can be obtained with a Nucleo board or similar.

Johi
Senior III

I am using STM32F407 and STM32F767ZI on Nucleo and other boards. My configuration is a simple potentiometer as voltage divider (200K or 1K) to generate the analog input voltage.

Even with stable voltage on the ADC input (verified with my fluke 117 & Picoscope 5000, 2,000V, delta < 5mV), the values read on the ADC vary over ranges of about 100mV (0,117mV).

My question:

1) What is a typical accuracy one can expect on such a simple configuration.

2) What is the major contributor to this inaccuracy, and what can be done about it.

Note:

Detailed analysis added as an attachement.

19 REPLIES 19
LCE
Principal

The Nucleo boards have a terrible PCB layout for some signals, because they are made to get all options.

So you might check the layout and if there's anything "noisy" close to the signal path of the ADC input - because I guess you did not put the capacitor close to the STM32's ADC input pins where it should be?

Compared to the ATmegas, the biggest drawback is the STM ADC's low input impedance, so everything above ~ 20kR might get problematic.

In 'F2/'F4/'F7, the ADC is not a "precision instrument". There's a quite significant impact of the digital portion of the chip on the ADC. Your results are a bit excessive, though, and I don't know if those can be attributed to the Nucleo's design, to power supply you are using, or what else exactly.

Read AN4073.

JW

AScha.3
Chief II

@Johi​ 

now i tested : H743 cpu on DevEboard , at 200MHz; Voltage_scale 1 ;

ADC1 in3 , asym. , 25MHz clk, 8.5 sampling , 16 bit, 256x oversampling, HAL call (HAL_ADC_Start()) ;

at input a type-K thermocouple; + ADC_CALIB_OFFSET_LINEARITY used;

conversion time is 175,4 us, average 685ns per conversion; calculated: 680ns, so HAL-call for start needs 1,3 us .

zero-reading: 2400 (+/- 200) ; with thermocouple warm up +8° (calc. = + 0,32mV) reads: 4100; this is at 3,3V about + 0,33mV . so measurement error 0,01mV ; (+/- 10 uV !!! )

offset (2400/256 = ) 9 LSB (from ds : +/- 10 LSB typ.) is not suuuper, but ok.

so i can say, its doing, what datasheet promises.

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

I think the grounded input test you did in 2) above is your answer. That test pretty much defines the self-noise of your ADC system, i.e. the noise that is in your system that you don't have much control over and will be present in every measurement you make. The noise floor is the sum of all the noise generators described in this thread. If you're really trying to make a precision measurement, better than what you can achieve with the on-chip ADC, you might consider an off board ADC. There are literally thousands of choices. Check out the Analog Devices ADC web page. They have dozens of really good app notes to help you select the right ADC. Read some of those and you'll be on your way to being a data acquisition expert. Use their product selector to define the kind of ADC you need: sample rate, number of bits, single ended or differential input, low power, etc. They have ADCs that are specifically designed for the high output impedance situation you're dealing with. And they have pretty low cost evaluation boards for almost all of their ADC with I2C or SPI interfaces that you can connect to your Nucleo board.

S.Ma
Principal

If you want more precision in analog to digital conversion, use an STM32 with ADC supporting differential channels such as STM32H5. It's the analog counterpart of differential pairs for serial interfaces. They are typically used in Wheatstone bridge - Wikipedia

FBL
ST Employee

Hello @Johi​,

You can check AN4073 section 4.1 Configuration options for ADC accuracy, you can try the configurable options.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I have an h735 gdk. Will do similar test. Still refuse to believe my code and cofig are ok ok given the extreme difference between the arduino and the nucleo, factor above 10 in accuracy. Also chinese board same problem. Adc is alternative, i know, for the moment adc in stm32 mcu still puzzeles me.

These values i expect, similar as with mega but 6x better. How is connection made smc?

-- just a wire , in to gnd (at pin header of board). so everything !=0 is noise or adc error.

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

Changing from PA0 to PA3 on the Nucleo board solved my problem. This confirms the noise hypothesis as indicated in the previous posts. Standard deviation went from 0.0025 (10 times better than before). This makes sense as the PA3 (A0) CN9 on the Nucleoboard is a pin that is used on the Arduino as analog input, and routed appropriately and the PA0 as CN11 P28 is probably not.