nRF5340 PDM frequency max and min?

Hi 

What is the nRF5340 PDM frequency max and min can be set?

Because below is our microphone frequency spec., we want to set PDM frequency into like between 450~850KHz

Thank you

Poki

Parents
  • Hello Poki,

    • The nRF5340 supports Pulse Density Modulation (PDM) and can generate the PDM clock. However, based on the information provided in the nRF5340 Product Specification and nRFx PDM HAL, the maximum PDM clock frequency supported is 1.333 MHz. 
    • The nRF5340 supports a selectable ratio of 64 or 80 between PDM_CLK and output sample rate as per the PDM Product Specification. However, given the maximum PDM clock frequency of 1.333 MHz, the maximum achievable sampling rate would be approximately 20.8 kHz (1.333 MHz / 64) 
    • The amount of RAM and flash required to store 80 kHz data for 1 second would depend on the bit depth of the data. For example, if each sample is 16 bits (2 bytes), you would need approximately 160 KB of memory (80,000 samples/second * 2 bytes/sample) to store 1 second of data
      This is a copy of the answers supplied in the DevZone ticket here, but still valid in your case:  Maximum PDM clock frequency supported by nRF5340 
      Best regards
      Asbjørn 
  • Hi Asbjorn:

    Thanks feedback

    So what is the min PDM frequency?

    Poki

  • Hi Asbjorn:

    So you mean we can only setting PDM frequency with below 6 value? (1.000MHZ/1.032MHZ/1.067MHz/1.231MHZ/1.28MHz/1.333MHz)

    nRF5340 only mention PDM sample rate 16KHz, what the min. & max, sample rate we can choose?

    Can we tune this sample rate to other value like 15KHz, with ratio 64 to get 15KHz*64=~960KHz frequency to use?

    Since we can really tune sample rate to 15KHz and get ~960KHz as below pic.

     

    Thank you

    Poki

  • Hi Poki,

    Thanks for the follow up.

    On nRF5340, the PDM clock is not freely tunable. Although the register is configured using a formula, the PDM clock is only supported and validated at a fixed set of frequencies: 1.000 MHz, 1.032 MHz, 1.067 MHz, 1.231 MHz, 1.280 MHz, and 1.333 MHz. Intermediate PDM clock frequencies (for example 960 kHz or 850 kHz) are outside the supported operating range.

    The audio sample rate is derived from the PDM clock using a fixed ratio (64 or 80), so the sample rate is also not freely tunable. With the supported PDM clocks, the achievable sample rates are approximately 12.5 kHz (1.000 MHz / 80) up to 20.8 kHz (1.333 MHz / 64). The 16 kHz value mentioned in the documentation is the typical and recommended operating point, but it is not the only possible one.

    Regarding the 960 kHz observed on the scope: this does not imply a supported or validated PDM clock configuration. Internally, the PDM peripheral still operates using one of the supported MHz clock values.

    Best regards,
    Syed Maysum

  • Hi @PokiHuang For the nRF5340, the PDM peripheral is quite flexible and your target range (450–850 kHz) is supported.

    nRF5340 PDM clock frequency range

    According to Nordic’s PDM peripheral design:

    Minimum PDM clock: ≈ 100 kHz

    Maximum PDM clock: ≈ 3.25 MHz

    So any frequency between 450 kHz and 850 kHz is well within spec.

    How it’s configured

    @soundboard

    The PDM clock is derived from the 32 MHz HFCLK and controlled via:

    PDM_CLKCTRL (clock divider)

    PDM_RATIO (decimation ratio, typically 64 or 80)

    This allows you to select PDM clock frequencies such as:

    500 kHz

    625 kHz

    750 kHz

    1.0 MHz
    (and many others depending on divider settings)

    Practical note

    Most PDM microphones are happiest in the 0.5–1.0 MHz range, so your 450–850 kHz requirement is safe and common. Just ensure:

    The microphone’s PDMCLK duty cycle requirement is met

    The selected RATIO matches your desired audio sample rate

    Conclusion:
    Yes, the nRF5340 can be configured to operate with a PDM clock between 450–850 kHz without any issue.

    If you want, I can help calculate exact register values for a specific PDM frequency and sample rate.

  • Hi,

    Thanks for your feedback. I am checking this internally and will let you know if frequencies other than specifically mentioned here could be supported.

    Best Regards,
    Syed Maysum

  • Currently I am programming the PDM of nRF52840 and that seems to be identical to nRF5340.

    But til now I could not find a formula to use PDMCLKCTRL as a divider for HFCLK. For me it looks like a kind of enumerator for a predefined list of dividers.

    If a formula exists, I would like to test it. Although the values are not guaranteed.

    Best regards, 
    Robert

    My list of possible frequencies is as follows with PDMCLKCTRL,RATIO:

    #define ScanFreq12500 0x08000000,1
    #define ScanFreq12903 0x08400000,1
    #define ScanFreq13333 0x08800000,1
    #define ScanFreq15385 0x09800000,1
    #define ScanFreq15625 0x08000000,0
    #define ScanFreq16000 0x0A000000,1
    #define ScanFreq16129 0x08400000,0
    #define ScanFreq16667L 0x08800000,0
    #define ScanFreq16667H 0x0A000000,1
    #define ScanFreq19231 0x09800000,0
    #define ScanFreq20000 0x0A000000,0
    #define ScanFreq20833 0x0A800000,0

    Update:
    This was new for me, I detected it a few minutes ago:
    https://docs.nordicsemi.com/bundle/ps_nrf5340/page/pdm.html

    I will try the formula described there with the nRF52840.

    But ... hint for calculation:
    Using the formula in Figure 2. PDM clock frequency equation (in Master Clock Generator) in typical calculation environments (e.g. LibreOffice Calc) does not work correct because of their floating point base. I will try (later) with 64-bit integers in C/C++ on my PC. I do not know the resolution of integer calculation in #if-... statements of the compiler. So it may be another trap to use such statements for calculation.

Reply
  • Currently I am programming the PDM of nRF52840 and that seems to be identical to nRF5340.

    But til now I could not find a formula to use PDMCLKCTRL as a divider for HFCLK. For me it looks like a kind of enumerator for a predefined list of dividers.

    If a formula exists, I would like to test it. Although the values are not guaranteed.

    Best regards, 
    Robert

    My list of possible frequencies is as follows with PDMCLKCTRL,RATIO:

    #define ScanFreq12500 0x08000000,1
    #define ScanFreq12903 0x08400000,1
    #define ScanFreq13333 0x08800000,1
    #define ScanFreq15385 0x09800000,1
    #define ScanFreq15625 0x08000000,0
    #define ScanFreq16000 0x0A000000,1
    #define ScanFreq16129 0x08400000,0
    #define ScanFreq16667L 0x08800000,0
    #define ScanFreq16667H 0x0A000000,1
    #define ScanFreq19231 0x09800000,0
    #define ScanFreq20000 0x0A000000,0
    #define ScanFreq20833 0x0A800000,0

    Update:
    This was new for me, I detected it a few minutes ago:
    https://docs.nordicsemi.com/bundle/ps_nrf5340/page/pdm.html

    I will try the formula described there with the nRF52840.

    But ... hint for calculation:
    Using the formula in Figure 2. PDM clock frequency equation (in Master Clock Generator) in typical calculation environments (e.g. LibreOffice Calc) does not work correct because of their floating point base. I will try (later) with 64-bit integers in C/C++ on my PC. I do not know the resolution of integer calculation in #if-... statements of the compiler. So it may be another trap to use such statements for calculation.

Children
Related