2024-07-17 01:23 AM
I'm encountering an issue with the ADC on my STM32H745ZIT6 microcontroller when reading voltages from a power supply. Here's the problem in detail:
I'm using the ADC to convert analog voltages from a power supply into digital values. However, I've noticed significant inaccuracies in the ADC readings across all voltage ranges. For example, when the power supply outputs 6V, the ADC reads 6.22V consistently, and similar deviations occur across other voltage levels.
I've ensured that the power supply voltages are stable and within the operating range specified for the ADC. The issue is persistent and does not seem to be related to specific voltage thresholds.
Has anyone else in the community encountered similar issues with the STM32H7 series ADC? If so, how did you resolve them? Any insights or suggestions on how to troubleshoot or resolve this issue would be greatly appreciated.
2024-07-17 06:17 AM
ADCs will not be exact. Is this custom hardware? Be sure you follow rules for how to get the best accuracy out of the ADC.
cd00211314-how-to-get-the-best-adc-accuracy-in-stm32-microcontrollers-stmicroelectronics.pdf
You mention voltages outside of the ADC range, so I assume there's a voltage divider or op-amp.
More insight into exactly what the values are and how they're inaccurate would help to address your questions. For a given power supply voltage, do you see variations in the ADC reading? How much variation? Show results, be specific.
2024-07-17 06:35 AM
we are using the MCU in a 60V power supply where the output voltage is reduced to values between 0-2.7V using opamp voltage divider. The ADC is supposed to read the output voltage(after being reduced to 0-2.7V) and it's values are used to give the voltage reading for the user. the problem is that at some of our boards the ADC values are not accurate at some voltages. for example(at a problematic board) instead of reading 6V it reads 6.22 etc. we tried to manually replace the MCU at some controllers and the problem seemed to be fixed. BTW we are using ADC1.
2024-07-17 09:38 AM
0.22V out of a 60 V range is 0.3% error. Fairly low. Can you share your schematic? What are you doing to ensure the accuracy is what you want it to be? Op-amps will add additional error due to gain error, offset, and resistor uncertainties. You're going to see some amount of board to board variance.
2024-07-17 12:38 PM
btw
You did calibrate ..which mode ? -> HAL_ADCEx_Calibration_Start(..)
Whats the ADC reference ?
2024-07-17 10:17 PM
The spec of our power supply allows a maximum of 0.05% error. The issue is that some of the voltages give accurate reading and some(as the 6V mentioned) give and error which varies depending on the output voltage. Unfortunately I cannot share the entire schematics but i can show the resistor divider network.
The V_MEAS_LOCAL is at value of 0-2.7V.
I should mention that When measuring the value of the input to pin PA6 of the MCU (this pin is ADC12_INP3) the voltage is fairly accurate and is what expected. It seems the problem is with the values the ADC1 outputs.
2024-07-18 12:08 AM
Oo , whats the pullup to +12V intended for ??
2024-07-18 12:28 AM
it defines a small offset in the voltage level
2024-07-18 12:37 AM
+ no answer ?
btw
You did calibrate ..which mode ? -> HAL_ADCEx_Calibration_Start(..)
Whats the ADC reference ?
2024-07-18 01:12 AM
We don't use this calibration. Is it necessary?