DSPRelated.com
Forums

Integrate PDM to PCM?

Started by Tom Becker October 13, 2016
> Low-pass filter.
OK, I understand. I'll try that. Thanks. Tom
Tom Becker <gtbecker@rightime.com> writes:

>> Low-pass filter. > > OK, I understand. I'll try that. Thanks. > > Tom >
Tom, See Figure 5 on page 12 here: http://www.digitalsignallabs.com/presentation.pdf. This gives a picture of the noise spectrum of a noise-shaped signal. This occurs in both delta sigma ADCs and DACs. So if your lowpass filter cutoff frequency isn't low enough, you let more of the noise in, and the degradation is not linear with cutoff frequency. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On Fri, 14 Oct 2016 17:06:04 -0400, Randy Yates wrote:

> Tom Becker <gtbecker@rightime.com> writes: > >>> Low-pass filter. >> >> OK, I understand. I'll try that. Thanks. >> >> Tom >> >> > Tom, > > See Figure 5 on page 12 here: > > http://www.digitalsignallabs.com/presentation.pdf. > > This gives a picture of the noise spectrum of a noise-shaped signal. > This occurs in both delta sigma ADCs and DACs. > > So if your lowpass filter cutoff frequency isn't low enough, you let > more of the noise in, and the degradation is not linear with cutoff > frequency.
But without knowing the characteristics of the modulator, it's hard to know what the noise characteristics will be. The fact that the microphone is only specified out to 10kHz is highly indicative, though. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
Tim Wescott <seemywebsite@myfooter.really> writes:

> On Fri, 14 Oct 2016 17:06:04 -0400, Randy Yates wrote: > >> Tom Becker <gtbecker@rightime.com> writes: >> >>>> Low-pass filter. >>> >>> OK, I understand. I'll try that. Thanks. >>> >>> Tom >>> >>> >> Tom, >> >> See Figure 5 on page 12 here: >> >> http://www.digitalsignallabs.com/presentation.pdf. >> >> This gives a picture of the noise spectrum of a noise-shaped signal. >> This occurs in both delta sigma ADCs and DACs. >> >> So if your lowpass filter cutoff frequency isn't low enough, you let >> more of the noise in, and the degradation is not linear with cutoff >> frequency. > > But without knowing the characteristics of the modulator, it's hard to > know what the noise characteristics will be. > > The fact that the microphone is only specified out to 10kHz is highly > indicative, though.
Yup! -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
> ... the microphone is only specified out to 10kHz is highly indicative...
Knowles sent two pairs of samples, SPH0641LM4H-1 and SPH0641LU4H-1. I quoted the ...LM4H-1 in my original post mistakenly; I also noticed its characterization only to 10kHz. The ...LU4H-1, though, is characterized to 80kHz in "ultrasonic mode". http://www.knowles.com/eng/content/download/5990/105795/version/1/file/SPH0641LU4H-1.pdf Tom
Tim Wescott <seemywebsite@myfooter.really> writes:

> On Thu, 13 Oct 2016 21:20:10 -0700, Tom Becker wrote: > >>> ... set up an SPI port to clock at 4.8MHz [] then you have a look up >>> table: >>> 0 has 0 bits on, >>> 1 has 1 bit on, >>> 2 has 1 bit on, >>> 3 has 2 bits on, >>> etc. >>> The output of that table gets 4 subtracted from it... >> >> Ah. So eight bits (0-255) @4.8MHz becomes three bits (0-7) @600kHz, >> offset by -4 makes it bipolar? So now I have 3-bit PCM @600kHz? How do >> I get from there to 16-bit @192kHz? >> >> Tom > > Low-pass filter.
And resample. It's not a simple decimation either. You also will have an unwanted sync in the spectrum due to the disjointed 8-bit "integration." This sounds like a bad approach the more I think about it. I can't pull any rabbits out of a hat, either. I'm afraid Tom will need to suck it up and use something with more oomph. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On Fri, 14 Oct 2016 23:09:51 -0400, Randy Yates wrote:

