I have two 70 MHz signals (one a clean reference sine wave, the other a lot less so), but wish to find the phase difference between these two signals. The A/D, the AD9226: http://www.analog.com/UploadedFiles/Data_Sheets/394988775AD9226_b.pdf has a maximum sampling rate of 65 MSPS, but is rated for a maximum of 200 MHz input. Hence the A/D is suitable for use in undersampling applications. Has anyone any experience of, or references to, measuring phase with such a system -i.e. where the signal is undersampled? I was intended to sample at a freqency that was not a subharmonic of my signal (so perhaps using 4 MHz, as 4 x n != 75, for any integer n). One thought I had was to sample the two signals, compute the FFT's of both, then subtract the phases between the two FFT's. I will be using a DSP board from Innovative Integration: http://www.innovative-dsp.com/ with the AD9226 A/D and the TI 6701 DSP. This combination can sample at a maximum continuous rate of 4 MHz, due to the speed of the bus between the A/D and DSP. But it can go a lot faster if data is collected in a FIFO then transfered to the DSP. I assume clocking the A/D from the same crystal source that is used as a reference for the osccillator will be sensible. Any thoughts? Anyone done this? Any good references? Dr. David Kirkby

# Undersampling to measure phase.

On 20 Sep 2004 04:56:21 -0700, see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) wrote:>I have two 70 MHz signals (one a clean reference sine wave, the other >a lot less so), but wish to find the phase difference between these >two signals. > >The A/D, the AD9226: > >http://www.analog.com/UploadedFiles/Data_Sheets/394988775AD9226_b.pdf > >has a maximum sampling rate of 65 MSPS, but is rated for a maximum of >200 MHz input. Hence the A/D is suitable for use in undersampling >applications. > >Has anyone any experience of, or references to, measuring phase with >such a system -i.e. where the signal is undersampled? I was intended >to sample at a freqency that was not a subharmonic of my signal (so >perhaps using 4 MHz, as 4 x n != 75, for any integer n). > >One thought I had was to sample the two signals, compute the FFT's of >both, then subtract the phases between the two FFT's. > >I will be using a DSP board from Innovative Integration: > >http://www.innovative-dsp.com/ > >with the AD9226 A/D and the TI 6701 DSP. This combination can sample >at a maximum continuous rate of 4 MHz, due to the speed of the bus >between the A/D and DSP. But it can go a lot faster if data is >collected in a FIFO then transfered to the DSP. > >I assume clocking the A/D from the same crystal source that is used as >a reference for the osccillator will be sensible. > >Any thoughts? Anyone done this? Any good references? > >Dr. David KirkbyHi Dr. Kirkby, uh oh, ... this problem may be much more difficult than it first appears. Here are my two cents: I wouldn't use the FFT. The phase difference between your two signals will be a time-dependent function. Using the FFT results in a horrifying lose of time resolution. My guess is that your processing should be strictly time-domain processing. What occurs to me is that you can perform the Hilbert transform on your two discrete signals, and create two "analytic (I/Q) versions of your two signals. In their analytic form, you can then estimate their instantaneous phases. Finally, you can compute the instantaneous difference between the two phase signals. The problem is, accurately estimating the instantaneous phase of an analytic signal requires us to perform that dog-gonned (computationally costly) arctangent operation. Now if your phase difference need not be too accurate (like say, a 4-degree error), there may be computationally-simple ways to estimate instantaneous phase. Hey wait a second! I just had another thought. Perhaps the "Sliding DFT" might be useful to you. That DFT allows you to compute single-bin DFT samples. The nice part is that upon arrival of a new time sample, the new single-bin DFT sample can be computed with (roughly) a half dozen arithmetic operations. It's quite possible that someone else here can give you a simpler way to measure the phase difference between your two signals. Good Luck, [-Rick-]

r.lyons@_BOGUS_ieee.org (Rick Lyons) writes:> [...] > Now if your phase difference need not be too > accurate (like say, a 4-degree error), there > may be computationally-simple ways to estimate > instantaneous phase.And you can get much better than 4 degrees with a variation on that method that would probably be just fine for a C67x processor with lots of RAM. -- % Randy Yates % "How's life on earth? %% Fuquay-Varina, NC % ... What is it worth?" %%% 919-577-9882 % 'Mission (A World Record)', %%%% <yates@ieee.org> % *A New World Record*, ELO http://home.earthlink.net/~yatescr

