How to use AUX output on nRF5340 Audio DK

Hi, I have an nRF5340 Audio DK. As the first step, I want to play a simple 1k Hz tone and output it via the AUX jack on the board.

Is there any related sample code for me to get started with?

Alternatively, I do have an external DAC module that takes in I2S data. Is there any example code that demonstrate how to use I2S feature in nRF Connect SDK?

Thank you!

Parents Reply
  • Hi, thank you for your reply. I tried digging into the code but I found the codes are too intertwined and was not able to isolate the code for the feature I want. 

    I do not need any fancy wireless features. I am simply looking for an example that just demonstrates how to output audio using I2S (setting up device tree and how to use I2S API in nRF Connect SDK).

    Thank you!

Children
  • I've been suffering the same beginner's growing pains as you; here's what I've learned so far...

    /modules/hal/cirrus-logic/cs47l63 contains the codec driver and its essential support functions defined in the various files from those subdirectories.

    /nrf/applications/nrf5340_audio/src/drivers/cs47l63_comm.c implements the driver communication in Zephyr using threads, mutexes, and semaphores for the SPI connection, interrupts, and callbacks.

    /nrf/applications/nrf5340_audio/src/drivers/cs47l63_reg_conf.h contains the necessary register data to setup and enable the sundry codec subsystems such as clocks, gpios, analog/digital inputs, I2S serial ports, headphone output, and the internal signal routing required for the nRF5340 Audio DK. The CS47L63 datasheet describes these in detail.

    /nrf/applications/nrf5340_audio/src/modules/hw_codec.c demonstrates how to combine these disparate files into working code that can be integrated within a larger multithreaded application using features such as ZBus, Shell, and KConfig options.

    Once all that infrastructure is in place, simply send data to the &i2s0 peripheral and it will be rendered by the codec's DAC output. Or, alternatively, modify the codec's internal routing so that its built-in test tone or white noise generators are sent to the DAC output instead.

  • Hi  ,

    Previously mentioned audio unicast server and audio broadcast sink samples can be configured to use I2S as audio output. There are some limitations on the samples shown in nrf5340 audio feature support
    You can read more about Zephyr API: I2S interface and I2S driver in the documentation. Additionally, you could look at i2s_master exampleI2S echo sample and i2s tests.
    For pin control you can look at cpuapp_common-pinctrl and for devicetree at cpuapp_common. General information about devicetree is available in configuring devicetree.

    Best regards,
    Dejan

Related