DSPRelated.com
Forums

Resampling one signal to match another

Started by Randy Yates July 19, 2013
I just wanted to say to everyone that's responded, thank you! I have
read all your posts, even though I have only responded to a few, and I
appreciate all of them.

--Randy

Randy Yates <yates@digitalsignallabs.com> writes:

> I have two digital signals, x1[n] at approximately 370 samples/sec, and > x2[n] at approximately 400 samples/sec. > > How can I resample x1[n] so that it matches x2[n] without knowing the > precise sample rate of either?
-- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Randy Yates <yates@digitalsignallabs.com> wrote:

(snip)

> No. They are from an LSM330 chip - one signal is the > acceleration at ~400 Hz, the other is the gyro data at > ~370 Hz.
Interesting chip. The CAP input (C1) looks suspiciously like a clock generating capacitor, but the data sheet doesn't say anything about it. Seems to not say much at all about the clocks. I don't think you can build an on-chip (no external capacitor) oscillator down to 400Hz, but for low power reasons you want it as low as possible. LCM(380,400) is 7600Hz if that helps. I suppose it could be an in-package off chip capacitor. -- glen
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:

> Randy Yates <yates@digitalsignallabs.com> wrote: > > (snip) > >> No. They are from an LSM330 chip - one signal is the >> acceleration at ~400 Hz, the other is the gyro data at >> ~370 Hz. > > Interesting chip. > > The CAP input (C1) looks suspiciously like a clock generating > capacitor, but the data sheet doesn't say anything about it. > > Seems to not say much at all about the clocks. > > I don't think you can build an on-chip (no external capacitor) > oscillator down to 400Hz, but for low power reasons you want it > as low as possible. LCM(380,400) is 7600Hz if that helps. > > I suppose it could be an in-package off chip capacitor.
Yeah, that's very possible. In fact this chip looks in several other ways as if it is really a module with two independent chips glued on; e.g., there are two separate I2C addresses, separate register sets, and separate interrupt outputs. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Eric Jacobsen <eric.jacobsen@ieee.org> wrote:
> On Fri, 19 Jul 2013 15:39:00 -0400, Randy Yates
(snip)
>>>>> No. They are from an LSM330 chip - one signal is the >>>>> acceleration at ~400 Hz, the other is the gyro data at >>>>> ~370 Hz.
(snip)
> Even if you know the ratio, if there is one, if you want to assure > that two samples go with the same time instant you still need to know > the relative phases of the two clocks at each desired sample instant.
Also, there are FIFOs and serial output streams, so it might not be so easy to figure it out.
> This can be done in real time if the samples from each are > available and, at a minimum, the arrival time of the clock edges.
Seems to me that you have to figure it out on power-up and then remember it after that. If you swing it on a pendulum, that shouls supply an appropriate known phase between acceleration and rotation. Supply a string, and ask the user to swing it around a little at each power-on. -- glen
On Fri, 19 Jul 2013 17:49:18 -0400, Randy Yates wrote:

> I just wanted to say to everyone that's responded, thank you! I have > read all your posts, even though I have only responded to a few, and I > appreciate all of them. > > --Randy
You don't think that's going to stop us, do you? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On 7/19/13 3:10 PM, glen herrmannsfeldt wrote:
> Randy Yates<yates@digitalsignallabs.com> wrote: > > (snip) > >> No. They are from an LSM330 chip - one signal is the >> acceleration at ~400 Hz, the other is the gyro data at >> ~370 Hz. > > Interesting chip. > > The CAP input (C1) looks suspiciously like a clock generating > capacitor, but the data sheet doesn't say anything about it. > > Seems to not say much at all about the clocks. > > I don't think you can build an on-chip (no external capacitor) > oscillator down to 400Hz, but for low power reasons you want it > as low as possible. LCM(380,400) is 7600Hz if that helps.
does it count if you have an on-chip oscillator (with an on-chip cap) running at some high frequency (perhaps some multiple of 7600 Hz) and you divide the output frequency down with the old standard logic? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Tim Wescott <tim@seemywebsite.really> writes:

