cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F070 ADC Reference voltage problem

ASz
Associate II

Hi Everyone!

I have read a lot of topics, articles about the F070 ADC settings, calibration, etc., but I couldn't solve my issue. I'm using ADC with DMA right now, but the problem is the same with the interrupt and the polling method. In my code I'm using 3 channels (2 simple ADCs and the Vref). The result of the Vref channel is about 3.4V but I measure 3.31V with voltmeter (the other channels have this kind of problem too). Calibration is used by every 4th cycle and I have a 100nF capacitor between the Vcc and the GND and input filter as well.

I hope You can help.

Thanks in advance.

Andras

26 REPLIES 26
T J
Lead

here is one of my boards setup

ASz
Associate II

Its just a voltage measurement.

I would like to make an MPPT solar battery charger but first I must get accurate values, so I wrote the simplest code, using the HAL library.

I have already made a measurement with interrupt via the registers but it gave wrong values too.

This is my first own project so I'm a bit newbie but doing my best

T J
Lead

I am not convinced that your cal is actually calibrating.

what is the resultant cal-factor ? I am getting 0x41...

ASz
Associate II

I'm getting 0x39

T J
Lead

do you notice that after a power on, the values are different to when the cal is completed ?

I can see after calibration, the jump in readings is significant.

ASz
Associate II

I can't see any significant change after the calibration

I have tried the register level calibration code too, but the result is the same.

ASz
Associate II

I have tried something else

I'm using a DC-DC converter as supply with changing the voltage

My results (around values):

STM voltmeter

3,38 3,32

3,5 3,43

3,65 3,58

The change seems to be linear

T J
Lead

60mV is shocking

where is your ground connection to the meter ?

to check Vdd, you should be across the cap nearest to the Vdd/Vss pins.

both multimeter probes across that cap.

did you use any ferrites ?

its likely that switcher noise is being rectified inside the processor.

ASz
Associate II

I'm measuring the volts on the cap of the Vss and the Vdd.

I could send you my whole circuit if it helps.

T J
Lead

60mV error means there is a major issue, I have 1-2mV error.

did you make the PCB ? maybe you need more caps, or your code is not ok.

You want the slowest rate of conversion on the slowest ADC clock and use NON-BLOCKING code...

download an example, surely it is better than 60mV error..

We are not here to do your work, what is your work ?

are you designing a PCB for a product ?, or hobbyist just getting use to the technology ?

If you plan to work in this area, you need NON-BLOCKING code, more like an OS...

its easy to do... (without RTOS or malloc)

this forum purpose is to help with syntax and structure operations etc.

reading the ADC is supposed to be simple, but because your code is blocking, every issue delays everything else..