Showing results for 
Search instead for 
Did you mean: 

ADC Value Distortion

Associate II


I have been experiencing a problem with the usage of the internal ADC on my STM32L476RG Nucleo64 development board. Unfortunately I have not been able to find similar problems online or in the forums.

I would like to use the highest possible sampling rate (5.33 MSps according to However, this wiki article uses the clock divisor of 64x and sample time of 92.5 cycles.

For testing purposes, I am generating a 1Hz 3.3Vpp sine wave with an Agilent 33250A waveform generator and measuring the signal on the wire to the ADC pin with an oscilloscope. As sample rate increases, the signal is distorted immensely.


The signal at 64x clock divisor.


The signal at 8x clock divisor.


The signal at 1x clock divisor.

It seems odd to me that the ADC is strong enough to overpower a waveform generator.

I am using DMA sampling across five channels (though this signal is only on the first one) and writing into a 500x5 buffer.


void OptionReadAllRaw() {
	eprints("Option 0: Read Raw Data From All Sensors\r\n");
	OpMode = ReadAllRaw;
	HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
	HAL_ADC_Start_DMA(&hadc1, (uint32_t*) SensorData,
void TickReadAllRaw() {
	if (SensorDataLastProcessed != SensorDataFresh) {
		uint16_t offset = SENS_BUF_LEN / 2 * SensorDataFresh;
		SensorDataLastProcessed = SensorDataFresh;
		char interm[100];
		for (int i = 0; i < SENS_BUF_LEN / 2; i++) {
			sprintf(interm, "%i %i %i %i %i\r\n",
					SensorData[i * SENS_BUF_WID + offset + 0],
					SensorData[i * SENS_BUF_WID + offset + 1],
					SensorData[i * SENS_BUF_WID + offset + 2],
					SensorData[i * SENS_BUF_WID + offset + 3],
					SensorData[i * SENS_BUF_WID + offset + 4]);
			strcat(sbuf, interm);


I am aware that this will not be sending all of the data; my main issue for now is that the data is bad.

The ConvCplt and ConvHalfCplt callbacks only flip a flag.







Could anyone explain what is happening, and how I can ensure that the ADC readings of values are accurate at the highest possible sample rates?

Please let me know if I can provide any more information on the setup.

Thanks in advance.





Whats the output impedance from the generator ?

Because i see no distortion, the signal is just getting small...looks like high impedance there.

-> ADC here is " Capacitive Charge Redistribution ADC " , 

read about :

The higher the sampling rate, the lower its input impedance ! So you have to drive it with low impedance buffer amp, if you want hi speed sampling.

See ds -> adc...




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

I will look at the impedances, thank you.

Here are some more images:



I suspect that the smearing in the big wave and the jumps in the close up are caused by individual samples - this is at 256x clock divisor, so the slowest that DMA continuous read will go.


The waveform generator has a (fixed) output impedance of 50 Ohm - is that alright?



Senior III

This looks like a problem with the high output impedance of the generator. There may be a problem in the generator or its settings, in the wiring, in the PCB. I would try to load the generator circuit through a resistor, using the unchanged wiring. I would also try measuring with an oscilloscope at different points in the signal path (generator output, PCB connection, MCU pin)

50 ohm is perfect ! (standard for sig.gen. also...)

But when you see the adc switching its 5pF sampling cap to the pin and this giving a visible jump: you have maybe 50K ohm ... 1Mohm impedance at the input pin !

NEVER 51 ohms !

Look again, what you connected and take a DMM to check the resistance of the cabels you use.


btw some sig. generators have output switch : hi-impedance / 51 ohm --- look at your setting there.

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

Thank you both for your answers... I see now it was a brain moment - the waveform generator itself has 50Ohm impedance, but I was using a 1MOhm Probe... 😬

The signal generator was a test, I will update further if I encounter similar problems on sensors...

Thanks again