> Tim Wescott <seemywebsite@myfooter.really> writes: > >> On Thu, 13 Oct 2016 21:20:10 -0700, Tom Becker wrote: >> >>>> ... set up an SPI port to clock at 4.8MHz [] then you have a look up >>>> table: >>>> 0 has 0 bits on, >>>> 1 has 1 bit on, >>>> 2 has 1 bit on, >>>> 3 has 2 bits on, >>>> etc. >>>> The output of that table gets 4 subtracted from it... >>> >>> Ah. So eight bits (0-255) @4.8MHz becomes three bits (0-7) @600kHz, >>> offset by -4 makes it bipolar? So now I have 3-bit PCM @600kHz? How >>> do I get from there to 16-bit @192kHz? >>> >>> Tom >> >> Low-pass filter. > > And resample. It's not a simple decimation either. > > You also will have an unwanted sync in the spectrum due to the > disjointed 8-bit "integration."
That kinda depends on the noise characteristics going into the integration (and I don't think it needs the quotes). One thing about an integrator-comb filter is that it nulls out the very frequencies that would alias down to DC, so it may not be that bad.
> > This sounds like a bad approach the more I think about it. I can't pull > any rabbits out of a hat, either. I'm afraid Tom will need to suck it up > and use something with more oomph.
Going into what my 1980's trained brain calls a "small FPGA" but which FPGA guys would call a "CPLD" should work. My gut feel is that you could get it shoehorned into an ATMega, but you'd be spending more effort with the shoehorn than with the basic problem. -- www.wescottdesign.com
On Fri, 14 Oct 2016 23:09:51 -0400, Randy Yates wrote:

> Tim Wescott <seemywebsite@myfooter.really> writes: > >> On Thu, 13 Oct 2016 21:20:10 -0700, Tom Becker wrote: >> >>>> ... set up an SPI port to clock at 4.8MHz [] then you have a look up >>>> table: >>>> 0 has 0 bits on, >>>> 1 has 1 bit on, >>>> 2 has 1 bit on, >>>> 3 has 2 bits on, >>>> etc. >>>> The output of that table gets 4 subtracted from it... >>> >>> Ah. So eight bits (0-255) @4.8MHz becomes three bits (0-7) @600kHz, >>> offset by -4 makes it bipolar? So now I have 3-bit PCM @600kHz? How >>> do I get from there to 16-bit @192kHz? >>> >>> Tom >> >> Low-pass filter. > > And resample. It's not a simple decimation either.
I don't know what the OP's needs or capabilities are, but he could either sample at 24*192kHz (4.608MHz -- might be fun finding a crystal), or if he could stand the odd frequency, decimate down to exactly 200kHz. He could always post-process on a PC. At some point in the dim past I postulated a polyphase IIR lowpass filter, where you iterate the filter at the input rate into the states, then sample the states with variable gains at the output rate. You'd essentially have a filter transfer function with an unvarying denominator, but with a numerator that changes depending on the phase relationship of the input and output sampling. It would be evil for a 2nd-order lowpass, and even eviler for higher orders. You'd need to use a modification of direct-form II filtering, with the actual cascade implementing the transfer function z^2 / (etc.), with the numerator coming from the gains off of the various delays. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com I'm looking for work -- see my website!
> ... he could [] sample at 24*192kHz...
Well, 25*192kHz = 4.8MHz exactly, perhaps not an accidental top-end clock spec for the mic. I fear to propose: can that be decimated by five twice?
> ... You'd need to use a modification of direct-form II filtering, > with the actual cascade implementing the transfer function z^2 / (etc.), > with the numerator coming from the gains off of the various delays.
Whew! Thanks for your time pondering, Tim. Tom
On Sat, 15 Oct 2016 15:29:39 -0700, Tom Becker wrote:

>> ... he could [] sample at 24*192kHz... > > Well, 25*192kHz = 4.8MHz exactly, perhaps not an accidental top-end > clock spec for the mic. > > I fear to propose: can that be decimated by five twice? > >> ... You'd need to use a modification of direct-form II filtering, >> with the actual cascade implementing the transfer function z^2 / >> (etc.), >> with the numerator coming from the gains off of the various delays. > > Whew! Thanks for your time pondering, Tim. > > Tom
You could decimate by five twice, but not with an SPI bus that takes in 8 bits at a time. Some will let you tailor the word width, however. Decimation by 25 just doesn't seem like you're going to get your noise down much, unless they have a fairly high-order delta-sigma modulator in there (you can shove more of the noise into the high-frequency region the higher the order of your modulator). If they DO use a high-order modulator, then that indicates that you want to use a fairly high-order filter, AND that my whole idea of reading things in by chunks may be fairly dumb after all. Does the microphone company give any direction on the filtering to do once you have the PDM stream in hand? -- www.wescottdesign.com