This information applies to the nRF52840 SoC only.
This example uses the USB audio class module. See the documentation of this module for links to relevant specification documents.
This example shows how to declare and register two audio class instances to the USB library:
- Headphones audio class (2 channel, Fs=48Khz, 16bit PCM format)
- Microphone audio class (2 channel, Fs=48Khz, 16bit PCM format)
Both classes will enumerate as separate devices. Input audio stream (headphones) is passed to the output audio stream (microphone).
Input and output audio streams
Setup
You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\usbd_audio
LED assignments:
- LED 1 shows the USB bus state:
- ON: State RESUME
- OFF: State SUSPEND
- LED 2 shows the USB device library status:
- ON: USB library STARTED
- OFF: USB library STOPPED
- LED 3 shows that a USB audio stream frame has been received:
- TOGGLE - New frame received
- LED 4 shows that a USB audio stream frame has been transmitted:
- TOGGLE - New frame transmitted
Testing
Test the USB Audio Class Example application by performing the following steps:
- Compile and program the application.
- Connect the development kit to the host computer.
- Choose "nRF52 USB Audio Demo" headphones as a default audio output device.
- Choose "nRF52 USB Audio Demo" microphone as a default audio input device.
- Start audio streaming, for example by playing an audio file on your PC.
- Start audio recording.
- Verify the recorded audio stream.