r.lyons@_BOGUS_ieee.org (Rick Lyons) wrote in news:414ee168.397898125 @news.sf.sbcglobal.net:> On 20 Sep 2004 04:56:21 -0700, > see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) > wrote: > >>I have two 70 MHz signals (one a clean reference sine wave, the other >>a lot less so), but wish to find the phase difference between these >>two signals. >> >>The A/D, the AD9226: >> >>http://www.analog.com/UploadedFiles/Data_Sheets/394988775AD9226_b.pdf >> >>has a maximum sampling rate of 65 MSPS, but is rated for a maximum of >>200 MHz input. Hence the A/D is suitable for use in undersampling >>applications. >> >>Has anyone any experience of, or references to, measuring phase with >>such a system -i.e. where the signal is undersampled? I was intended >>to sample at a freqency that was not a subharmonic of my signal (so >>perhaps using 4 MHz, as 4 x n != 75, for any integer n). >> >>One thought I had was to sample the two signals, compute the FFT's of >>both, then subtract the phases between the two FFT's. >> >>I will be using a DSP board from Innovative Integration: >> >>http://www.innovative-dsp.com/ >> >>with the AD9226 A/D and the TI 6701 DSP. This combination can sample >>at a maximum continuous rate of 4 MHz, due to the speed of the bus >>between the A/D and DSP. But it can go a lot faster if data is >>collected in a FIFO then transfered to the DSP. >> >>I assume clocking the A/D from the same crystal source that is used as >>a reference for the osccillator will be sensible. >> >>Any thoughts? Anyone done this? Any good references? >> >>Dr. David Kirkby >I don't have any specific thoughts on the undersampling idea, but I would like to mention that we have a dspstak I/O module based on the AD9244. This is essentially the same ADC as the AD9226 with two more bits of resolution. The dspstak 21262sx (ADSP-21262 based) has a special high speed interface built in to accomodate the ADC at up to 40M. There is an Analog Devices ap note that discusses this application. We don't have a datasheet yet on the I/O module, but I can discuss details with anyone interested. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com

r.lyons@_BOGUS_ieee.org (Rick Lyons) wrote in message news:<414ee168.397898125@news.sf.sbcglobal.net>...> On 20 Sep 2004 04:56:21 -0700, > see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) > wrote: > > >I have two 70 MHz signals (one a clean reference sine wave, the other > >a lot less so), but wish to find the phase difference between these > >two signals. > > > >The A/D, the AD9226: > > > >http://www.analog.com/UploadedFiles/Data_Sheets/394988775AD9226_b.pdf > > > >has a maximum sampling rate of 65 MSPS, but is rated for a maximum of > >200 MHz input. Hence the A/D is suitable for use in undersampling > >applications. > > > >Has anyone any experience of, or references to, measuring phase with > >such a system -i.e. where the signal is undersampled? > >Dr. David Kirkby > > Hi Dr. Kirkby, > > uh oh, ... this problem may be much more difficult > than it first appears.Just what I did not want to hear!!> Here are my two cents: > I wouldn't use the FFT. The phase difference between > your two signals will be a time-dependent function.I assume you mean since the sample rate is not the same as the signal frequency?> Using the FFT results in a horrifying lose of > time resolution. My guess is that your processing > should be strictly time-domain processing.Okay. I was starging to wonder this myself.> What occurs to me is that you can perform the > Hilbert transform on your two discrete > signals, and create two "analytic (I/Q) versions > of your two signals. In their analytic form, you > can then estimate their instantaneous phases.Can you elaborate a bit more - maths never was my strongest subject. One problem is now do you get an analytic function from a sampled data set?> Finally, you can compute the instantaneous difference > between the two phase signals.> The problem is, accurately estimating the > instantaneous phase of an analytic signal requires > us to perform that dog-gonned > (computationally costly) arctangent operation.> Now if your phase difference need not be too > accurate (like say, a 4-degree error), there > may be computationally-simple ways to estimate > instantaneous phase.It does need to be accurate.> Hey wait a second! I just had another thought. > Perhaps the "Sliding DFT" might be useful to > you. That DFT allows you to compute > single-bin DFT samples. The nice part is that > upon arrival of a new time sample, the new single-bin > DFT sample can be computed with (roughly) > a half dozen arithmetic operations.Em, something else for me to look into. I don't know anything about the sliding DFT.> It's quite possible that someone else here > can give you a simpler way to measure the phase > difference between your two signals.If they can, it would be appreciated. I was led to belive this would be easy using the FFT, but now I am not so sure, since as you say, the phase will be a time varying function of time.> Good Luck, > [-Rick-]

