I'm trying to get a microcontroller (stm32) to read a quadrature encoder, but running into an issue when at higher speeds line 1 seemingly gets narrower pulses until it gets out of sync with line 2.
In other words, line 1 starts off fine, but as speed picks up it gets shorter pulses. Eventually, with cycle time of ~150usec, it starts dropping off at the wrong time of the cycle, confusing the counter. See image below for the logic analyser view.
I'm not sure whether the problem is with hardware (misaligned detectors? although I don't see anything obvious) or with electronics and would really appreciate advice. Unfortunately I'm a noob with electronics and won't vouch that this simple circuit is enough to handle faster rotations. In particular, many schematics I found on the web use an op-amp, which I don't: example
Below is the schematic, followed by the logic analyzer output. Finally motor and encoder look like this.