nrf5340 usb device for audio

I have found that nrf5340 support the usb device function. It can be used for sound card which can receive the audio signal from the PC, and output the mic signal to PC.

And I have tested that function from the nrf5340_audio application.

My question is if we made a USB Docking, if i plug my device which uesd nrf5340 to the docking, can output music(for example, the i2s input to the nrf5340) to the docking which can convert it to analog signal so people can hear them through the wired headset.

Because i thought that first, may be the Docking shoud support the USB HOST function, and the second question is we need the nrf5340 to output the audio signal through the USB prot, not only the MIC signal, I don not know if there some limtations in that.

Thank you very much for helping.

  • Hello,

    I am not quite sure if I understand your topology correctly - you can indeed use the microphone on the nRF5340 LE Audio DK to output audio to a connected computer over USB, but the nRF5340 LE Audio can not serve as a USB Host.
    So, you are correct that you can have your nRF5340 LE Audio DK output the music to the docking (as digital, over USB), or it could output the audio as analog audio out through the headphone jack (by sending the digital audio to the onboard Cirrus Logic hardware codec DAC/DSP).

    Please elaborate on your intentions and topology if this did not fully answer your question.

    Best regards,
    Karl

  • Hello Karl,

    Thank you for your help. We plan to design an audio product with USB function and using battery. And we also want to design a docking for it, the docking can charging the device. So we need to consider whether it is possible to add a headphone jack on Docking so that users can listen to music through wired headphones. If we want to meet this requirement, we first need to evaluate whether it is possible to output music through the nrf5340 USB port.

    So, you are correct that you can have your nRF5340 LE Audio DK output the music to the docking (as digital, over USB).

    Does that means if the docking can work like PC(USB HOST), we can output the audio to it? You know, the nrf5340_audio application only can oputput the mic signal to PC. So I'm not sure if there are any limitations on USB role, such as USB devices can only being able to output MIC signal or if there are bandwidth limitations. Because we want to output the normal music signal, i think the resource requirment should be larger than mic.

    Thank you very much.

  • Hello,

    Thank you for clarifying, this makes your design and intentions much easier to understand, and so I may more precisely advise you.

    huma said:
    Does that means if the docking can work like PC(USB HOST), we can output the audio to it? You know, the nrf5340_audio application only can oputput the mic signal to PC. So I'm not sure if there are any limitations on USB role, such as USB devices can only being able to output MIC signal or if there are bandwidth limitations. Because we want to output the normal music signal, i think the resource requirment should be larger than mic.

    Yes, if your docking in this case is the USB HOST then you may have the nRF5340 output a digital audio stream to it through its USB.
    Is your primary concern the performance of the USB audio transfer? Currently you could use the standard 48KHz/16bits for the USB audio output to the PC. Do you have other requirements than this?

    You could also test this by modifying the walkie talkie demo configuration to output its audio to the USB rather than the I2S, so that one kit will essentially can be used as a wireless microphone for your PC input, for instance.


    Best regards,
    Karl

  • Hello Karl,

    Thank you for your help. I have tried to modifying the CIS bidirectional demo, I change the input of headset from pdm mic to line in. Then the gateway can output that audio signal to PC. But only mono signal. But I want to test the stereo audio signal.

    I think maybe I can try enable both the i2s input and USB input on the Gateway, so that I can try to output the line in signal to the PC through USB. However, in the demo, it seems that only one of these two inputs can be enable. Can I turn them on simultaneously.

    You could also test this by modifying the walkie talkie demo configuration to output its audio to the USB rather than the I2S, so that one kit will essentially can be used as a wireless microphone for your PC input, for instance.

    I found that the default config of walkie talkie demo is using the I2S in. Can I enable both the input at the same time? I want to test that function only use one gateway, because I can make sure that the line in signal is normal stereo music signal, may be i need input the audio_system start through the RTT shell to enable the audio function.

    Since we're talking about this. There is one more thing i want to tell you, the version of SDK i used is 2.6.0, I found there is something wrong when i used it.

    for example, when i power on the gateway only, i input the audio_system start through the RTT shell, it will be crashed. when i use the CIS mode, if I only connect the left headset, when I play a music on the PC, the gateway will be crashed, but if i only connect the right headset, it will be worked well.

    These issuses i have not meet at the last version i have used, which is 2.4.2.

    Thank you very much and looking forward for your reply.

    -------------------------------------------------------------------------------------------------------------------------------------------------------

    UPDATE ON 4.19.2024

    Thank you very much. Karl.

    Your help has given me a great inspiration. I made a series of modifications on the walkie talkie demo to verify the USB output stereo audio signal. Although these modifications may seem non-standard, they at least proved that my idea is feasible. I will further explore and ask you if I have any questions.

    And I have a new question. I found that the default config for the usb sound card is two channel, left and right. But can the nrf5340 support the multichannel usb sound card? for example can it tell PC it support 8 ch then receive the 8 ch audio signal?

    Thank you very much and looking forward for your reply.

  • Hello Karl,

    Still looking forward for your reply.

Related