# STM32 ADC gives wrong values

I have a custom PCB with an STM32F303K8T6 microcontroller onboard. Three values need to be measured with the ADC, but the values from the ADC do not match with the voltages measured at the ADC pins.

The voltages for the ADC2 are both 1.64 V and the measured values are 364 and 2001. ADC1 seems to have an offset (around 0-600) that changes over the applied voltage, like it is temperature dependent. I had such a problem on a STM32F4 Discovery, where the diode was the problem, but here I don't use any diode that could cause that problem.

The reference voltage at the VDDA/VREF+ is exactly 3.3 V (measured). The schematic and the setup in the CubeMX is attached in the images at the bottom. The code to achieve the ADC measurements is the following:

Code:

HAL_ADC_Start(&hadc1);
;

HAL_ADC_Start(&hadc2); // Start regular conversion of regular group (channel 4 and 5)
;