Associate
February 15, 2015
Question
STM32F042: voltage sourced by pin in analog mode
- February 15, 2015
- 4 replies
- 1634 views
Posted on February 15, 2015 at 14:15
Hello,
I've found strange problem with voltage sourced by pin in analog mode, I don't recall noticing this with STM32F1 nor F3. Attached file contains very basic project with code copied from ADC/DMA circular mode example from STM32F0 snippets, but stripped little further (i.e. no DMA). I'm running this on minimal board with STM32F042F4. It's clocked with HSI48 and uses PA0 as analog input. Input pin is connected to the ground with 51k resistor. When ADC is running (and it seems to measure voltage correctly, I'm streaming samples via USB) I'm observing unexpected voltage on its input. Voltage value depends roughly on sampling frequency - with 500kSps I'm measuring ~220mV (as averaged by multimeter). Lowering sampling frequency by increasing sampling time or increasing bits/sample lowers this voltage (e.g. when I'll change SMP to maximum value voltage is lowered to ~20mV). If ADC is not started there is (as far as I can measure) no voltage on this pin. Am I missing something with GPIO configuration? Would there be any workaround?