Hi all, I am working with DSP of Texas Instruments on an evaluation bard TMS320C6711. I have to generate a sine wave, send it to the output of the board. Then this sine wave passes through a system where it is delayed and distorted in some way, and then I have to measure the phase difference between the original and the received signal. I have no problems with the generation of the sine wave, but the problem is with the phase difference. Tried with FFT transform, but nothing happened. The sine frequency can be up to 4kHz. If someone can help me I would appreciate it very much. Thank you in advance.
How to measure phase difference between generated sine and the same one after delay
Started by ●February 4, 2009
Reply by ●February 4, 20092009-02-04
On Feb 4, 12:09�pm, "luben_i" <luben.il...@abv.bg> wrote:> Hi all, > > I am working with DSP of Texas Instruments on an evaluation bard > TMS320C6711. I have to generate a sine wave, send it to the output of the > board. Then this sine wave passes through a system where it is delayed and > distorted in some way, and then I have to measure the phase difference > between the original and the received signal. I have no problems with the > generation of the sine wave, but the problem is with the phase difference. > Tried with FFT transform, but nothing happened. The sine frequency can be > up to 4kHz. > If someone can help me I would appreciate it very much. > > Thank you in advance.What is the output sample rate? Dirk
Reply by ●February 4, 20092009-02-04
On Feb 4, 2:41�pm, HardySpicer <gyansor...@gmail.com> wrote:> On Feb 5, 7:12 am, robert bristow-johnson <r...@audioimagination.com> > wrote: > > >...> > > to do this analytically, in order to avoid quadrant ambiguity, you > > need to either do a Hilbert Transform on the (delayed) sine you're > > measuring, OR since you said you have no trouble generating sines, you > > should generate two identical sinusoids, except one is 90 degrees > > advanced over the other. �now only one of the sinusoids is being > > outputted, but both sin() and cos() are available to you internally, > > as well as the received (delayed) sinusoid....> > easier way is to use a PLL and integrate the output. >really Hardy? however luben is generating his driving sinusoid (whether it's by LUT or with a critically-stable oscillator), it's only a small software modification to generate the quadrature sinusoid. the code to do a PLL is more. (a PLL has a servo- controller inside and implementing one's own PLL in software, while doable, sometimes is messy.) and i think the "integrate the output" is not necessary. the cleanest phase-discriminator for this is a single multiplier (there's a natural integrator put on the output of this if it is input to a DCO or NCO) and then the PLL osc will settle on being pi/2 outa phase with the sinusoid that it tracks. but if you're already implementing the driving oscillator, it's little extra effort to generate a parallel quadrature sinusoidal output. the alg to multiply and LPF the results isn't a big deal and the arg{ p + j*q } isn't so hard either, if you have a good approximation to the arctan() function. r b-j
Reply by ●February 4, 20092009-02-04
robert bristow-johnson wrote:> since you said you have no trouble generating sines, you > should generate two identical sinusoids, except one is 90 degrees > advanced over the other.It doesn't have to be 90 degrees. A reasonable phase shift or a delay for a few samples would do; it is no brainer to convert it to whatever form. The 90 degree requirement is just a mental block. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●February 4, 20092009-02-04
On Feb 4, 7:06 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> wrote:> robert bristow-johnson wrote: > > since you said you have no trouble generating sines, you > > should generate two identical sinusoids, except one is 90 degrees > > advanced over the other. > > It doesn't have to be 90 degrees. A reasonable phase shift or a delay > for a few samples would do; it is no brainer to convert it to whatever > form. The 90 degree requirement is just a mental block.yeah, that's probably right. but it has to be a non-zero and non-180 phase offset. and it has to be known. then it's just an adjustment of coefficients. i think 90 degree phase shift will result in the best S/ N regarding word quantization. if the two oscillators were 1 degree outa phase, the p and q signals would be largely the same and the difference would be small enough that the quantization on the p and q words would effect that difference more than it would if they were 90 degrees outa phase. but i hadn't considered before that the two reference oscillators wouldn't have to be precisely quadrature. r b-j
Reply by ●February 4, 20092009-02-04
Vladimir Vassilevsky wrote:> > > robert bristow-johnson wrote: > > >> since you said you have no trouble generating sines, you >> should generate two identical sinusoids, except one is 90 degrees >> advanced over the other. > > It doesn't have to be 90 degrees. A reasonable phase shift or a delay > for a few samples would do; it is no brainer to convert it to whatever > form. The 90 degree requirement is just a mental block.Maybe so, but 90 degrees is easer to generate than most other angles. When I want a single-phase oscillator, I generate the quadrature signal and discard it. Its only use is amplitude control. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 4, 20092009-02-04
Jerry Avins <jya@ieee.org> wrote:>Vladimir Vassilevsky wrote:>> robert bristow-johnson wrote:>>> since you said you have no trouble generating sines, you >>> should generate two identical sinusoids, except one is 90 degrees >>> advanced over the other.>> It doesn't have to be 90 degrees. A reasonable phase shift or a delay >> for a few samples would do; it is no brainer to convert it to whatever >> form. The 90 degree requirement is just a mental block.>Maybe so, but 90 degrees is easer to generate than most other angles. >When I want a single-phase oscillator, I generate the quadrature signal >and discard it. Its only use is amplitude control.I will offer the opinion that when an imperfect quadrature signal is used in a mixer, you can take the mixer's output and back out of it the desired result. However, your result will be noisier. Steve
Reply by ●February 4, 20092009-02-04
Steve Pope wrote:> Jerry Avins <jya@ieee.org> wrote: > >> Vladimir Vassilevsky wrote: > >>> robert bristow-johnson wrote: > >>>> since you said you have no trouble generating sines, you >>>> should generate two identical sinusoids, except one is 90 degrees >>>> advanced over the other. > >>> It doesn't have to be 90 degrees. A reasonable phase shift or a delay >>> for a few samples would do; it is no brainer to convert it to whatever >>> form. The 90 degree requirement is just a mental block. > >> Maybe so, but 90 degrees is easer to generate than most other angles. >> When I want a single-phase oscillator, I generate the quadrature signal >> and discard it. Its only use is amplitude control. > > I will offer the opinion that when an imperfect quadrature > signal is used in a mixer, you can take the mixer's output > and back out of it the desired result. However, your > result will be noisier.Sure. Just as a few degrees separation is enough but noisy, a few degrees off quadrature degrades the result very little. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 4, 20092009-02-04
On Feb 5, 12:14 pm, robert bristow-johnson <r...@audioimagination.com> wrote:> On Feb 4, 2:41 pm, HardySpicer <gyansor...@gmail.com> wrote: > > > > > On Feb 5, 7:12 am, robert bristow-johnson <r...@audioimagination.com> > > wrote: > > ... > > > > to do this analytically, in order to avoid quadrant ambiguity, you > > > need to either do a Hilbert Transform on the (delayed) sine you're > > > measuring, OR since you said you have no trouble generating sines, you > > > should generate two identical sinusoids, except one is 90 degrees > > > advanced over the other. now only one of the sinusoids is being > > > outputted, but both sin() and cos() are available to you internally, > > > as well as the received (delayed) sinusoid. > ... > > > easier way is to use a PLL and integrate the output. > > really Hardy? however luben is generating his driving sinusoid > (whether it's by LUT or with a critically-stable oscillator), it's > only a small software modification to generate the quadrature > sinusoid. the code to do a PLL is more. (a PLL has a servo- > controller inside and implementing one's own PLL in software, while > doable, sometimes is messy.) and i think the "integrate the output" > is not necessary. the cleanest phase-discriminator for this is a > single multiplier (there's a natural integrator put on the output of > this if it is input to a DCO or NCO) and then the PLL osc will settle > on being pi/2 outa phase with the sinusoid that it tracks. > > but if you're already implementing the driving oscillator, it's little > extra effort to generate > a parallel quadrature sinusoidal output. the alg to multiply and LPF > the results isn't a > big deal and the arg{ p + j*q } isn't so hard either, if you have a > good approximation > to the arctan() function. > > r b-jI meant analogue!
Reply by ●February 4, 20092009-02-04
robert bristow-johnson wrote:> On Feb 4, 7:06 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > wrote: > >>robert bristow-johnson wrote: >> >>>since you said you have no trouble generating sines, you >>>should generate two identical sinusoids, except one is 90 degrees >>>advanced over the other. >> >>It doesn't have to be 90 degrees. A reasonable phase shift or a delay >>for a few samples would do; it is no brainer to convert it to whatever >>form. The 90 degree requirement is just a mental block. > > > yeah, that's probably right. but it has to be a non-zero and non-180 > phase offset. and it has to be known. then it's just an adjustment of > coefficients. i think 90 degree phase shift will result in the best S/ > N regarding word quantization.Generating one sinewave and then delaying it for few samples so the phase shift is roughly 90 degrees (and then taking that into account) is cheaper then generating sin() and cos() separately. If the delay has to be long, then a two pole filter can be used instead. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com






