cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H725 ADC

pankaj-xscape
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
pankaj-xscape
Associate II

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!

View solution in original post

9 REPLIES 9
hardrock
Associate III

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)

 

FBL
ST Employee

Hi @pankaj-xscape 

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.

SofLit
ST Employee

Apart of Software configuration, what HW are you using? a custom board? ST board? what is the voltage level of VDDA/VREF+?

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.
pankaj-xscape
Associate II

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

Need also to check if you're in differential / or single ended mode vs your HW:

SofLit_0-1715703723907.png

 

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.

Its single ended mode.

pankaj-xscape
Associate II

Also, after the autocalibration, the value in  CALFACT_S  is 0x3EE.

Not sure if this is a issue.

pankaj-xscape
Associate II

Any idea on how the value in CALFACT is used? Is it added/subtracted/multiplied/divided with the actual ADC value?

pankaj-xscape
Associate II

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!