Setting up Speaker through the headphone jack on nRF5340 Audio DK

Hey, I'm pretty new to Nordic Development. I am working on nRF5340 Audio DK development board right now and I was trying to create a bluetooth speaker kinda setup using the development board. I'm writing all the code right from scratch and I have already completed the part of connecting the development board to my mobile device via bluetooth. I want to be able to stream audio data from my mobile to the speaker which is connected to the Headphone Jack provided in the audio dk. As far as I've read (please correct me if I'm wrong), the builtin headphone jack is connected to the Cirrus Logic DSP provided in the board. I couldn't find much documentation for working with the DSP and also the LC3 codec provided. Pease guide me through the procedure of setting up the speaker connected to headphone jack so i can stream music over my mobile phone.

  • This might be a bigger project than you realize to write from scratch, and I doubt anyone can answer such a question in a concise forum post. My understanding of the BLE aspects are still too weak to offer guidance on that topic, but I've been studying the CS47L63 DSP codec in detail for some time and have learned the following...

    /modules/hal/cirrus-logic/cs47l63 contains the codec driver and its essential support functions defined by the various files in 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.

    If you have already established a BLE link providing I2S audio data, then you can study the files above to see what's required to route it to the CS47L63's headphone output. Like I mentioned, it's by no means a modest undertaking, but there's plenty of example code to reference.

  • Yeah, I was facing issues with configuring the audio application provided with the nrf5340 audio dk, so I just thought of building one from scratch myself stripping down the necessary functions which are useful for me. What approach do you think would be the best then? modifying the existing codebase examples? if yes, can you please suggest me some examples which could be good for referring?

    I was also trying to setup I2S and couldn't find any useful examples for it.

  • The Bluetooth requirements are far beyond my abilities at the moment, so I'm already out of my depth when discussing this, but the nrf5340_audio application that Nordic provides in their nRF Connect SDK is ridiculously advanced. It provides timing compensation that synchronizes the audio between multiple BLE receivers, which is still black magic to me.

    The I2S audio, however, is pretty well documented. I've had success with the plain Zephyr examples, though modifying them to work with the nRF5340 Audio DK can be a bit challenging at first. The files I mentioned above are necessary references to understand (or at least copy from) when rendering the I2S stream to the CS47L63's DAC.

    I don't yet have enough knowledge to answer your questions definitively, as I'm on the same learning path that you are, but since Nordic's tech support is understandably too overwhelmed to assist beginners in much detail, I thought I would share what little advice I had to offer.

  • Hello,

    Thank you ace.johnny for sharing your experience.

    I recommend that you start with the nRF5340 Audio application to start with a working application. The application is complex because there are time sensitive components throughout.

    SohamGhugare said:
    I was facing issues with configuring the audio application provided with the nrf5340 audio dk,

    If you can share a bit more about which issues you faced, we'll be able to help you to figure out a solution.

    When you tried out the Audio application, did you follow the building and running instructions in the documentation?

    Best regards,

    Maria

Related