Continue to Site

Rapid Phase detection between signals

Status
Not open for further replies.

gary36

Full Member level 4
I have two square wave 10Hz signals A and B. Signal A is stationary and signal B shifts in phase from 0 to 360 deg with respect to A. Simpler way of phase detection is finding the time difference between rising or falling edges. The waiting time for phase detection in this case is approx 100ms. Any technique to detect it faster? Say within 100us or even lower?

Hi,

the only possible way: you need to be able to look into the future.

With 10Hz the phase information comes in 100ms period ... no chance to get it more faster.

At least with the given information....

Klaus

If the duty cycle (DC) is fixed and known you can of course cut the
time by the DC factor, eg. measuring the reference to slave period
using a reciprocal period counter approach.

Also one can, depending on design requirements, determine
phase is > some criteria even faster, eg. not have to wait for the
entire period to determine the phase is greater than some constant.
But that time to determination is a f( phase ), the greater the angle
the longer......

If signals generated from DDS a simple read of phase offset register
will yield what the presence and future (until that register is modified)
will be. Sub uS read delay.

Regards, Dana.

The prerequisites aren't clear. If signal A is actually fixed frequency, you can run a phase counter triggered by this signal and determine the relative phase of each signal B edge instantly. If signal A phase or frequency is slowly drifting, you can try to track it but the instant signal B phase info will be less accurate, superimposed by a drift error.

Guess once you define the conditions exactly, you'll also see the solution.

The prerequisites aren't clear. If signal A is actually fixed frequency, you can run a phase counter triggered by this signal and determine the relative phase of each signal B edge instantly. If signal A phase or frequency is slowly drifting, you can try to track it but the instant signal B phase info will be less accurate, superimposed by a drift error.

Guess once you define the conditions exactly, you'll also see the solution.

Just to be sure no confusion exists for OP the counter counts until the second signal edge
occurs, so there is no instant phase measurement at any point in time. Only when the second edge
occurs capturing the counter value has a measurement been effected.

Only when both signals are know quantities in time can one resolve an
instantaneous phase measurement.

Regards, Dana.

Phase measurements cannot be done unless next edge is available. I was just thinking about interpolation done for encoders. Can we apply them in this case?
btw: duty cycle for both the signals are fixed at 50% and do not change

Hi,

you may interpolate between two already measured values.

You may try to do a forecast ... but with what information as input?
They always will be values from the past. and you may try to guess where it goes.
If you have clean input signals (low noise, not much change from one 100ms to the next 100ms).
The more you know about the phase variation vs time the better you can predict the next value.

But currently "we" don´t know ... thus we are not able to tell you how to predict the next level.

Without this knowledge, you most probably you get more noisy and less reliable output.

Klaus

I was just thinking about interpolation done for encoders. Can we apply them in this case?
Encoders have continuously varying signal, e.g. sine/cosine waveform and can be interpolated without additional assumptions. Square wave can't be simply interpolated. There are basically two cases. 1. Signal B phase is constant, you can keep the last measured value. 2. The phase is continuously varying, you have only certain phase information at edge time. By making additional assumptions, you may construct continuous interpolation functions, e.g. representing the behaviour of a physical system.

Could we convert the non reference signal to tri or ramp and predict based
on rate early in the period....? Just thinking out loud which is not my best suit.....

Regards, Dana.

I'd ask the question differently. What's the primary source of signal B, which information does it originally contain? You can't extract information that isn't contained in the original signal by interpolating or "converting" it.

Its a square wave, both signals 10 Hz, with a varying phase shift as a f(t) and
50% duty cycle. I think in retrospect just using a reciprocal counter, trigger
its start for edge A, its stop with edge B would do the trick. As long as max
phase < 360.

Or the DDS approach if both are generated under system control but can
be synchronously generated.

Maybe the OP can fill in a few more blanks about system and use.

Regards, Dana.

Status
Not open for further replies.