STM32H745ZIT6 ADC error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-17 1: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.
- Labels:
-
ADC
-
Bug-report
-
SPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-18 1:26 AM
Ooo, yes.
Otherwise you get - what you get now. Precision undefined , without first doing calibration call.
see ds:
ALWAYS do calibration first - not replace the poor chip. :)
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-18 1:38 AM
What is the process of the calibration? the HAL_ADCEx_Calibration_Start(..) is used at the startup and then getvalue gets the values and calibrates the ADC accordingly? Do most users calibrate it in this way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-18 1:52 AM
After power up you have to do calibration (mode depends on what you want, differential or single ended input, + linearity calibration for best ( = as in ds) linearity ).
>HAL_ADCEx_Calibration_Start(..) is used at the startup and then getvalue gets the values and calibrates the ADC accordingly?
Right. But you have to do it !
>Do most users calibrate it in this way?
Come on - everyone has to do it. Expept you dont care for the result of an uncalibrated ADC, maybe ok, maybe not.
As you have seen. :)
rtfm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-18 2:01 AM
Thanks for the reply :), is there a code reference for this process anywhere?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-18 2:49 AM
Just have ...
HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED);
at program beginnning..before using ADC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-18 4:03 AM
Thanks :), I will try your recommendation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-30 6:25 AM
As i understood, HAL_ADCEx_Calibration_Start() should be called every "startup". Is there a way to call it self-calibration of the ADC once, save the calibration values (e.g. to internal eeprom) and every statup to recall the same self-calibration values?
I found and used:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-30 6:47 AM
No - you just run
HAL_ADCEx_Calibration_Start(&hadc3, ADC_CALIB_OFFSET_LINEARITY, ADC_SINGLE_ENDED))
1x ...after program start . Thats all. (no need set...get...factory value...etc.)
You get calibrated ADC at actual temperature etc.
Just if your program running 24/7 without any stop - maybe do calibration every some hours or days.
Or only at power up and then never again, if you dont need best performance on long time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-30 7:04 AM
Thanks for your prompt reply.
Right, this works fine, but I want to avoid changing the calibration every power up, meaning i want to have a one-time calibration per product life, as we do a manual calibration in addition to the ADC-self calibration. So trying to figure out how to save and retrieve the self-calibration done in HAL_ADCEx_Calibration_Start().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-07-30 7:09 AM
In addition to the linearity factors, you'll need to program the offset as well, which can be found in the ADC_CALFACT register. The reference manual goes into detail on this, including how to read/write values.
