1.8V is a lot. Either your circuit isn't working as expected, or the board is assembled poorly.
Sorry, it wasn't 1.8V. 1.8V is the reading I show on my LCD after multiplying it by a factor. The actual reading would be about 50mV.
What actually happens to the voltage on PA3? Does it change at all when you change the level on PA0?
When I change the level of PA0 to LOW, PA3 measure fines. If i were to set PA0 to high, I get an increased reading on PA3.
Is there any signal bounce on the pin? (You may need a >200MHz oscilloscope and high impedance probe to verify this.)
Is there any noise coupling into the ADC pin?
Is the ADC signal source a high impedance?
Tim
ADC is being driven by a buffered op amp, followed by a RC network. I don't see any noise on the scope either.
I had a similar problem with a STM32F072. I had connected one pin that can also be used as an ADC to a 5V transceiver thinking that the pin was 5V tolerant. Obviously wasn't.... As a quick fix I was able to put current limiting resistor between the pin and the transceiver. In the next board rev, I relocated the transceiver to a different pin.
Are you using a PNP and if so what is the voltage at the emitter?
I was using an NPN (2n4401), voltage @ emitter was about ~0.8V.
I tried using a open drain w/ the internal weak pull up resistor and the readings aren't affected much by it.
I think I found the source of the problem (though I'm not too sure why). My VDDA voltage is not within specifications outlined in the datasheet: VDDA >= VDD. As of now, I have it as VDDA = 2.048V and VDD is 3.3V.
Lesson learned! I'm going to change VDDA to 3.3V and see if it fixes it, but won't be getting to it soon.
Edit: I uploaded the same code onto the dev. board with the exact same chip. VDDA here is 3.3V and the readings are measuring fine.