Charge injection on pin.read()

I’m sampling the output of some low current op amps, and am seeing the voltage being pulled around when issuing pin.read(). Is there any guidance on how much capacitance is needed to avoid this (my voltages change very slowly, so the only issue with adding cap is bom cost). I haven’t tried yet, but is it possible that using the sampler instead of pin.read could solve this, maybe sample 100ms and average the last 50ms or something?

Maybe a schematic of what you have now would trigger some ideas from others.

Pretty simple, I’ve got a non-inverting op-amp connected to the imp’s ADC input. When the imp samples the pin, it pulls the op-amp output causing a 0.2v transient. I assume this is charge injection due to the imp’s mux switching the ADC to the appropriate input pin.
I’ve found if I do pinx.read(); pinx.read(); and only use the second value, the results are better. I guess the mux keeps switched to pinx, so the transient has settled by the second reading. Just guessing though!

The STM32F205 datasheet has detailed information on this; can you put a cap on the input to deal with the charge injection?

Thanks Hugo. I take it this is the helpful STM32 documentation:
http://www.st.com/content/ccc/resource/technical/document/application_note/group0/3f/4c/a4/82/bd/63/4e/92/CD00211314/files/CD00211314.pdf/jcr:content/translations/en.CD00211314.pdf

I’ll look at adding a capacitor on the inputs for future designs. I’m guessing pin.read() is a two-stage process:
-route the appropriate input pin to the ADC using a mux
-sample
If that’s right, it’d be nice if pin.read took a parameter (delay) between the mux switching and the start of taking the sample, in case a user needs to allocate a bit of time to let things settle.

In the meantime, issuing pinx.read() multiple times seems to be working ok for me.

The selection/reading is driven in hardware (ie it’s not a two step software process). Reading it multiple times (and possibly discarding the first sample) is likely the best option.