2024-05-13 05:21 PM - last edited on 2024-06-11 07:36 AM by Amel NASRI
Hello team,
I am using the default generated code on STM32H725 uC for ADC1. I am using it in polling mode.
The value what I get in ADC DR is 10 times less than the value that I expected.
I tried this for various voltage range on its external pins.
I am using the ADC1 in single end mode. Also, I am using a external ref of 3.3V
Thank you in advance.
Solved! Go to Solution.
2024-05-14 07:56 PM
Issue resolved!
I missed to configure VREFBUF mode as External Voltage Reference. It was in disabled state.
But being in disabled state, the output was in consistent factor of 10.
Thank you all for the efforts and support!
2024-05-13 10:17 PM
It would be good to do ADC calibration.
/**
* @brief Perform an ADC automatic self-calibration
* Calibration prerequisite: ADC must be disabled (execute this
* function before HAL_ADC_Start() or after HAL_ADC_Stop() ).
* @param hadc ADC handle
* @param CalibrationMode Selection of calibration offset or
* linear calibration offset.
* @arg ADC_CALIB_OFFSET Channel in mode calibration offset
* @arg ADC_CALIB_OFFSET_LINEARITY Channel in mode linear calibration offset
* @param SingleDiff Selection of single-ended or differential input
* This parameter can be one of the following values:
* @arg @ref ADC_SINGLE_ENDED Channel in mode input single ended
* @arg @ref ADC_DIFFERENTIAL_ENDED Channel in mode input differential ended
* @retval HAL status
*/
HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef *hadc, uint32_t CalibrationMode, uint32_t SingleDiff)
2024-05-14 07:05 AM
Could you provide more details about your software configuration?
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.
2024-05-14 07:09 AM
Apart of Software configuration, what HW are you using? a custom board? ST board? what is the voltage level of VDDA/VREF+?
2024-05-14 08:50 AM
Hello! Thank you for your response :)
The board is a custom board with VREF = 3.3V.
16-bit mode polling mode. The default code which STM32Cube IDE generates from IOC.
Scenario: If the ADC input is at 3.3V (=VREF), the decimal reading ai get is 6553, which is 10 times less than 65535 (0xFFFF), the full scale reading.
Regards
2024-05-14 09:22 AM
Need also to check if you're in differential / or single ended mode vs your HW:
2024-05-14 02:47 PM
Its single ended mode.
2024-05-14 04:18 PM
Also, after the autocalibration, the value in CALFACT_S is 0x3EE.
Not sure if this is a issue.
2024-05-14 04:28 PM
Any idea on how the value in CALFACT is used? Is it added/subtracted/multiplied/divided with the actual ADC value?
2024-05-14 07:56 PM
Issue resolved!
I missed to configure VREFBUF mode as External Voltage Reference. It was in disabled state.
But being in disabled state, the output was in consistent factor of 10.
Thank you all for the efforts and support!