Page 1 of 1

stm32f401ccu black pill ADC

Posted: Thu Oct 06, 2022 4:35 pm
by hakam
dear all, i am facing 2 major problems in stm32f401ccu plz guide me
1) black pill is of 12 bit ADC but highest conversion i got 1023 of adc output in serial monitor, but i expected 4096.
2) ADC is looks highly stable when grounded but noisy whn connected to any other dc voltage
when i connect A0 pin to its ground pin it show 0 0 0 0 0 0 0 0 which it show it is very stable without fluctuation . also when i connect A0 pin to 3.3 volt or 3.3+ voltage then it gives steady value of 1023 without any fluctuation & looks highly stable but when i connect it to any other dc volage ( more than 0 and less than 3.3 volt )its value fluctuate a lot ex 820 to 880. i am applying only dc voltage through potentiometer.
plz guide me thnaks

Re: stm32f401ccu black pill ADC

Posted: Fri Oct 07, 2022 12:11 am
by GonzoG
ad. 1. switch to 12 bit mode: analogReadResolution(<bit_resolution>);
ad. 2. You ADC voltage reference is your power supply voltage. If it's unstable, you will have unstable readings.
If you're using any kind of AC/DC power supply, it will never give you absolutely stable output. Use batteries to get a stable voltage source.
And one more thing - ADC in STM32s is very sensitive and can detect current/voltage generated due to RF interference (eg. from AC mains or radio waves)