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

Using PDM Mic on nRF9160DK

I was wondering if there were any good examples of how to get a PDM device (in this case a microphone) working on the nRF9160DK. I've read parts of the datasheet and I've been able to find the nrfx_pdm driver in the SDK but am unaware what pins to use to get it to read data and how to use the easy-dma feature.

Any pointers in the right direction are appreciated. Thank you

Parents
  • Hi,

    There is no PDM example that I am aware of. However, the nrfx PDM driver has decent API documentation, so you can use it to get a pointer on how to use it.

    Regarding pin configuration, any two of the GPIO pins can be used. EasyDMA is the only way to get data, so it is handled for you. You just have to provide a buffer (pointer and size) using the nrfx_pdm_buffer_set() function.

  • I tried using nrfx_pdm.h however it does not seem to be configured to the nrf9160 as the nrf9160.h does not have NRF_PDM define but DOES have NRF_PDM_NS and NRF_PDM_S defined.

    I did a search and replace to replace NRF_PDM w/ NRF_PDM_NS in the nrf_pdm.h and saved it as nrf_pdm_ns.h

    That seems to be all well and good until I tried to build and gives me some errors

    once I try to build SES gives me these errors

    despite that my nrfx_pdm_ns.h file includes the prototypes (I believe).

    Did I do something wrong or am I missing something?

    Thanks for your help

  • Hi,

    The "undefined reference" error is probably because PDM is disabled in zephyr\ext\hal\nordic\nrfx_config_nrf9160.h. Can set NRFX_PDM_ENABLED to 1 and try again?

  • Hi Einar,

    So I did what you suggested

    but when still when I re-load and try to build the program it still gives me the same error.

    I'm more than a little lost here. Any other help is appreciated.

    Thank you

  • Hi,

    I am sorry, it seems I have played too little with nRF Connect SDK. Setting NRFX_PDM_ENABLED in nrfx_config_nrf9160 does not have effect if it is defined somewhere else. Can you try to set it to 1 in prj.conf also/instead? You could also try to replace:

    with:

    Note that PDM is not properly integrated with Zephyr as of now. It is missing in the device tree, so there are no register definitions etc. If you need PDM now you have to add it yourself, unfortunately.

  • Thanks Einar, 

    I'll give it a try and report back

Reply Children
No Data