Skip to main content
Associate II
May 14, 2024
Solved

STM32H725 ADC

  • May 14, 2024
  • 7 replies
  • 2653 views

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.

This topic has been closed for replies.
Best answer by pankaj-xscape

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!

7 replies

hardrock
Associate II
May 14, 2024

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)

 

ST Technical Moderator
May 14, 2024

Hi @pankaj-xscape 

Could you provide more details about your software configuration?

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
mƎALLEm
ST Technical Moderator
May 14, 2024

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 "Best answer" on the reply which solved your issue or answered your question.
Associate II
May 14, 2024

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

mƎALLEm
ST Technical Moderator
May 14, 2024

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 "Best answer" on the reply which solved your issue or answered your question.
Associate II
May 14, 2024

Its single ended mode.

Associate II
May 14, 2024

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

Not sure if this is a issue.

Associate II
May 14, 2024

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

pankaj-xscapeAuthorBest answer
Associate II
May 15, 2024

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!