2020-05-01 09:30 AM
Hello I am exploring the ADC functionality of STM32F103C8T6. I connected a potentiometer to PA2 and connected an LED at PA0 as indicator. The indicator shall get activated once the potentiometer reaches the set threshold. I tried to set the maximum to 4095 which should be 3.3V. However I noticed that the LED did not get activated at the full swing of the potentiometer. I tried lowering down the threshold to 4000 and then the LED got activated at the full swing of the potentiometer. This 4000 is equivalent to about 3.2V only. May I ask what is the reason for this? Is the reference voltage not calibrated. Or is a calibration required?
2020-05-01 09:52 AM
4095 corresponds to your VREF+ voltage which is typically VDD. Depending on your pot, you may not be actually reaching this.
If you hook up VDD to your ADC input, you should get 4095 or very close to. Increase sample time to improve accuracy.
2020-05-01 05:31 PM
Thank you. Yes somehow the potentiometer is not reaching the full scale.
2020-05-03 08:15 PM
Hi TDK I just looked at the datasheet. I was surprised to find out that the VREF+ range is from to 2.4V to VDD (VDD max is 3.6V). The swing is too wide. Is there a way to calibrate this...to set to 3.3V for a consistent ADC readout?
2020-05-03 08:25 PM
You're misinterpreting. VREF+ voltage is whatever voltage you apply on that pin. If you want it precise, apply a precision voltage reference on that pin.
2020-05-03 09:32 PM
Thanks TDK for the clarification.