> On Fri, 19 Jul 2013 17:49:18 -0400, Randy Yates wrote: > >> I just wanted to say to everyone that's responded, thank you! I have >> read all your posts, even though I have only responded to a few, and I >> appreciate all of them. >> >> --Randy > > You don't think that's going to stop us, do you?
I hope not! :) -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
robert bristow-johnson <rbj@audioimagination.com> wrote:

(snip, I wrote)

>> I don't think you can build an on-chip (no external capacitor) >> oscillator down to 400Hz, but for low power reasons you want it >> as low as possible. LCM(380,400) is 7600Hz if that helps.
> does it count if you have an on-chip oscillator (with an on-chip cap) > running at some high frequency (perhaps some multiple of 7600 Hz) and > you divide the output frequency down with the old standard logic?
No, completely different. In this case, that is a reason why it might have a higher frequency divided down. Also, often the power used is related to the frequency, and so low power requires low frequency. (Popular use is for handheld devices, such as cellphones.) Watches usually use a 32768Hz crystal, as the power needed is much lower than for higher frequencies. Maybe some trick with an op-amp and small capacitor to make it look larger. -- glen
On Fri, 19 Jul 2013 16:38:28 -0700, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>On 7/19/13 3:10 PM, glen herrmannsfeldt wrote: >> Randy Yates<yates@digitalsignallabs.com> wrote: >> >> (snip) >> >>> No. They are from an LSM330 chip - one signal is the >>> acceleration at ~400 Hz, the other is the gyro data at >>> ~370 Hz. >> >> Interesting chip. >> >> The CAP input (C1) looks suspiciously like a clock generating >> capacitor, but the data sheet doesn't say anything about it. >> >> Seems to not say much at all about the clocks. >> >> I don't think you can build an on-chip (no external capacitor) >> oscillator down to 400Hz, but for low power reasons you want it >> as low as possible. LCM(380,400) is 7600Hz if that helps. > >does it count if you have an on-chip oscillator (with an on-chip cap) >running at some high frequency (perhaps some multiple of 7600 Hz) and >you divide the output frequency down with the old standard logic?
They're implemented that way very often. Web search Integer-N and Fractional-N Synthesizer.
> >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > >
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On 7/19/13 5:51 PM, glen herrmannsfeldt wrote:
> robert bristow-johnson<rbj@audioimagination.com> wrote: > > (snip, I wrote) > >>> I don't think you can build an on-chip (no external capacitor) >>> oscillator down to 400Hz, but for low power reasons you want it >>> as low as possible. LCM(380,400) is 7600Hz if that helps. > >> does it count if you have an on-chip oscillator (with an on-chip cap) >> running at some high frequency (perhaps some multiple of 7600 Hz) and >> you divide the output frequency down with the old standard logic? > > No, completely different. > > In this case, that is a reason why it might have a higher frequency > divided down. Also, often the power used is related to the frequency, > and so low power requires low frequency.
power is also related to the number of transistors or gates hooked up to it. so you could have a small portion of the chip driven by a high-frequency oscillator, divide the sucker down, and have the rest of the chip driven by the low-frequency clock derived from the original high-frequency clock.
> > Watches usually use a 32768Hz crystal, as the power needed is much > lower than for higher frequencies.
how did they arrive at that value? :-) also 32 kHz sounds like a pretty big xtal. i woulda thunked that the electronics in a watch might be running at a higher clock, but i surely don't know first hand. i remember in the olden daze that 3.579545 MHz were the cheap xtals to run your microprocessors (like the venerable MC6809) on. can't imagine how they came up with that frequency.
> Maybe some trick with an op-amp and small capacitor to make it > look larger.
still can't see why they can't just divide a high frequency down with a very few gates and let all the other gates run on the slow clock. but then i hadn't done anything with hardware since 1991. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."