How to implement audio loopback (mic → headphone) on nRF5340 Audio DK

Hello Nordic Team,

I am using the nRF5340 Audio DK and I want to implement a simple audio loopback — where the board captures voice from the on-board PDM microphone and simultaneously plays it back through the headphone output (I²S / PCM) in real time.

My goal:

  • Capture audio from the built-in microphone.

  • Output the same signal immediately to the headphone jack (DAC path).

  • No Bluetooth streaming, just local loopback for testing.

Could you please guide me on:

  1. Which nRF Connect SDK (NCS) example I can base this on (e.g., nrf5340_audio, nrf5340_audio_dk_app, or a simpler PDM/I2S sample)?

  2. How to enable both PDM input and I2S output simultaneously on the nRF5340 Audio DK.

  3. Any configuration needed in overlay.conf, dts, or audio_system.c for loopback operation.

  4. Whether this can be done in Zephyr directly (e.g., using the drivers/audio or i2s APIs).

My setup:

  • Board: nRF5340 Audio DK (PCA10121)

  • NCS version: (v2.8.0)

  • Toolchain: nRF Connect for VS Code

  • Goal: Local mic → headphone loopback test

Thank you for your help and guidance.

Best regards,
Nishant Gaurav

  • Hi Nishant,

    Which nRF Connect SDK (NCS) example I can base this on (e.g., nrf5340_audio, nrf5340_audio_dk_app, or a simpler PDM/I2S sample)?

    This depends on how much you want to implement yourself and how much you want to use existing implementations for. PDM input and I2S output are already implemented in the nRF5340 Audio application. I don't know what you mean with nrf5340_audio_dk_app here, please clarify which sample/application you mean. If you want to implement your loopback appliation from scratch, using an I2S sample as a basis and expanding it to use PDM as input is an option. Still much from the nRF5340 Audio application should be of help when implementing your application (i.e. hw_codec.ccs47l63_reg_conf.haudio_i2s.c, and audio_datapath.c).

    How to enable both PDM input and I2S output simultaneously on the nRF5340 Audio DK.

    This is implemented for the walkie-talkie demo configuration of the nRF5340 Audio application. 

    Any configuration needed in overlay.conf, dts, or audio_system.c for loopback operation.

    Since the nRF5340 Audio application already supports I2S output and PDM input, I am fairly certain that you don't need to change .dts, but you will need to change the data flow in the application source code.

    Whether this can be done in Zephyr directly (e.g., using the drivers/audio or i2s APIs).

    The PDM microphone is configured through the CS47L63, so you would need to use the CS47L63 driver from the application nRF5340 Audio application. Other than that you can use Zephyr drivers and APIs to implement your application according to your needs. 

    Best regards,

    Maria

Related