I am using a multiplier phase detector like here 1to find the phase difference between two phase shifted sine signals, and I got the value of magnitude but how to find if the signal 2 is leading/laging wrt signal 1? The cosine would give a positive value for both negative and positive angles.
I also thought of checking the first sample point of both signal 1 and signal 2 to see which has greater magnitude and deduce a conclusion based on that. if (signal 1 > signal 2 => sig 2 is lagging and vice versa).
But I am trying to implement this in a stm32 and I am for some reason, not being able to do that. Is there any other robust way?