Randy Yates <yates@ieee.org> wrote in message news:<6569huul.fsf@ieee.org>...> r.lyons@_BOGUS_ieee.org (Rick Lyons) writes: > > [...] > > Now if your phase difference need not be too > > accurate (like say, a 4-degree error), there > > may be computationally-simple ways to estimate > > instantaneous phase. > > And you can get much better than 4 degrees with a variation on that > method that would probably be just fine for a C67x processor with lots > of RAM.Can you elaborate. I do need this to be as accurate as its possible to achieve. I might look at a hihger spec A/D to do this better, for for now, I just want some suggestions of how it can be done.

On 23 Sep 2004 03:26:41 -0700, see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) wrote:>r.lyons@_BOGUS_ieee.org (Rick Lyons) wrote in messagenews:<414ee168.397898125@news.sf.sbcglobal.net>...>> On 20 Sep 2004 04:56:21 -0700, >> see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) >> wrote: >> >> >I have two 70 MHz signals (one a clean reference sine wave, the other >> >a lot less so), but wish to find the phase difference between these >> >two signals. >> > >> >The A/D, the AD9226: >> > >> >http://www.analog.com/UploadedFiles/Data_Sheets/394988775AD9226_b.pdf >> > >> >has a maximum sampling rate of 65 MSPS, but is rated for a maximum of >> >200 MHz input. Hence the A/D is suitable for use in undersampling >> >applications. >> > >> >Has anyone any experience of, or references to, measuring phase with >> >such a system -i.e. where the signal is undersampled? >> >Dr. David Kirkby >> >> Hi Dr. Kirkby, >> >> uh oh, ... this problem may be much more difficult >> than it first appears. > >Just what I did not want to hear!!Hi, well, don't give up hope just yet.> >> Here are my two cents: >> I wouldn't use the FFT. The phase difference between >> your two signals will be a time-dependent function. > >I assume you mean since the sample rate is not the same as the signal >frequency?No, that's not what I had in mind. I was thinking (perhaps wrongly) that you want to measure the phase difference between a 70 Mhz sinusoid, Signal# 1, and another (perhaps noisy) 70 MHz sinusoid, Signal# 2. I was guessing that Signal# 2's frequency might be drifting relative to Signal# 1's frequency, Sometimes Sig# 2's freq would be slightly higher than Sig# 1's frequency, and sometimes Sig# 2's freq would be slightly lower than Sig# 1's frequency. If that assumption is true, then the phase difference between Sig# 1 & Sig# 2 would be some sort of oscillating signal. (The signal you're trying to estimate.) Now if you performed 1024-point FFTs on Sig# 1 & Sig# 2, you'd obtain a single value that represented, in some way, that oscillating "phase difference" signal. Well, what if the "phase difference" signal oscillated ten times (or twenty times) over that 1024 time-sample periods? You wouldn't be able to tell what the time-domain shape of the "phase difference" signal is during that 1024 time-sample period. Sheece, I hope that explanation made some sort of sense.> >> Using the FFT results in a horrifying lose of >> time resolution. My guess is that your processing >> should be strictly time-domain processing. > >Okay. I was starging to wonder this myself. > >> What occurs to me is that you can perform the >> Hilbert transform on your two discrete >> signals, and create two "analytic (I/Q) versions >> of your two signals. In their analytic form, you >> can then estimate their instantaneous phases. > >Can you elaborate a bit more - maths never was my strongest subject. >One problem is now do you get an analytic function from a sampled data >set?Well, I don't know about that, but please know that my math skills are "nothing to write home about". This topic is a bit too involved for me to type in all the details here, that I had in mind right now. Let me say that creating an "analytic" signal from a "real-only" signal is covered in the typical college DSP textbooks. I cover the subject in a fair amount of detail in my DSP book (the 2nd Edition, that is). Sorry to say, but I don't have any magazine references, or tutorial webpages, off hand to which I can refer you. Actually, if you have access to IEEE publications, you might take a look at the paper: "Analytic signal generation---tips and traps, IEEE Transactions on Signal Processing, no. 11, vol. 42, Nov. 1994, pp. 3241-3245, by Andrew Reilly and Gordon Frazer and Boualem Boashash. (Andrew posts here, now-n-then.) Another option is to get ahold of a copy of the 2nd edition of my DSP book, "Understanding Digital Signal Processing, 2/E". (MY PUBLISHER MADE ME SAY THAT!)>> Finally, you can compute the instantaneous difference >> between the two phase signals. > >> The problem is, accurately estimating the >> instantaneous phase of an analytic signal requires >> us to perform that dog-gonned >> (computationally costly) arctangent operation. > >> Now if your phase difference need not be too >> accurate (like say, a 4-degree error), there >> may be computationally-simple ways to estimate >> instantaneous phase. > >It does need to be accurate.Ah. Well then Randy's post(s) are worth reviewing.> >> Hey wait a second! I just had another thought. >> Perhaps the "Sliding DFT" might be useful to >> you. That DFT allows you to compute >> single-bin DFT samples. The nice part is that >> upon arrival of a new time sample, the new single-bin >> DFT sample can be computed with (roughly) >> a half dozen arithmetic operations. > >Em, something else for me to look into. I don't know anything about >the sliding DFT.The best places to learn about the "Sliding DFT" are: "The Sliding DFT, an Update", IEEE Signal Processing Magazine, DSP Tips & Tricks column, Vol. 21, No. 1, Jan. 2004, by E.Jacobsen & R. Lyons "The Sliding DFT", IEEE Signal Processing Magazine, DSP Tips & Tricks column, Vol. 20, No. 2, March 2003, by E. Jacobsen & R. Lyons>> It's quite possible that someone else here >> can give you a simpler way to measure the phase >> difference between your two signals. > >If they can, it would be appreciated. I was led to belive this would >be easy using the FFT, but now I am not so sure, since as you say, the >phase will be a time varying function of time.Yep, if you collect 0.1 seconds worth of data on which you perform FFTs, you'll only obtain a single "phase difference" value every 0.1 seconds. Is that often enough to solve your problem? I don't know. The Sliding DFT will give you one "phase difference" value for each new input time-domain sample. That is, the Sliding DFT will give you a "phase difference" output value at a rate that's equal to your A/D sample rate. Not trying to make your life anymore complicated than it is now, I just remembered a vague notion that something called a "Costas Loop" is a method for measuring the phase difference between two sinusoids. I'm not a "communications" engineer so I can't shed any light on Costas Loops. I just mention them in passing as a topic that might deserve a little investigation. Good Luck, [-Rick-]

