Part Number: TL331
Tool/software:
Hello,
we are dealing with an issue regarding TL331 used as a square wave generator using sinusoidal comparator input. Below it shown the circuit.

As can be seen, the circuit has hysteresis (100K resistor) to avoid output fluctuations with a noisy input signal.
We have widened the hysteresis as much as possible, but from time to time we continue to see spurious transitions.
At first glance it looks like a clean output:

But widening the time axis shows the following spurious transition

such a transition is sometimes so high as to generate errors in reading by the microcontroller.
Any recommendations on how to use TL331?
We look forward to your cordial feedback.
Best Regards