DSPRelated.com
Forums

FM Demod question

Started by Paul Solomon August 2, 2005
"Paul Solomon" <psolomon@tpg.com.au> wrote in message 
news:42f02912$1@dnews.tpgi.com.au...
> > Hi Clay, > > I saw this post last time, however I had already gone down the track of > the cordic implementation so I wanted to see if I could get it to work > that way. I am implementing this on an FPGA so the cordic should work out > to be a fairly efficient implementation, however I am interested in > finding out more about this other method which you have suggested.
Yes, cordic is quite efficient in hardware, but no cordic is even better.
> > I have seen a few other posts relating to this demod style, and I heard > that it is only an approximation. I am fairly concerned in maintaing the > quality of the signal comming in as it is going to be used for > retransmission. So I guess there are 2 things that I am unsure about, and > maybe you could point me to some good references.
If you look at the calculus, there is no approximation here. I just took the derivative. The only place aproximations come into play is if the division is bypassed or simplified and in the implementation of the differentiator. Also one may do an expansion of the denominator about a nominal power thus turning the division into some mults and adds.
> > 1. What is the FIR differentiator, i.e. how do you calculate the number of > taps necessary for a given quality, and work out the coeffecients?
Just use a Parks-McClellan algo to design the differentiator. There are several available for free on the web. Even one from me. You just up the number of taps until the passband ripple meets or exceeds your specifications.
> 2. What is this form of demodulation called? (This would help me with > google)
I'm not trying to be coy, but I call this true FM demodulation. The other approaches are actually phase demodulation and then find the frequency via differentiation. You may wish to search for "instantaneous frequency" Clay
> > Regards, > > Paul Solomon >
"Tim Wescott" <tim@seemywebsite.com> wrote in message 
news:11f09ir8lbvg23a@corp.supernews.com...
> > You could take Clay's suggestion, although you'll need to keep the > sampling rate up: if I'm right that method uses the small-angle > approximation and will distort for large phase jumps.
Tim, Actually there is no SAA used here. I've already used it in narrowband applications with extreme success. Clay
> > This is a cool saga to watch -- I've been wanting to implement something > like this for narrow band FM; it's nice to know you're out there hacking > the brush down for the rest of us. > > -- > > Tim Wescott > Wescott Design Services > http://www.wescottdesign.com
"Paul Solomon" <psolomon@tpg.com.au> wrote in message 
news:42f01ac4@dnews.tpgi.com.au...
> Hi All, > > Thanks for your assistance so far. I have finally got a working FM demod > module that allows me to stick an antenna (with a LNA) on the input of my > dev board and listen to the radio on the output of a DAC. > > I however have hit an unexpected issue in the design relating to the > minimum sample rate of the signals throughout the system which I would > like to get a second opinion on. > > I am under-sampling a clean (filtered) spectrum of 88-108 MHZ with an ADC > running at 80MSPS. this gives me the spectrum in the digital domain at 8 - > 28MHz with an image at 52 - 72MHz . > > From this I do I/Q mixing to downsample the desired channel to 0MHz and > then filter and decimate. > The first filter / decimate stage is a 1MHz pass 9MHz stop filter and I > decimate by 8, taking my sample rate down to 10MSPS. > > After this I apply tighter filter 200kHz pass 400kHz stop on the I and Q > so that I only have my desired station left. > > This is where the problem comes, if I run this straight into an arctan > (cordic) and then phase unwrap / differentiate the system works fine, > however I have 10MSPS to represent a signal with a bandwidth of ~400kHz > which seems to be a major overkill. > > If I decimate after this final filter stage (as I was planning to) by a > factor of 8, this gets my sample rate down to 1.25MSPS which is more > reasonable, however my audio becomes badly distorted. > > A fair amount of experimentation has let me to believe that the distortion > is comming from the phase unwrap process, as when I decimate further, the > phase jumps will get larger, when the phase jumps get greater then pi, the > unwrap will assume a wrap occured and try to correct for it. > > The way I came to this conclusion is with an FM test generator, When I > dont decimate in this last stage, I can demodulate a normal FM carrier > (with a deviation of 75kHz) with out a problem. If I decimate by 2 here, > then i get distortion, but if I bring the carrier deviation down to > ~50kHz, then the distortion goes. when I decimate by 8 I can clear the > distortion by reducing the carrier deviation to ~20kHz. The carrier has no > effect on this distortion, and the spectrum of the signal after decimation > and before the cordic looks correct in all instances. > > So...... This has left me scratching my head, as I thought that I should > only require the BW * 2 + a little but as the sampling frequency, however > this does not seem to be the case here. If anyone has any input that would > be appreciated. Are my results here to be expected or would you have > assumed otherwise? > > > Regards, > > Paul Solomon >
Ok, I think that I have ruled out the problem being related to the phase variance being too great per sample with a few experiements, however I have been doing a bit of reading (of historical comp.dsp articles) and came across this interecting snippet
>> Taking phase = atan(I/Q) >> >> F = atan(I/Q) - atan(I/Q)' >> ------------------------ >> sample interval >> >> (where n' is the previous result n, not the derivative!) >> > >This would be approximating the derivative by the first difference, which >is >a good approximation if you are grossly oversampled, otherwise not.
This is exactly what I am doing.. I am subtracting consecutive samples of arctan(I/Q) to get my frequency. This is working fine with sample rates in the order of 10MSPS for a standard analogue FM transmission with a BW of 300kHz, deviaton of 75kHz... However when I drop the sampling rate down to 5, 2.5, or 1.25MSPS distortion increases substamtially. In all of these cases, I can get rid of the distortion by reducing the modulation depth of the transmitter. Is it likely that my distortion is comming from this first difference approximation?? and if so, is there an easy way of calculating the first derivitive instead? Regards, Paul Solomon
I found this in my notes, it may or may not have some infomration that
apply to your problem....

