cancel
Showing results for 
Search instead for 
Did you mean: 

Getting inaccurate value of ADC of STM32F030R8T6

Chetan_1234
Associate II

Hello,
I am working on STM32F030R8T6 with HAL.

We are trying to read ADC values from the 4 ADC channels and 5th channel as VREFINT.
The ADC is configured in continuous DMA read by using:
HAL_ADC_Start_DMA(&hadc, (uint32_t *)ADC_Buffer, 5);
Our AVDD = 3.3 thus giving us resolution of 0.805mV for 12bit configuration.

My problem is that we are getting wrong values for the given input voltage.
and for VrefInt as well we are getting value of 1706, which seems quite high.

Can someone please guide me where can I go wrong?

6 REPLIES 6
TDK
Guru
  • Are other channels accurate?
  • How confident are you that VREF+ = 3.3V?
  • What is the VREFINT_CAL value?
  • Do a single channel conversion on VREFINT to eliminate potential sources of error.
If you feel a post has answered your question, please click "Accept as Solution".
AScha.3
Chief II

Hi,

AScha3_0-1706990977301.png

Did you run calibration first ?

(  HAL_ADCEx_Calibration_Start(&hadcxxx); )

If you feel a post has answered your question, please click "Accept as Solution".

1) No, other channels are also giving incorrect values.

2) Yes, we did a thorough inspection.

3) It falls between 1470 and 1704 in the range.

4) I'll give this solution a shot.

and the software resolution that we are providing is 0.853.

The system's output is shown in the table below.

Actual I/p Voltage

After calculation

A1

A2

A3

A4

3.28

3.207

3.228

3.229

3.239

5.15

5.172

5.234

5.235

5.242

12.95

13.510

13.614

13.605

13.607

1) No, inaccurate outputs are also coming from other channels.

2) Yes, we did a thorough inspection.

3)It falls between 1470 and 1706.

Sure, I'll give this solution a shot.

and the software resolution that we are providing is 0.853.

Please refer to the output table that is also included in the image to see how much input is provided and what is produced.

I appreciate your advise and will give it a try.

TDK
Guru

> 3) It falls between 1470 and 1704 in the range.

That's a very wide range. I would suspect something is wrong with your hardware. Perhaps the rail is not stable.

(Calibrating before using is also required as pointed out.)

If you feel a post has answered your question, please click "Accept as Solution".