2025-09-03 2:34 AM - last edited on 2025-09-03 2:46 AM by Andrew Neil
We're using the ADC function built into the STM32F767.
The problem is that when the analog signal input to the ADC is around 200mV, the digital value output from the ADC appears to be around 240-260. We're trying to obtain a stable value by collecting 60 of these digital values and calculating a moving average.
However, quite often, out of the 60 data points, 20-30 values exceed 3000. Therefore, even when averaging the data, the readings are completely different from the actual analog value.
When I measured the input analog signal with an oscilloscope, it was around 200mV +/- 40mV, so I don't think it's due to input signal noise.
I suspect there's something wrong with the MCU's ADC settings or program. Please advise on what I suspect.
2025-09-03 2:48 AM
where is the input signal coming from?
Are you sure that the input signal is actually clean & steady?
Please show your schematic & code:
How to write your question to maximize your chances to find a solution
2025-09-03 3:30 AM
Hi @Seyoung ,
You probably know this already, just a reminder that the 12 bit ADC value returned is an unsigned value, so zero volts in should give you noise fluctuations around 2048. You need to invert the msb (of those 12 bits) in order to convert to a signed integer. Also, worth double checking how you have configured the result to be aligned in the (presumably) 16 bit sample result words: i.e. left or right aligned.
I always do a sanity check that +3.3v and 0v at ADC input are swinging the sample result over the expected full range.
2025-09-03 5:18 AM
What board is this? Ensure VREF+ is steady and appropriately decoupled.
If 30-50% of the values exceed 3000 when they should be ~250, there is something very wrong here. Perhaps show your calculations.