Forums

some help please on more efficient way to detect tones?

Started by jacobfenton January 8, 2010
>jacobfenton wrote: >>> jacobfenton wrote: >>>> Perhaps I need to give some more information. >>>> >>>> The I-Q data is coming from an AD9874 IC. I can change the rate at >> which >>>> is sends me data. But I have a requirement that I need to have a >> certain IF >>>> bandwidth filter, which is achieved in the AD9874 and is affected by >> what I >>>> tell the AD9874 to set its decimation factor too, which corresponds
to
>> how >>>> fast I get data. This IF bandwidth is rather large, therefore I
cannot
>> set >>>> the decimation in the AD9874 to high, so I need to accept the fast >> data >>>> rate. >>>> >>>> Do I make the correct assumption that I must do the FM demodulation
at
>>>> this high data rate, otherwise if I decimate more inside the DSP >> before I >>>> demodulate, I effectively reduce my IF bandwidth filter? >>>> >>>> It does seem that I can decimate after demodulation for my tone >>>> detection. >>>> >>>> I also have bandwidth requirements for my tones I must detect. I put
a
>>>> matlab file together which does my Goertzel algorithm, therefore the >> bin >>>> size affected the bandwidth of the tone I could detect along with
the
>>>> threshold I set. So if N gets too large, my bandwidth for detection >> does >>>> down it seems. So there is some compromise between N and bandwith of >> tone I >>>> can detect. >>>> >>>> Also is there a faster FM demodulation formula I could use, or is
the
>> one >>>> I posted the best one? >>>> >>>> Thanks all for your input. >>>> >>>> -Jacob Fenton >>> I get the impression that you're overconstraining your approach. >>> For example, why would N affect the bandwidth of the tones you can >>> detect? If N is too small then I can imagine the filter bandwidth
being
>> >>> too large but not the other way around. >>> >>> Fred >>> >> >> I am not trying to constrain my approach any more then the
requirements
>> are set upon me, but perhaps I don't fully understand everything, which
is
>> what I am trying to do, learn. > >Jacob, > >I'm sorry I wasn't of more help as I don't fully understand your >constraints. But, I trust my gut and that's what it was telling me. I >hope I gave you enough of a hint to be able to explore those woods of >yours on your own. > >I *think* I understand the IF issue: > >You have a very high carrier frequency or center frequency shall we say? >Pre-sampling, the tones show up there and are quite close to a multiple >of the sampling frequency. In fact, about 7-13 kHz away / close. > >Post-sampling IQ, the tones are where they're advertised to be and I'd >say that the "Intermediate Frequency" or IF is intentionally set to be >zero. And, from the information you've given us, the IF bandwidth needs
>to be around 16kHz. > >I've not yet taken into account that the samples are IQ so there may be >a factor of 2 smaller bandwidth needed as each set of samples only needs
>to occupy at most -/+8kHz and the sample frequency 16kHz. I'm not able >to reconcile this with the reported "tone frequencies". If the IQ >sampling were done efficiently then the tones would show up >symmetrically around zero with the lower ones (or upper?) below zero and
>the upper ones above zero frequency. But, this isn't something that >I've done so I'd best not go there.... > >So, now we're really into it.... the AD9874 technical article says: >"For example, with a clock frequency of 24 MHz the signal bandwidth can >be as low as 12.5 kHz or as high as 250 kHz." > >Hmmmm .... you say you have an IF bandwidth "requirement" but didn't say
>what that bandwidth is. So, is it different than the tones given would >imply? Otherwise I'd be looking for less input bandwidth or Fs coming >into the DSP. > >Fred > > >
One of my problems is I am not an expert at RF, but I will try to elaborate more on the IF bandwidth. All the RF gets converted down to an IF by the AD9874, 3MHz. This is sampled at 24MHz clock rate, then decimated down, to a suitable data rate which comes to the DSP. In our RF system, there is a requiremnt that the IF bandwidth filter have 180kHz at 3dB and 225kHz at 60dB down (those values are estimates, the proper values I left at work also we are working on seeing if we can reduce this bandwidth). In the RF system the final SAW filter does not filter the IF(prior to entering the AD9874) to that degree, so we determined that we could meet that IF filter requirement with the AD9874 inherent filtering from the decimation filtering it does. In the AD9874 datasheet they show decimation filter curves for different decimation values you program it too. To get the high bandwidth we need, the decimation must be set to a minimum, thus making the data rate to the DSP fast, currently the 250kHz rate at which it sends me IQ data. That IF bandwidth requirements accounts for many things, doppler effect, transmitter clock drift, our reciever clock drift, etc. Maybe to look at it, the IF is the carrier, but after we have mixed it down to a suitable frequency. The FM coming in is at 425MHz, we then mix it down to 71MHz and then the AD9874 mixes it down to 3MHz. The tones themselves have a seperate bandwidth requirment, of +/-4% max. of the tone value and +/-1% min. After thinking about this all weekend, I think I have come to the following conclusions so far: To meet the IF (or carrier) bandwidth requirement I must accept a fast data rate from the AD9874 and then run the FM demodulation algorthim on that data. Once I get the Audio from the demodulation algorithm I can filter and decimate since I don't need as much bandwidth to detect the tones in the Audio data. Please understand, I am really learning on the fly here with this project, this is why I am asking all these questions to you guys who are experts, and I do really appreciate your responses. -Jacob

