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.

Parents
  • 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.

  • 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

  • Yes, first of all, I was facing issues routing the audio out to the external headphones. But as ace.johnny suggested, those files served a bit of help in configuring stuff as I intended, yet I'm still facing issues in integrating my own I2S header file which I have already mentioned in a separate thread.

    The audio application seems to be the only example which serves as a functional resource in understanding how components like hw-codec, sw-codec, and other audio components are coupled together on the audio dk. There are no stripped down examples for most of the components which don't include any complex moving parts, for example, there are only 2 examples for I2S interfacing which aren't really helpful because none of them use the inbuilt codec or atleast the HW codec which is present on the audio development board.

    I would highly suggest adding a couple more useful examples for the audio development board rather than having a single complex example which is a nightmare for beginners to navigate through.

  • SohamGhugare said:
    The audio application seems to be the only example which serves as a functional resource in understanding how components like hw-codec, sw-codec, and other audio components are coupled together on the audio dk.

    The reason for this is that the nRF5340 Audio DK was built specifically for the nRF5340 Audio application(s). I also want to stress that both LE Audio and I2S is complex and needs a high amount of resources to follow the specification and have a range of functionality. I understand that the application is large, and we have detailed documentation to pair with the source code to make the learning process simpler. (nRF5340 Audio overview and firmware architecture)

    SohamGhugare said:
    there are only 2 examples for I2S interfacing which aren't really helpful because none of them use the inbuilt codec or atleast the HW codec which is present on the audio development board.

    The I2S echo sample can be modified to work with the CS47L63, or, if not that, it can help you to get familiar with the I2S driver.

    Best regards,

    Maria

  • Yep, I figured that out, I've modified the I2S echo sample according to our requirements, still facing some issues with that too but I've opened a separate thread for it.

Reply Children
No Data
Related