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

PDM code implementation and testing

I have to connect a MIC  working on PDM to nrf52 DK Board.For that, I have written the above code.  But when I am testing I am not able to get the clock pulses at the defined pin. Also do not know at which Freq it is working?

And when I read the pdm documentation it says I need to change the PSEL.CLK register value? Then how should I do it and with what value? same for PSEL.DIN register. I am confused a lot. Please suggest me the solution to all my doubts.I have checked the clk pin on Oscilloscope, the clock is not being generated.In order to generate clk at pin number 22 of nrf52 DK board should I define pin clk  as #define CONFIG_IO_PDM_CLK 0x22 or 0x16 (hex value of 22 )instead o rtf 0x22?

Parents
  • The PDM driver will call nrf_pdm_psel_connect who'll set the PSEL.CLK and PSEL.DIN. I suggest you read the implementation of nrfx_pdm_init and see how the driver and HAL configures the PDM registers. This will give you valuable insight into how our drivers and HALs work in relation to the peripherals HW documentation.

    "should I define pin clk  as #define CONFIG_IO_PDM_CLK 0x22 or 0x16 (hex value of 22 )instead o rtf 0x22?"
    pin numbers are decimal, so either 22 or 0x16. 

  • Ok. But even though I am doing #define PDM_CONFIG_CLOCK_FREQ 134217728 which is 1MHz, Iam not getting the clock signal at pin 22. For this what should I do?

Reply
  • Ok. But even though I am doing #define PDM_CONFIG_CLOCK_FREQ 134217728 which is 1MHz, Iam not getting the clock signal at pin 22. For this what should I do?

Children