On Apr 6, 10:02=A0pm, Tim Wescott <t...@seemywebsite.com> wrote:
> On 04/05/2011 11:27 PM, Muhammed Shafi wrote:
>
> > Hi All,
>
> > =A0 First of all let me thank you all for your valuable solutions. If I
> > go for Upsampling( Interpolation) i will have to fit some data based
> > on the previous data . Am i right?
>
> Yes, kind of. =A0Strictly speaking, interpolation means that you're takin=
g
> data both before and after the point that you're interpolating, which
> means that you have to allow some delay into your resampling process.
> Taking data that is strictly before the point you're generating is
> extrapolation (i.e. prediction), and is much more subject to corruption
> by noise.
>
> > =A0 Since the ADC is sampling some valuable medical diagnostic data(ECG=
),
> > i guess its not a good practise to do upsampling.
>
> Maybe. =A0If it's so dang valuable, why can't you just sample the ADC at
> the right frequency?
>
> I wouldn't expect ECG data to have much frequency content above a few
> hundred Hz. =A0If this is so, then you should be able to resample it
> fairly cleanly.
>
> Finally -- what are you going to _do_ with it at your 16kHz? =A0If it's
> some analysis, then perhaps that analysis will work fine after
> resampling, even if the result wouldn't look perfect to a cardiologist.
>
> You should find out what the analysis is, and whether it will tolerate
> resampled data. =A0You should also find out what the characteristics of
> the signal you're playing with -- if it's already way oversampled, then
> doing a bit of interpolation on it will probably not hurt at all.
>
> > =A0 Is there anyway to do with just downsampling or do I need to sample
> > at even higher frequencies for downsampling to be applied?
>
> Yes. =A0In fact, you've already been told -- sample rate conversion, whic=
h
> uses polyphase filtering. =A0There's not need to actually upsample then
> downsample -- polyphase filtering gives you the result of that
> upsample/downsample combination, without forcing you to actually do all
> the work.
>
> > Another option is to use 200 Khz CNV frequency and do the sampling for
> > just 192 KHz(192k samples) and for the rest 8 Khz send some junk
> > control word to the ADC in the TX_interrupt handler. Once it's
> > elapsed(8k samples), again come back to the previous control words. Is
> > this feasible?
>
> If you're planning on doing what I think you are, it would mess up the
> signal worse than sample rate conversion.
>
> > Can we keep some kind of count in the interrupt
> > handler(ISR) that lets us know that 192k and 8k samples have been
> > sampled?
>
> > My CNV is 200 Khz and the SCLK is 8 Mhz.
>
> --
>
> Tim Wescott
> Wescott Design Serviceshttp://www.wescottdesign.com
>
> Do you need to implement control loops in software?
> "Applied Control Theory for Embedded Systems" was written for you.
> See details athttp://www.wescottdesign.com/actfes/actfes.html
Thanks a lot for the support that i have got in this forum. It was
really helpful and a good learning experience for me.
I have decided to sample only 10 channels of ADC since the Blackfin
can exactly generate the CNV pulse of 160 kHz so that i can get the
exact 16kHz sampling frequency per channel.
@Tim Wescott : Yes, I will do the analysis as you have told. I am just
a beginner so , i dint feel that i had to go deep into that part
mostly because i thought i won't understand those things.
Regards
Shafi
Reply by Tim Wescott●April 6, 20112011-04-06
On 04/05/2011 11:27 PM, Muhammed Shafi wrote:
> Hi All,
>
> First of all let me thank you all for your valuable solutions. If I
> go for Upsampling( Interpolation) i will have to fit some data based
> on the previous data . Am i right?
Yes, kind of. Strictly speaking, interpolation means that you're taking
data both before and after the point that you're interpolating, which
means that you have to allow some delay into your resampling process.
Taking data that is strictly before the point you're generating is
extrapolation (i.e. prediction), and is much more subject to corruption
by noise.
> Since the ADC is sampling some valuable medical diagnostic data(ECG),
> i guess its not a good practise to do upsampling.
Maybe. If it's so dang valuable, why can't you just sample the ADC at
the right frequency?
I wouldn't expect ECG data to have much frequency content above a few
hundred Hz. If this is so, then you should be able to resample it
fairly cleanly.
Finally -- what are you going to _do_ with it at your 16kHz? If it's
some analysis, then perhaps that analysis will work fine after
resampling, even if the result wouldn't look perfect to a cardiologist.
You should find out what the analysis is, and whether it will tolerate
resampled data. You should also find out what the characteristics of
the signal you're playing with -- if it's already way oversampled, then
doing a bit of interpolation on it will probably not hurt at all.
> Is there anyway to do with just downsampling or do I need to sample
> at even higher frequencies for downsampling to be applied?
Yes. In fact, you've already been told -- sample rate conversion, which
uses polyphase filtering. There's not need to actually upsample then
downsample -- polyphase filtering gives you the result of that
upsample/downsample combination, without forcing you to actually do all
the work.
> Another option is to use 200 Khz CNV frequency and do the sampling for
> just 192 KHz(192k samples) and for the rest 8 Khz send some junk
> control word to the ADC in the TX_interrupt handler. Once it's
> elapsed(8k samples), again come back to the previous control words. Is
> this feasible?
If you're planning on doing what I think you are, it would mess up the
signal worse than sample rate conversion.
> Can we keep some kind of count in the interrupt
> handler(ISR) that lets us know that 192k and 8k samples have been
> sampled?
>
> My CNV is 200 Khz and the SCLK is 8 Mhz.
> Another option is to use 200 Khz CNV frequency and do the sampling for
> just 192 KHz(192k samples) and for the rest 8 Khz send some junk
> control word to the ADC in the TX_interrupt handler. Once it's
> elapsed(8k samples), again come back to the previous control words. Is
> this feasible? Can we keep some kind of count in the interrupt
> handler(ISR) that lets us know that 192k and 8k samples have been
> sampled?
No. This will not work. If you sample at 200 kHz and then simply throw
away 8,000 consecutive samples periodically, that is not the same as 192
kHz sampling. At 200 kHz sampling, there are 5.00000 microseconds
between each sample point, and this gives certain frequency information.
192 kHz sampling has 5.20833... microseconds between each sample
point, which gives different frequency information.
The 24/25 sample rate conversion that has been repeatedly suggested will
recalculate 192,000 samples based on the original 200,000, but the
frequency information will be correctly preserved in the process.
If your analysis were purely time domain, then you could perhaps get by
with dropping 8,000 samples. But if your analysis were purely time
domain then you would not have a requirement for 16 kHz sampling.
Brian Willoughby
Sound Consulting
Reply by Alexander Sotnikov●April 6, 20112011-04-06
On 06.04.2011 10:27, Muhammed Shafi wrote:
> Hi All,
>
> First of all let me thank you all for your valuable solutions. If I
> go for Upsampling( Interpolation) i will have to fit some data based
> on the previous data . Am i right?
No, interpolation is not the same as prediction.
Read
http://en.wikipedia.org/wiki/Sample_rate_conversion
and follow the links and references therein.
The straightforward solution is the one that Tauno Voipio suggested -
interpolate by 24 and decimate by 25 (or make it in two steps
interpolate firstly by 6/5 and then by 4/5, which might be easier).
--
Alexander
Reply by Muhammed Shafi●April 6, 20112011-04-06
Hi All,
First of all let me thank you all for your valuable solutions. If I
go for Upsampling( Interpolation) i will have to fit some data based
on the previous data . Am i right?
Since the ADC is sampling some valuable medical diagnostic data(ECG),
i guess its not a good practise to do upsampling.
Is there anyway to do with just downsampling or do I need to sample
at even higher frequencies for downsampling to be applied?
Another option is to use 200 Khz CNV frequency and do the sampling for
just 192 KHz(192k samples) and for the rest 8 Khz send some junk
control word to the ADC in the TX_interrupt handler. Once it's
elapsed(8k samples), again come back to the previous control words. Is
this feasible? Can we keep some kind of count in the interrupt
handler(ISR) that lets us know that 192k and 8k samples have been
sampled?
My CNV is 200 Khz and the SCLK is 8 Mhz.
Regards
Shafi
Reply by Tauno Voipio●April 5, 20112011-04-05
On 5.4.11 4:31 , Jim Thomas wrote:
> On 04/05/2011 02:57 AM, Muhammed Shafi wrote:
>> I am a total newbie in signal processing. Is it possible to decimate a
>> signal from 16.6 Khz to 16 Khz? I have an ADC interfaced to a Blackfin
>> processor. Blackfin processor generates the CNV frequency for the ADC
>> at 200 Khz. I need to sample data from 12 channels of the ADC, so it
>> turns out to be 200/12 = 16.6 Khz. But in my program, the later stages
>> require data sampled at 16 Khz. I cannot change the CNV frequency to
>> 192 Khz in Blackfin side because of timing limitations.
>>
>> Is there any solution for this?
>>
>> Thanks a lot in advance
>> Shafi
>
> Yes, it is quite possible to resample your signals. Do a search on
> "multirate resampling". It will require a lot of filter coefficients,
> but it shouldn't take a whole lot of computation to run the filter.
>
> Basically, you'll need to upsample/interpolate by 80, and then
> downsample/decimate by 83.
The OP's 16.6 kHz is actually 16 2/3 kHz, so it suffices to upsample
by 24 and downsample by 25, visiting 400 ksamples/s.
If he's having tight on resources, it is best to forget the
sample rate conversion for 12 channels.
--
Tauno Voipio
tauno voipio (at) iki fi
Reply by Tim Wescott●April 5, 20112011-04-05
On 04/05/2011 06:31 AM, Jim Thomas wrote:
> On 04/05/2011 02:57 AM, Muhammed Shafi wrote:
>> I am a total newbie in signal processing. Is it possible to decimate a
>> signal from 16.6 Khz to 16 Khz? I have an ADC interfaced to a Blackfin
>> processor. Blackfin processor generates the CNV frequency for the ADC
>> at 200 Khz. I need to sample data from 12 channels of the ADC, so it
>> turns out to be 200/12 = 16.6 Khz. But in my program, the later stages
>> require data sampled at 16 Khz. I cannot change the CNV frequency to
>> 192 Khz in Blackfin side because of timing limitations.
>>
>> Is there any solution for this?
>>
>> Thanks a lot in advance
>> Shafi
>
> Yes, it is quite possible to resample your signals. Do a search on
> "multirate resampling". It will require a lot of filter coefficients,
> but it shouldn't take a whole lot of computation to run the filter.
"Sample rate converter" will also get you some hits, as will "Polyphase
Filtering".
Look for the "Secret Rabbit Code" site -- it's a well-regarded bit of
code for sample rate conversion with (if I recall correctly) an
open-source licensing option.
> Basically, you'll need to upsample/interpolate by 80, and then
> downsample/decimate by 83.
Mathematically, yes. You won't have to actually do this at run time.
--
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" was written for you.
See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by Jerry Avins●April 5, 20112011-04-05
Jim,
Muhammad needs to keep in mind that 16.6 is only an approximation. (16.7 is a better one.) The real number is 50/3. The ratio he needs is 24/25.
Jerry
--
Engineering is the art of making what you want from things you can get.
Reply by Jim Thomas●April 5, 20112011-04-05
On 04/05/2011 02:57 AM, Muhammed Shafi wrote:
> I am a total newbie in signal processing. Is it possible to decimate a
> signal from 16.6 Khz to 16 Khz? I have an ADC interfaced to a Blackfin
> processor. Blackfin processor generates the CNV frequency for the ADC
> at 200 Khz. I need to sample data from 12 channels of the ADC, so it
> turns out to be 200/12 = 16.6 Khz. But in my program, the later stages
> require data sampled at 16 Khz. I cannot change the CNV frequency to
> 192 Khz in Blackfin side because of timing limitations.
>
> Is there any solution for this?
>
> Thanks a lot in advance
> Shafi
Yes, it is quite possible to resample your signals. Do a search on
"multirate resampling". It will require a lot of filter coefficients,
but it shouldn't take a whole lot of computation to run the filter.
Basically, you'll need to upsample/interpolate by 80, and then
downsample/decimate by 83.
--
Jim Thomas Principal Applications Engineer Bittware, Inc
jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536
"And" is a word that should never be used at the beginning of a sentence.
Reply by Brian Willoughby●April 5, 20112011-04-05
On 2011/04/04 23:57, Muhammed Shafi wrote:
> I am a total newbie in signal processing. Is it possible to decimate a
> signal from 16.6 Khz to 16 Khz? I have an ADC interfaced to a Blackfin
> processor. Blackfin processor generates the CNV frequency for the ADC
> at 200 Khz. I need to sample data from 12 channels of the ADC, so it
> turns out to be 200/12 = 16.6 Khz. But in my program, the later stages
> require data sampled at 16 Khz. I cannot change the CNV frequency to
> 192 Khz in Blackfin side because of timing limitations.
>
> Is there any solution for this?
If you have the option of designing the hardware platform, you could
build a 192 kHz clock into your circuit and run the ADC from this
external clock.
Brian Willoughby
Sound Consulting