This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Single PDM microphone at higher PCM sampling rate

Hello,

we need to feed mono audio data into the nRF52 and we are now evaluating the possibility to use PDM. The nRF52 seems to have a useful PDM interface, and even though an example does not seem to exist in the SDK [what a pity!], there is a PDM driver. There also seem to be many PDM microphones available, like from Knowles or InvenSense.

All of these mics are sensitive to 20+ KHz, which we would like to make use of. We planned to have 48 KHz sampling rate and I wondered how and where I could set that in the PDM driver.

After some search, on the PDM Interface site of the Nordic Infocenter I found that the PDM features "16 kHz output sample rate, 16-bit samples". So does it mean that the sample rate cannot be changed? Is this a driver issue or is this a limitation of the PDM hardware used? If the latter is able to handle stereo signal at 16 KHz, I would at least expect it to handle mono signal at 32 KHz without overhead.

Can you please comment on that or propose a hack to change the PCM sampling rate? Thank you!

NewtoM

  • I'm putting together a project right now with a single PDM mic and the nRF52832 and found your post super helpful.

    I'm struggling a bit because there was no example provided by the SDK, would you be willing to share your source code?

  • Hi Ole,

    I've seen a few more PDM frequencies added to the nRF5 SDK v16.0.0, which is good. Back in the day I used an oscilloscope to measure PDM clock frequencies and document the register setting for the given divisor. I still wonder, though, what is the closed equation for the relation between the register value and the PDM clock speed (or clock divider)? Can you provide me that?

    Thanks,
    Tamas

  • 32000000 / (DIV * 64) = Sampling Rate

    To get the PDM frequency:

    32000000 / DIV

  • Hi, I'm Song

    Now I'm using knowles microphone to analyze voice.

    I don't know how to access PCM data.( easyDMA )

    So, It would be great if you could share the code...

    thank u.

    - Song

  • The question is, how the register settings relate to the possible DIVs. E.g.


    #define DIGITAL_AUDIO_SAMPLING_RATE_15625 (0x08000000UL)    // (32 MHz / 32)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_16129 (0x08400000UL)    // (32 MHz / 31)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_16667 (0x08800000UL)    // (32 MHz / 30)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_20000 (0x0A000000UL)    // (32 MHz / 25)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_31250 (0x10000000UL)    // (32 MHz / 16)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_33333 (0x11000000UL)    // (32 MHz / 15)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_45455 (0x16000000UL)    // (32 MHz / 11)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_50000 (0x18000000UL)    // (32 MHz / 10)  / 64
    #define DIGITAL_AUDIO_SAMPLING_RATE_62500 (0x20000000UL)    // (32 MHz / 8)   / 64

    So, say, if I wanted 4000 Hz sampling rate (i.e. 256000 Hz PDM frequency), what would be the register value? 0x... ? And why?

    Thanks,
    Tamas

Related