see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) writes:> Randy Yates <yates@ieee.org> wrote in message news:<6569huul.fsf@ieee.org>... >> r.lyons@_BOGUS_ieee.org (Rick Lyons) writes: >> > [...] >> > Now if your phase difference need not be too >> > accurate (like say, a 4-degree error), there >> > may be computationally-simple ways to estimate >> > instantaneous phase. >> >> And you can get much better than 4 degrees with a variation on that >> method that would probably be just fine for a C67x processor with lots >> of RAM. > > Can you elaborate. I do need this to be as accurate as its possible to > achieve. I might look at a hihger spec A/D to do this better, for for > now, I just want some suggestions of how it can be done.Dr Kirkby, First I compute the quantity beta = (r-i)/(r+i) from Shima's paper (http://home.earthlink.net/~yatescr/Digradio.pdf). This quantity ranges from -1 to +1. If r and i are integers (fixed-point), perform a fixed-point division to N bits (I used N=10). That essentially means that you're quantizing the ideal, real value beta to an N-bit number. So if you divvy up the range -1 to +1 into 2^N sections and perform the mapping on the result to angle theta (in degrees), you'll find that the peak difference between any two adjacent steps is as small as you like (for N=10 it's at most 0.15 degrees). What I actually do in software is take my 10-bit division result and use that to index into a table of 1024 values, each being the exact (well, to 16-bit accuracy, where the quantization error is around pi/2^(15) or better) mapping from beta to angle theta. I generated the table values using Matlab so they're pretty accurate. This differs from Shima's technique in which he takes the computed value of beta and does a power series approximation to the function that yields angle from beta. The actual details are a bit more involved since I do some quadrant mapping. Because of this, I think the accuracy is even better than what I am stating - I'm just too lazy to drag out the code and get the exact values. But it should be AT MOST 0.15 degrees error worst-case. In fact you could easily make this better if you have more memory by simply increasing the length of the division and the corresponding table length. The "inner loop" of this technique is the division, which will require 10 cycles - pretty efficient. And 1024 words is very reasonable on the new DSPs like the TMS320C5510, which have 32K words of data memory and 128K words of program memory. -- % Randy Yates % "Rollin' and riding and slippin' and %% Fuquay-Varina, NC % sliding, it's magic." %%% 919-577-9882 % %%%% <yates@ieee.org> % 'Living' Thing', *A New World Record*, ELO http://home.earthlink.net/~yatescr

