Detecting phase between square wave and sine wave signals

Phase detection is the easiest for digital signals; it's basically an XOR gate. I would convert the sine to a square wave. Feed a comparator with the sine on one input and the averaged sine (LPF) on the other, so that the comparator gives a 50 % duty cycle square wave. Then use a digital phase detector.


Since you say you have a DSP processing the sine wave, you can use a complex Fourier transform to measure the phase (you need only evaluate the DFT at the known frequency).

This is actually closely related to what Curd suggested about mixing - a single point DFT is a type of mixer followed by integrators or low-pass filters. The difference is that by doing it in the complex domain (or using an IQ mixer in the analog one) you can determine the angle of the complex output. Using only the real components or only a single mixer, you cannot tell lead from lag and amplitude sensitivity would be more of a challenge.