jacobfenton wrote:

> All the RF gets converted down to an IF by the AD9874, 3MHz. This is > sampled at 24MHz clock rate, then decimated down, to a suitable data rate > which comes to the DSP. In our RF system, there is a requiremnt that the IF > bandwidth filter have 180kHz at 3dB and 225kHz at 60dB down (those values > are estimates, the proper values I left at work also we are working on > seeing if we can reduce this bandwidth). In the RF system the final SAW > filter does not filter the IF(prior to entering the AD9874) to that degree, > so we determined that we could meet that IF filter requirement with the > AD9874 inherent filtering from the decimation filtering it does. In the > AD9874 datasheet they show decimation filter curves for different > decimation values you program it too. To get the high bandwidth we need, > the decimation must be set to a minimum, thus making the data rate to the > DSP fast, currently the 250kHz rate at which it sends me IQ data. > > That IF bandwidth requirements accounts for many things, doppler effect, > transmitter clock drift, our reciever clock drift, etc. Maybe to look at > it, the IF is the carrier, but after we have mixed it down to a suitable > frequency. The FM coming in is at 425MHz, we then mix it down to 71MHz and > then the AD9874 mixes it down to 3MHz. > > The tones themselves have a seperate bandwidth requirment, of +/-4% max. > of the tone value and +/-1% min. > > After thinking about this all weekend, I think I have come to the > following conclusions so far: > > To meet the IF (or carrier) bandwidth requirement I must accept a fast > data rate from the AD9874 and then run the FM demodulation algorthim on > that data.
If your goal is just detecting the tones, you don't have to accept fast data rate. You can decimate in place.
> Once I get the Audio from the demodulation algorithm I can filter and > decimate since I don't need as much bandwidth to detect the tones in the > Audio data.
Yes.
> Please understand, I am really learning on the fly here with this project, > this is why I am asking all these questions to you guys who are experts, > and I do really appreciate your responses.
How much is the real part of appreciation? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
jacobfenton wrote:
>> jacobfenton wrote: >>>> jacobfenton wrote: >>>>> Perhaps I need to give some more information. >>>>> >>>>> The I-Q data is coming from an AD9874 IC. I can change the rate at >>> which >>>>> is sends me data. But I have a requirement that I need to have a >>> certain IF >>>>> bandwidth filter, which is achieved in the AD9874 and is affected by >>> what I >>>>> tell the AD9874 to set its decimation factor too, which corresponds > to >>> how >>>>> fast I get data. This IF bandwidth is rather large, therefore I > cannot >>> set >>>>> the decimation in the AD9874 to high, so I need to accept the fast >>> data >>>>> rate. >>>>> >>>>> Do I make the correct assumption that I must do the FM demodulation > at >>>>> this high data rate, otherwise if I decimate more inside the DSP >>> before I >>>>> demodulate, I effectively reduce my IF bandwidth filter? >>>>> >>>>> It does seem that I can decimate after demodulation for my tone >>>>> detection. >>>>> >>>>> I also have bandwidth requirements for my tones I must detect. I put > a >>>>> matlab file together which does my Goertzel algorithm, therefore the >>> bin >>>>> size affected the bandwidth of the tone I could detect along with > the >>>>> threshold I set. So if N gets too large, my bandwidth for detection >>> does >>>>> down it seems. So there is some compromise between N and bandwith of >>> tone I >>>>> can detect. >>>>> >>>>> Also is there a faster FM demodulation formula I could use, or is > the >>> one >>>>> I posted the best one? >>>>> >>>>> Thanks all for your input. >>>>> >>>>> -Jacob Fenton >>>> I get the impression that you're overconstraining your approach. >>>> For example, why would N affect the bandwidth of the tones you can >>>> detect? If N is too small then I can imagine the filter bandwidth > being >>>> too large but not the other way around. >>>> >>>> Fred >>>> >>> I am not trying to constrain my approach any more then the > requirements >>> are set upon me, but perhaps I don't fully understand everything, which > is >>> what I am trying to do, learn. >> Jacob, >> >> I'm sorry I wasn't of more help as I don't fully understand your >> constraints. But, I trust my gut and that's what it was telling me. I >> hope I gave you enough of a hint to be able to explore those woods of >> yours on your own. >> >> I *think* I understand the IF issue: >> >> You have a very high carrier frequency or center frequency shall we say? >> Pre-sampling, the tones show up there and are quite close to a multiple >> of the sampling frequency. In fact, about 7-13 kHz away / close. >> >> Post-sampling IQ, the tones are where they're advertised to be and I'd >> say that the "Intermediate Frequency" or IF is intentionally set to be >> zero. And, from the information you've given us, the IF bandwidth needs > >> to be around 16kHz. >> >> I've not yet taken into account that the samples are IQ so there may be >> a factor of 2 smaller bandwidth needed as each set of samples only needs > >> to occupy at most -/+8kHz and the sample frequency 16kHz. I'm not able >> to reconcile this with the reported "tone frequencies". If the IQ >> sampling were done efficiently then the tones would show up >> symmetrically around zero with the lower ones (or upper?) below zero and > >> the upper ones above zero frequency. But, this isn't something that >> I've done so I'd best not go there.... >> >> So, now we're really into it.... the AD9874 technical article says: >> "For example, with a clock frequency of 24 MHz the signal bandwidth can >> be as low as 12.5 kHz or as high as 250 kHz." >> >> Hmmmm .... you say you have an IF bandwidth "requirement" but didn't say > >> what that bandwidth is. So, is it different than the tones given would >> imply? Otherwise I'd be looking for less input bandwidth or Fs coming >> into the DSP. >> >> Fred >> >> >> > One of my problems is I am not an expert at RF, but I will try to > elaborate more on the IF bandwidth. > > All the RF gets converted down to an IF by the AD9874, 3MHz. This is > sampled at 24MHz clock rate, then decimated down, to a suitable data rate > which comes to the DSP. In our RF system, there is a requiremnt that the IF > bandwidth filter have 180kHz at 3dB and 225kHz at 60dB down (those values > are estimates, the proper values I left at work also we are working on > seeing if we can reduce this bandwidth). In the RF system the final SAW > filter does not filter the IF(prior to entering the AD9874) to that degree, > so we determined that we could meet that IF filter requirement with the > AD9874 inherent filtering from the decimation filtering it does. In the > AD9874 datasheet they show decimation filter curves for different > decimation values you program it too. To get the high bandwidth we need, > the decimation must be set to a minimum, thus making the data rate to the > DSP fast, currently the 250kHz rate at which it sends me IQ data. > > That IF bandwidth requirements accounts for many things, doppler effect, > transmitter clock drift, our reciever clock drift, etc. Maybe to look at > it, the IF is the carrier, but after we have mixed it down to a suitable > frequency. The FM coming in is at 425MHz, we then mix it down to 71MHz and > then the AD9874 mixes it down to 3MHz. > > The tones themselves have a seperate bandwidth requirment, of +/-4% max. > of the tone value and +/-1% min. > > After thinking about this all weekend, I think I have come to the > following conclusions so far: > > To meet the IF (or carrier) bandwidth requirement I must accept a fast > data rate from the AD9874 and then run the FM demodulation algorthim on > that data. > > Once I get the Audio from the demodulation algorithm I can filter and > decimate since I don't need as much bandwidth to detect the tones in the > Audio data. > > Please understand, I am really learning on the fly here with this project, > this is why I am asking all these questions to you guys who are experts, > and I do really appreciate your responses. > > -Jacob
Jacob, Up to now I've been ignoring the demodulation part - perhaps should not have but I don't have any experience with that formula. What I'm thinking is that the formula only needs so much bandwidth / sample rate also. Does it make sense to LPF and decimate the data into the formula? That's a fundamental question if the formula uses up much compute power. I guess that's what you've said you're looking into. Good idea. Then, coming out of the demodulator pretty much everything I said earlier applies regarding sample rate. Decimation can be done like this: LPF and reduce the sample rate all in the time domain. FFT, zero "everything" around Fs/2 .. say from fp to Fs-fp leaving nonzero results only up to fp. Then join the nonzero sequences by eliminating the zeroed parts - thus reducing N and Fs. Then, for drill, you could IFFT the shorter sequence. But, it seems that none of this would be necessary if you're doing a transform on the audio data first. Consider this: If you decimate in time before doing any transforms then the transforms will be shorter for a given temporal window. If you don't decimate in time before doing any transforms then the transforms will be as long as they need to be. Either way, the spectral resolution is determined by the length of the temporal window. If the sample rate is higher, there are more samples in frequency but over a broader spectrum (which may be useless). If the sample rate is lower, there are fewer samples in frequency because of a narrower spectrum (lower Fs) with exactly the same frequency sample interval. Since you're compute-bound with the DSP then you want to look at: How many operations to do an adequate job of decimation in time plus doing a shorter FFT? How many operations to simply FFT instead? (Unless Goertzel then at least your FT is Fast, i.e. FFT, yes?) (I'm assuming that filtering in time is less efficient than aggregating samples in frequency. But, you could compute that as well. How many operations to do 4 filters in time? If the filters are long and if the data sequences are long (it appears the latter are) then doing an FFT first is likely more efficient.) A simple scheme: Either decimate by a factor "L" or not. One data stream. Then: Decimated or not: Implement 4 time domain filters with adequate bandwidth. If the bandwidth is very wide per filter then you may want to integrate the output energy of each. Figure out how much compute power this takes. Four data streams. OR: Decimated or not: FFT the time sequence. Aggregate frequency bin energy in each band of interest. One data stream up to the end.. then there are 4. Select a temporal window of N samples with no decimation / then N/L with decimation. If decimation takes D operations per sample for the decimation rate of L then: With no decimation let's say the length of each filter is M. With decimation, let's allow that the length of the filter will be shorts and we'll just assume M/L is reasonable. That is, the temporal length of the filter remains the same and the frequency response remains the same in absolute terms. Let's say that the filters require K operations per sample, so KM or KM/L operations per window per filter without or with decimation. The aggregate number of operations for a window of data will be: 4KMN or 4K(M/L)(N/L) = 4KMN/L^2. The number of operations on a window is then either: 4KMN or ND + 4KMN/L^2 If you decide to FFT then the FFT will either be of length N or length N/L. Estimated order of operations: FFT without decimation: N/2log2(N) with decimation N/2L*log2(N/L) So, if N=1024 and L=8, then 512*log2(1024)=5120 OR 64*log2(128)=128 so the shorter one is about 40 times better. which suggests an improvement (if I did the math right) of around: (2/L)*ln(N)*ln(N/L) Either way, it appears that decimating the audio data is going to be a big help. I did all this in a hurry and don't vouch for the accuracy. It's the ideas that count. Fred
> > >jacobfenton wrote: > >> All the RF gets converted down to an IF by the AD9874, 3MHz. This is >> sampled at 24MHz clock rate, then decimated down, to a suitable data
rate
>> which comes to the DSP. In our RF system, there is a requiremnt that
the IF
>> bandwidth filter have 180kHz at 3dB and 225kHz at 60dB down (those
values
>> are estimates, the proper values I left at work also we are working on >> seeing if we can reduce this bandwidth). In the RF system the final
SAW
>> filter does not filter the IF(prior to entering the AD9874) to that
degree,
>> so we determined that we could meet that IF filter requirement with
the
>> AD9874 inherent filtering from the decimation filtering it does. In
the
>> AD9874 datasheet they show decimation filter curves for different >> decimation values you program it too. To get the high bandwidth we
need,
>> the decimation must be set to a minimum, thus making the data rate to
the
>> DSP fast, currently the 250kHz rate at which it sends me IQ data. >> >> That IF bandwidth requirements accounts for many things, doppler
effect,
>> transmitter clock drift, our reciever clock drift, etc. Maybe to look
at
>> it, the IF is the carrier, but after we have mixed it down to a
suitable
>> frequency. The FM coming in is at 425MHz, we then mix it down to 71MHz
and
>> then the AD9874 mixes it down to 3MHz. >> >> The tones themselves have a seperate bandwidth requirment, of +/-4%
max.
>> of the tone value and +/-1% min. >> >> After thinking about this all weekend, I think I have come to the >> following conclusions so far: >> >> To meet the IF (or carrier) bandwidth requirement I must accept a fast >> data rate from the AD9874 and then run the FM demodulation algorthim
on
>> that data. > >If your goal is just detecting the tones, you don't have to accept fast >data rate. You can decimate in place. > > >> Once I get the Audio from the demodulation algorithm I can filter and >> decimate since I don't need as much bandwidth to detect the tones in
the
>> Audio data. > >Yes. > >> Please understand, I am really learning on the fly here with this
project,
>> this is why I am asking all these questions to you guys who are
experts,
>> and I do really appreciate your responses. > >How much is the real part of appreciation? > > >Vladimir Vassilevsky >DSP and Mixed Signal Design Consultant >http://www.abvolt.com >
The AD9874 uses a bandpass sigma-delta ADC centered at 3Mhz. So my IF (carrier) must be able to drift according to the IF bandwidth requirement I stated previously. Setting the decimation in the AD9874 sets the bandwidth of what my IF can drift from the center frequency of the ADC and still recover tones. If I again decimate in the dsp prior to FM demodulation, aren't I just reducing the bandwidth my IF can drift? Otherwise, if I didn't need to let my IF drift, I could just make the AD874 decimate even more, solving my speed problems.

jacobfenton wrote:
>>
> The AD9874 uses a bandpass sigma-delta ADC centered at 3Mhz. So my IF > (carrier) must be able to drift according to the IF bandwidth requirement I > stated previously. Setting the decimation in the AD9874 sets the bandwidth > of what my IF can drift from the center frequency of the ADC and still > recover tones. If I again decimate in the dsp prior to FM demodulation, > aren't I just reducing the bandwidth my IF can drift? Otherwise, if I > didn't need to let my IF drift, I could just make the AD874 decimate even > more, solving my speed problems.
I am sorry but this is where free ride comes to the end. I would be glad to help you, however this is going to be business. If you are interested, the contact is at my web site. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
> >I am sorry but this is where free ride comes to the end. I would be glad
>to help you, however this is going to be business. If you are >interested, the contact is at my web site. > >Vladimir Vassilevsky >DSP and Mixed Signal Design Consultant >http://www.abvolt.com >
After reading some more, IQ is baseband! Now I am understanding things. I still need to look into our IF requirement, since it can drift quite alot it seems. And how that effects things.
jacobfenton wrote:
>> I am sorry but this is where free ride comes to the end. I would be glad > >> to help you, however this is going to be business. If you are >> interested, the contact is at my web site. >> >> Vladimir Vassilevsky >> DSP and Mixed Signal Design Consultant >> http://www.abvolt.com >> > > After reading some more, IQ is baseband! Now I am understanding things. I > still need to look into our IF requirement, since it can drift quite alot > it seems. And how that effects things.
Jacob, Yes, IQ is baseband - well .. depending on the sampling frequency and what you want to call "baseband" I suppose. But, for conversation, good enough. Still, I'm a little confused - nothing new in that! :-) If the clock is stable then the IF center frequency is stable is it not? Or, is it tracking the center frequency with the PLL? If the clock is stable then the IF center frequency is stable and you need an IF bandwidth to accommodate Doppler,etc. If the clock is tracking/locked then the center frequency is tracking but the IF bandwidth and the information coming out should be reasonably stable as it's all relative to the carrier, or should be. If you're tracking then I should think that Doppler, etc. would be accounted for and you'd not need to keep the bandwidth wide enough to account for it. This is pretty typical of narrowband space communication systems for example - it keeps the SNR up. Is the latter your situation? I believe in either case the post-demod tones should be stable as you have: - acceptable SNR - are looking at rate of phase changes. Once you've demodulated then the IF bandwidth is immaterial. Only the modulation bandwidth matters (i.e. the band within which the tones exist). Here's how I'm understanding this: You "detect" the signal. You downsample in the IF bandwidth to get baseband. - If the clock is not tracking th carrier then the IF bandwidth needs to take into consideration drift, Doppler and even perhaps the modulation bandwidth. - If the clock is tracking the carrier then the IF bandwidth can be narrower than if you're not. - In no case can the IF bandwidth be narrower than what is caused by the modulation and you may need a bit of bandwidth to accomodate carrier dynamics. This ignores what it takes to "lock" - which may take more bandwidth. All system considerations. Then you detect the modulation signal. At this point it's only the modulation signal bandwidth that matters. And that's why we keep talking about decimation / sample rate reduction because the IF bandwidth and the modulation bandwidth are two different things entirely. Fred
>Yes, IQ is baseband - well .. depending on the sampling frequency and >what you want to call "baseband" I suppose. But, for conversation, good
>enough. > >Still, I'm a little confused - nothing new in that! :-) > >If the clock is stable then the IF center frequency is stable is it not? >Or, is it tracking the center frequency with the PLL? > >If the clock is stable then the IF center frequency is stable and you >need an IF bandwidth to accommodate Doppler,etc. > >If the clock is tracking/locked then the center frequency is tracking >but the IF bandwidth and the information coming out should be reasonably
>stable as it's all relative to the carrier, or should be. >If you're tracking then I should think that Doppler, etc. would be >accounted for and you'd not need to keep the bandwidth wide enough to >account for it. This is pretty typical of narrowband space >communication systems for example - it keeps the SNR up. > >Is the latter your situation? > >I believe in either case the post-demod tones should be stable as you
have:
>- acceptable SNR >- are looking at rate of phase changes. > >Once you've demodulated then the IF bandwidth is immaterial. Only the >modulation bandwidth matters (i.e. the band within which the tones
exist).
> >Here's how I'm understanding this: >You "detect" the signal. >You downsample in the IF bandwidth to get baseband. >- If the clock is not tracking th carrier then the IF bandwidth needs to
>take into consideration drift, Doppler and even perhaps the modulation >bandwidth. >- If the clock is tracking the carrier then the IF bandwidth can be >narrower than if you're not. >- In no case can the IF bandwidth be narrower than what is caused by the
>modulation and you may need a bit of bandwidth to accomodate carrier >dynamics. This ignores what it takes to "lock" - which may take more >bandwidth. All system considerations. > >Then you detect the modulation signal. >At this point it's only the modulation signal bandwidth that matters. >And that's why we keep talking about decimation / sample rate reduction >because the IF bandwidth and the modulation bandwidth are two different >things entirely. > >Fred > >
You are correct, currently the system does not lock to the carrier or have any compensation for carrier drift, or local clock drift. This is all accounted for in the IF bandwidth requirement. Our current set up is to have the IF sampling bandwidth big enough to count for all the drift, so we can still recover the information after demodulation. So once demodulated I can decimate for sure, since after demodulation I only care about the information bandwidth, not the IF bandwidth.