Hi David, It seems like you still haven't really defined the problem. What are you really trying to measure? Just saying phase difference is a bit vague. I assume the reference signal is a rock solid, fairly clean, signal. How much different is the frequency of the other signal? How rapidly can it vary its frequency? Is the noise causing significant spectral spread (i.e. is it phase modulating the signal to any extent, or is the noise purely additive?) What is the close in phase noise performance of your reference like? More generally, how spectrally pure is either signal? Most importantly, what precision do you need in your answers, and how rapidly must they update? As others have said, quick rough and ready answers are not hard to achieve. If you want responsiveness and great precision it becomes a rather different problem. Regards, Steve Dr. David Kirkby wrote:>r.lyons@_BOGUS_ieee.org (Rick Lyons) wrote in messagenews:<414ee168.397898125@news.sf.sbcglobal.net>...> > >>On 20 Sep 2004 04:56:21 -0700, >>see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) >>wrote: >> >> >> >>>I have two 70 MHz signals (one a clean reference sine wave, the other >>>a lot less so), but wish to find the phase difference between these >>>two signals. >>> >>>The A/D, the AD9226: >>> >>>http://www.analog.com/UploadedFiles/Data_Sheets/394988775AD9226_b.pdf >>> >>>has a maximum sampling rate of 65 MSPS, but is rated for a maximum of >>>200 MHz input. Hence the A/D is suitable for use in undersampling >>>applications. >>> >>>Has anyone any experience of, or references to, measuring phase with >>>such a system -i.e. where the signal is undersampled? >>>Dr. David Kirkby >>> >>> >>Hi Dr. Kirkby, >> >> uh oh, ... this problem may be much more difficult >>than it first appears. >> >> > >Just what I did not want to hear!! > > > >>Here are my two cents: >>I wouldn't use the FFT. The phase difference between >>your two signals will be a time-dependent function. >> >> > >I assume you mean since the sample rate is not the same as the signal >frequency? > > > >>Using the FFT results in a horrifying lose of >>time resolution. My guess is that your processing >>should be strictly time-domain processing. >> >> > >Okay. I was starging to wonder this myself. > > > >>What occurs to me is that you can perform the >>Hilbert transform on your two discrete >>signals, and create two "analytic (I/Q) versions >>of your two signals. In their analytic form, you >>can then estimate their instantaneous phases. >> >> > >Can you elaborate a bit more - maths never was my strongest subject. >One problem is now do you get an analytic function from a sampled data >set? > > > >>Finally, you can compute the instantaneous difference >>between the two phase signals. >> >> > > > >>The problem is, accurately estimating the >>instantaneous phase of an analytic signal requires >>us to perform that dog-gonned >>(computationally costly) arctangent operation. >> >> > > > > > >>Now if your phase difference need not be too >>accurate (like say, a 4-degree error), there >>may be computationally-simple ways to estimate >>instantaneous phase. >> >> > >It does need to be accurate. > > > >>Hey wait a second! I just had another thought. >>Perhaps the "Sliding DFT" might be useful to >>you. That DFT allows you to compute >>single-bin DFT samples. The nice part is that >>upon arrival of a new time sample, the new single-bin >>DFT sample can be computed with (roughly) >>a half dozen arithmetic operations. >> >> > >Em, something else for me to look into. I don't know anything about >the sliding DFT. > > > >>It's quite possible that someone else here >>can give you a simpler way to measure the phase >>difference between your two signals. >> >> > >If they can, it would be appreciated. I was led to belive this would >be easy using the FFT, but now I am not so sure, since as you say, the >phase will be a time varying function of time. > > > >>Good Luck, >>[-Rick-] >> >>