RF DESIGN 3/92
P95-106.

DDS BASED FM  Discusses fact that the modulation sampling rate must
exceed the nyquist critera based on the maximum modulation freqency
when wideband FM is generated.  The modulation sample clock must
be sufficiently high based not on the highest modulation frequency
but rather on the highest significant sideband spacing.  Thus for
20 kHz modulation with 75 kHz deviation, Carsons rule gives a
maximum significant sideband spacing of 95 kHz so the MODULATION
sample clock must exceed 190 kHz and 380 kHz would be a value with
practical filters.  Also discusses selection of the carrier sample
rate clock.  Article says ideal range is 1/5 clock < carrier freq.
<1/4 clock.  For a 12.8 MHz clock, the carrier freq should lie
between 2.56 MHz and 3.2 MHz.  Shows testing and simulation and
evaluation methods including Bessel carrier null.

Clay S. Turner wrote:

> "Tim Wescott" <tim@seemywebsite.com> wrote in message > news:11f09ir8lbvg23a@corp.supernews.com... > >>You could take Clay's suggestion, although you'll need to keep the >>sampling rate up: if I'm right that method uses the small-angle >>approximation and will distort for large phase jumps. > > > Tim, > > Actually there is no SAA used here. I've already used it in narrowband > applications with extreme success. > > Clay
I saw that after I posted the comment - the next observation is that it is exact when you're taking the differential, but how exact is it when you're approximating the differential with a difference? I'll assume it's good since you've had good results with it, but will it stand up to broadcast quality FM? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
"Tim Wescott" <tim@seemywebsite.com> wrote in message 
news:11f1okk9m8sna1@corp.supernews.com...
>> Clay > > I saw that after I posted the comment - the next observation is that it is > exact when you're taking the differential, but how exact is it when you're > approximating the differential with a difference? I'll assume it's good > since you've had good results with it, but will it stand up to broadcast > quality FM? > > -- >
Hello Tim, It is simply a matter of the length of the differentiator and the amount of oversampling. I had an application where I was finding features in the modulation to within 1/1000th of a sample time. I'm sure this approach can handle broadcast FM just fine. The linearity I had was way better than the flatness of the IF passband. It is pretty easy to have a DSP demodulator exceed the specs of the rest of the radio especially for plain FM. For example if you want the differentiator to work over a range of 0 to 0.4fs then the following relative errors are achievable for the given filter lengths: 11 taps -> 0.029198 21 taps -> 0.000874 31 taps -> 0.000030 If your system has more oversampling, i.e., restrict the differentiator's range to 0 to 0.3fs, then the following relative errors are achievable 11 taps -> 0.000826 21 taps -> 0.000001 So with mild oversampling, modest filter lengths are all that are needed. IHTH, Clay
in article zkVHe.2499$jq.2292@bignews3.bellsouth.net, Clay S. Turner at
Physics@Bellsouth.net wrote on 08/02/2005 21:46:

...

