How to make sure ADC reading get correct values in a single conversion done in a for loop?
I have a code that reads 12-bit ADC value from PA1 of STM32F0. I manage to get the voltage reading right when I just get it from a DC voltage but with an AC voltage produced from an op amp, the values that are stored from the reading consists of a lot of zeros and max values based on the Vref. The way I get the values are by reading ADC value from the pin in a single conversion sequence and continue calling ADC_read in a for loop for 1000 times to get 1000 samples hoping that it would be enough for me to get at least period between one rising edge to another. I assume the readings are wrong since the min and max shown on my oscilloscope is min of 2.5V and max of 2.7V. May I know what is causing the problem here? Is it because the clock is too fast?