The circuit I am designing includes a PWM signal that goes through a voltage divider, and that signal then gets buffered to be read by an AtoD as part of a measurement circuit. It looks like this:
simulate this circuit – Schematic created using CircuitLab
The R_Probe is a varying resistance, depending on what it is measuring at the time. The PWM is driven direct from a port pin of an MSP430FR6927 microcontroller running at 3.3V. My tests have shown driving directly from the port pin will be no problem as the load isn't large. The PWM runs at approx 2kHz. The op-amp is powered directly from the 3x AAA batteries, so is around 4.3V at the time of writing this.
The resistor and capacitor on the AtoD input I have not determined the values that work best yet, but I have done it with multiple values, including just a 0ohm resistor and no capacitor.
When I put an oscilloscope probe on the non inverting input of the Op-Amp, I get a nice, clean square wave, which changes its peak voltage depending on the resistance of R_Probe.
When a measurement is taken, the output of the buffer (measured at the AtoD point) follows the input (measured at the non-inverting input) as expected. However, when NOT taking a measurement (R_Probe is open circuit), the output of the buffer has an overshoot which looks like this:
Where the red is the input signal and blue is the AtoD signal. This only happens when R_Probe is open circuit, which doesn't make sense to me, as the output should always follow the input. Does anyone know what could be causing this? I have disconnected the probe completely to ensure it is actually open circuit, and still get the exact same waveform. I have tried changing the RC values on the output, which just changes the shape of the peak, and have even removed the capacitor and replaced R3 with a 0Ohm link resistor. I have disconnected the AtoD input also, yet the issue remains.
Is there something I am missing here, or do I perhaps have a strangely behaving op-amp?