> your phase > > theta = arctan(Q/I) > > and freq > > omega = (d/dt) arctan(Q/I) > > just carry out the calculus > > omega = (I*(d/dt)Q - Q*(d/dt)I) / (I^2 + Q^2)
... in article 11f1okk9m8sna1@corp.supernews.com, Tim Wescott at tim@seemywebsite.com wrote on 08/03/2005 11:28:
> I saw that after I posted the comment - the next observation is that it > is exact when you're taking the differential, but how exact is it when > you're approximating the differential with a difference? I'll assume > it's good since you've had good results with it, but will it stand up to > broadcast quality FM?
actually, Tim and Clay, the trig identity: tan(a-b) = (tan(a) - tan(b))/(1 + tan(a)*tan(b)) can be flipped around a little and get arctan(x) - arctan(y) = arctan( (x-y)/(1 + x*y) ) if |arctan(x) - arctan(y)| < pi/2 so i think that an exact deltaphase (which is something like omega) can be done. i leave it to the reader to work out the details. :-) (translated: "i'm a lazy-ass and i got some other work to do.") -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:BF16731D.95D3%rbj@audioimagination.com...
> in article zkVHe.2499$jq.2292@bignews3.bellsouth.net, Clay S. Turner at > > actually, Tim and Clay, the trig identity: > > tan(a-b) = (tan(a) - tan(b))/(1 + tan(a)*tan(b)) > > can be flipped around a little and get > > arctan(x) - arctan(y) = arctan( (x-y)/(1 + x*y) ) > > if |arctan(x) - arctan(y)| < pi/2 > > so i think that an exact deltaphase (which is something like omega) can be > done.
Hello Robert, Yes that method can certainly be used to find a delta phase, but only in the limit of very small time intervals does delta phase d phase ----------- -> -------- delta time d time This is the difference between finding average and instantaneous frequency. So if his system isn't highly oversampled, he will have slope errors. The method I put forth (it has been around longer than I) will be as accurate as the derivative filters allow. And as I posted before, a little oversampling allows for very accurate derivative evaluation with relatively short FIR filters. By the way, the trig theorem you cited is famous for its use in one of the early ways to accurately find pi. atan(1/2) + atan(1/3) = atan(1) = pi/4 The power series for atan(x) converges much more quickly when |x| <1 than when |x| = 1. Clay
in article ocSIe.25423$Mo.19866@bignews5.bellsouth.net, Clay S. Turner at
Physics@Bellsouth.net wrote on 08/05/2005 19:02:

> > "robert bristow-johnson" <rbj@audioimagination.com> wrote in message > news:BF16731D.95D3%rbj@audioimagination.com... >> in article zkVHe.2499$jq.2292@bignews3.bellsouth.net, Clay S. Turner at >> >> the trig identity: >> >> tan(a-b) = (tan(a) - tan(b))/(1 + tan(a)*tan(b)) >> >> can be flipped around a little and get >> >> arctan(x) - arctan(y) = arctan( (x-y)/(1 + x*y) ) >> >> if |arctan(x) - arctan(y)| < pi/2 >> >> so i think that an exact deltaphase (which is something like omega) can be >> done. > > > Yes that method can certainly be used to find a delta phase, but only in the > limit of very small time intervals does > > delta phase d phase > ----------- -> -------- > delta time d time > > This is the difference between finding average and instantaneous frequency.
you're right. i think, now that i'm thinking, that this trig identity was used for phase unwrapping (without having to go into all of that 4-quadrant crap that atan2() does).
> So if his system isn't highly oversampled, he will have slope errors. The > method I put forth (it has been around longer than I) will be as accurate as > the derivative filters allow.
yeah, i knew that. it's just how to compute dI/dt and dQ/dt. but, with a little delay, you can reconstruct the continuous-time versions of I and Q and compute the derivative from thems. so you're right.
> And as I posted before, a little oversampling > allows for very accurate derivative evaluation with relatively short FIR > filters. > > By the way, the trig theorem you cited is famous for its use in one of the > early ways to accurately find pi. > > arctan(1/2) + arctan(1/3) = atan(1) = pi/4
wow, the one i remember is 4*arctan(1/5) - arctan(1/239) = pi/4 i saw that used in a computer program to compute pi to a zillion digits or so. but it looks like your's works, too.
> The power series for arctan(x) converges much more quickly when |x| <1 than > when |x| = 1.
yeah, arctan(1) is kinda nasty. we should just remember what it is and apply any series approximation for |x| < 1 . (which i did, taking Rick's trick a little further. i think i might have posted it here a long time ago.) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Wed, 3 Aug 2005 12:19:12 -0400, "Clay S. Turner"
<Physics@Bellsouth.net> wrote:

  (snipped)
> >So with mild oversampling, modest filter lengths are all that are needed. > >IHTH, > >Clay
Hi Clay, I agree with you completely. If moderate oversampling is used, Paul might "get away with" using a "central-difference" differentiator defined by: y1(n) = [x(n) - x(n-2)]/2 which, happily, has a group delay that's an integer number of samples. I just discovered an interesting digital differentiator that has a wider freq range of "linear magnitude operation" than the central-difference differentiator. That new(?) differentiator is defined by: y2(n) = -x(n)/16 + x(n-2) -x(n-4) + x(n-6_/16). This "wider-band" y2(n) differentiator has two additional nice properties. (1) It's non-unity coefficients are powers of two, so binary shifts can be used instead of coefficient multiplication. (2) It's group delay is an integer number of samples making it useful for your proposed FM demod scheme. I'm thinkin' of including that "y2(n) differentiator" as a "DSP Trick" in the 3rd edition of my book. See Ya', [-Rick-]