Randy Yates <yates@ieee.org> wrote in message news:<isa4se4y.fsf@ieee.org>...> see_my_signature_for_my_real_address@hotmail.com (Dr. David Kirkby) writes: > > > Randy Yates <yates@ieee.org> wrote in message news:<6569huul.fsf@ieee.org>... > >> r.lyons@_BOGUS_ieee.org (Rick Lyons) writes: > >> > [...] > >> > Now if your phase difference need not be too > >> > accurate (like say, a 4-degree error), there > >> > may be computationally-simple ways to estimate > >> > instantaneous phase. > >> > >> And you can get much better than 4 degrees with a variation on that > >> method that would probably be just fine for a C67x processor with lots > >> of RAM. > > > > Can you elaborate. I do need this to be as accurate as its possible to > > achieve. I might look at a hihger spec A/D to do this better, for for > > now, I just want some suggestions of how it can be done. > > Dr Kirkby, > > First I compute the quantity beta = (r-i)/(r+i) from Shima's paper > (http://home.earthlink.net/~yatescr/Digradio.pdf). This quantity > ranges from -1 to +1. If r and i are integers (fixed-point), perform a > fixed-point division to N bits (I used N=10). That essentially means > that you're quantizing the ideal, real value beta to an N-bit > number. So if you divvy up the range -1 to +1 into 2^N sections and > perform the mapping on the result to angle theta (in degrees), you'll > find that the peak difference between any two adjacent steps is as > small as you like (for N=10 it's at most 0.15 degrees). > > What I actually do in software is take my 10-bit division result and > use that to index into a table of 1024 values, each being the exact > (well, to 16-bit accuracy, where the quantization error is around > pi/2^(15) or better) mapping from beta to angle theta. I generated the > table values using Matlab so they're pretty accurate. This differs > from Shima's technique in which he takes the computed value of beta > and does a power series approximation to the function that yields > angle from beta. > > The actual details are a bit more involved since I do some quadrant > mapping. Because of this, I think the accuracy is even better than > what I am stating - I'm just too lazy to drag out the code and get > the exact values. But it should be AT MOST 0.15 degrees error > worst-case. > > In fact you could easily make this better if you have more memory > by simply increasing the length of the division and the corresponding > table length. The "inner loop" of this technique is the division, > which will require 10 cycles - pretty efficient. And 1024 words is > very reasonable on the new DSPs like the TMS320C5510, which have > 32K words of data memory and 128K words of program memory.Thanks a lot for that. I will take a look at the paper you mention. I actually have a TMSC6701 DSP, which has floating point support, although perhaps doing this in integera and using a lookup table will be best. I don't have much experience with DSPs, but recall years ago when writing some code that needed sines on a Sun, it was quicker to have a lookup table than to compute sines, despite the fact the CPU had a floating point processor with a sin instruction. However, on later Suns this is not so, and using a lookup table actually slowed one down, rather than speed things up. But I realise DSPs are fast at doing some things (multiples, adds), but poor at others. Thanks for your input.