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, Karl

    Thank you very much for your reply.

    In the default sample, the Windows11 can recognized it:

    Then I have tried to add the "mic-channel-c;" to the dt overlay file.

    &hs_0 {
        mic-channel-c;
    };

    Then the windows can recognized it, but there is no Advanced page to check the channel:

    And I have checked the kconfigs in the project, but i found nothing about the channel settings. Also for the audio_usb.c/.h. I know if i add the channel, the file shoud be modified. But I want the Windows 11 can get the channel of my device first, even if it doesn't work.

    Thank you very much and looking forward for your reply.

  • Hello,

    Thank you for your patience with this.

    huma said:
    And I have checked the kconfigs in the project, but i found nothing about the channel settings. Also for the audio_usb.c/.h. I know if i add the channel, the file shoud be modified. But I want the Windows 11 can get the channel of my device first, even if it doesn't work.

    I am not sure that I understand what you mean by this - what changes have you currently made to the audio_usb.c/.h, and what were the specific purpose of those changes?

    Best regards,
    Karl

  • Hello,  Karl

    Thank you very much for your reply.

    I have only changed the dt overlay file, because the audio_usb.c/.h i found that there is only the audio signal process part.

    What I want to test now is how many audio channels my USB device can recognized by my PC. The first step is that I don't care if the audio part is working, so I think I should first modify the device information section of the USB device.

    The second step is that once the computer can correctly recognize the number of channels for the device I want, I can start modifying the audio part.

    So, for the first step, what should i do?

    Thank you very much and looking forward for your reply.

  •   , I've been following this thread with interest, wondering whether you'll be able to transceive all 8 I2S channels to the PC.

    I'm not sure if you're still having issues with mono/stereo signals, but here's something worth considering. While the CS47L63 has 2 stereo inputs (IN1 and IN2), only IN2 is wired for analog stereo line-in.

    CS47L63 IN2 stereo

    IN1 is wired to the digital mic, which is a mono signal and only outputs on the IN1L channel. When the PDM mic is selected, hw_codec.c writes register values that assign the silent IN1R channel to ASPTX2 I2S.

    CS47L63 IN1 mono

    If you want the PDM mic to fill both L/R I2S channels, you'll have to edit cs47l63_reg_conf.h so that IN1L is routed to both ASPTX1/2.

    CS47L63 IN1 dual mono

    cs47l63_reg_conf.h line 75:

    /* Send PDM MIC to I2S Tx */
    { CS47L63_ASP1TX1_INPUT1, 0x800010 },  // IN1L
    { CS47L63_ASP1TX2_INPUT1, 0x800011 },  // IN1R

    Change to:

    /* Send PDM MIC to I2S Tx */
    { CS47L63_ASP1TX1_INPUT1, 0x800010 },  // IN1L
    { CS47L63_ASP1TX2_INPUT1, 0x800010 },  // IN1L

    Hope this helps. Good luck, and keep us updated!

  • Hello,

    Thank you very much! But I haven't delved so deeply into your research yet. At present, I have not been able to make the computer recognize USB devices as multi-channel devices.  Once I achieve this goal, I may start researching how to handle the audio part.

    May I ask if you have a way for the computer to recognize that USB devices have multiple channels?As long as the computer can correctly recognize them, my first goal can be achieved.

    Thank you very much!

Related