I have make an STM32F030F4P6 board for reading analog values. When I connect the analog pin to vcc the value is 4095, instead when I connect the analog pin to GND the value isn't 0. How can I solve the problem?
The schematic project:
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
You should check out chapter 12.4.1 of the Reference Manual. The STM32 can calibrate its own ADC perhipal! Offset error is a common problem for internal ADCs in microcontrollers I've encountered so far.
The calibration can be done by the following steps:
- Ensure that ADEN=0 and DMAEN=0
- Set ADCAL=1
- Wait until ADCAL=0
- The calibration factor can be read from bits 6:0 of ADC_DR