understanding PDM gain

Dear Nordic,

In our application, we use nRF52840 (nRF5 SDK) and a PDM microphone to listen to the very quiet signals.

We would like to understand how exactly gain works. I could not find more information than this:
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fpdm.html

Is the gain just purely digital multiplication/division and can be applied after processing producing the same result?
Or can increased gain improve the SNR for a quiet signal? 

Best regards,
Marcin

  • Hello,

    ''The gain set in the register will alter the numerical value for each sampling.'' This is one of the mechanisms inside the PDM module. 

    Bits from the left PDM microphone are sampled on the falling edge of clock and right bits are sample on the rising edge of clk, resulting in two bitstreams. Each bitstream is fed into a digital filter which converts the PDM stream into 16-bit PCM samples, and filters and down-samples them to reach the appropriate sample rate.

    The EDGE field in the MODE register allows swapping Left and Right, so that Left will be sampled on rising edge, and right on falling.

    Depending on the mode chosen in the OPERATION field in the MODE register, memory either contains alternating left and right 16-bit samples (Stereo), or only left 16-bit samples (Mono).

    In order to convert the incoming data stream into PCM audio samples, a decimation filter is included in the PDM interface module. input of the filter is those serial streams from left and right channel. There is a term called decimation factor. This is defined as M. if the value of M is 80, then after computing the first sample, PDM to PCM block will compute the 80th sample. 

    if you want a 16 kHz PCM rate, you should choose a PDM clock rate of 1.28 MHz, and a decimation factor of 80.

    You can watch this video (1) STM32 Microphone Audio Acquisition: Part 3, PDM to PCM Conversion - YouTube to have in general concept of PDM to PCM conversion. 

  • Hello Sultana,


    Thank you for the long response, unfortunately, it does not tell me about the mathematical operations happening there.

    Could you please answer my original question?

    What do you mean by alter in mathematical termsIs it multiplication for a gain greater than zero?

    Could you also elaborate a bit more on your initial statement?

    You can not increase SNR ratio with gain.
  • Hello,

    ''The gain set in the register will alter the numerical value for each sampling.'' -It's a straightforward gain stage that amplifies or attenuates the signal, which is a multiplication of the gain value with each individual sample which then results in larger or smaller represented swing.

    The filter stage of each channel is followed by a digital volume control, to attenuate or amplify the output samples in a range of -20 dB to +20 dB around the  default (reset) setting, defined by GPDM,default. The gain is controlled by the GAINL and GAINR registers.

    As an example, if the goal is to achieve 2500 RMS output samples (16 bit) with a 1 kHz 90 dBA signal into a -26 dBFS sensitivity PDM microphone, the user will have to sum the PDM module's default gain ( GPDM,default ) and the gain introduced by the microphone and acoustic path of his implementation (an attenuation would translate into a negative gain), and adjust GAINL and GAINR by this amount. Assuming that only the PDM module influences the gain,  GAINL and GAINR must be set to -GPDM,default dB to achieve the requirement.

    With GPDM,default=3.2 dB, and as GAINL and GAINR are expressed in 0.5 dB steps, the closest value to program would be 3.0 dB, which can be calculated as:

    GAINL = GAINR = (DefaultGain - (2 * 3))

Related