2015-02-15 05:15 AM
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?2015-02-17 12:06 AM
And do you multiplex the ADC input?
JW2015-02-17 10:47 AM
> And do you multiplex the ADC input?
No, this is continuous sampling from single input. I would suspect that with multiplexing effect would be less visible.2015-02-18 02:05 AM
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? The ADC charges a sample capacitor with the input voltage and discharges this capacitor during conversion. Probaby this discharge ist towards Vref/2 and so with the next sampling phase the Vref/2 charged capacitor is discharge in your resistor from ADC input to ground. As a result you measure some voltage, the higher the higher your conversion frequency is.2015-02-18 09:53 AM
> The ADC charges a sample capacitor with the input voltage and discharges this capacitor during conversion. Probaby this discharge ist towards Vref/2 and so with the next sampling phase the Vref/2 charged capacitor is discharge in your resistor from ADC input to ground.
This is true for integrating converters, for SAR it would be at least unusual.