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 Reply Children
  • When in a debug session:
    View -> Registers ->Registers1 -> Groups -> Toggle TWIS0.

  • TWIS0 registers are not changing their default values I mean they remain in their  same state. I am attaching the register values below

    .Now to set the values what should I do?

  • The I suggest you single step through the init function to where the HAL actually writes to one of these registers, and see what happens with the registers when you single-step through the functions.

  • I was checking the wrong register group. So when I checked the PDM register group the values in the register were being updated. I have attached the images of register values. But still,

    the clk is not being generated when I am checking on CRO. What could be the reason?

  • Maybe you need to set up the sample buffer first, nrfx_pdm_buffer_set

    Are you using the nRF52DK (PCA10040)?