[Fixed] Cant get ADC to work
Trying to read out a resistive touchscreen right now. To keep everything as simple as possible for testing I created an empty project in CubeMX just for testing this and set up all the pins in a static fashion (No reconfiguration at runtime)
Measuring the ADC input with a multimeter I correctly see the voltage depending on where I touch, however no matter what I try, the ADC always either outputs a static number (Usually the max value of my configured resolution) or at random will (E.g. with 10 bit) Output a value like 0, 255, 512 or 1024.
To eliminate the variable of the touchscreen I've also tried to remove the Touchscreen and connect a potentiometer directly which is connected between ground and 3v3 which made no difference.
I tried pretty much all combinations of resolutions, sample times, Interrupt or not, its always the same result. I have also tried to use ADC2 / ADC3 instead of ADC1 with the same result.
My code looks like this:
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
uint16_t xpos = HAL_ADC_GetValue(&hadc1);
HAL_ADC_Stop(&hadc1);Continuous conversion is enabled, leaving out the ADC Stop makes no difference. I pretty much have no idea any more, if somebody can help me that would be appreciated.