USB Audio asynchronous implicit feedback sample

Browse source code on GitHub

Overview

This sample demonstrates how to implement USB asynchronous bidirectional audio with implicit feedback. The host adjusts number of stereo samples sent for headphones playback based on the number of mono microphone samples received.

Requirements

Target must be able to measure I2S block start (i.e. first sample from output buffer gets out) relative to USB SOF. The relative offset must be reported with single sample accuracy.

This sample has been tested on nRF5340 DK. While for actual audio experience it is necessary to connect external I2S ADC and I2S DAC, simple echo can be accomplished by shorting I2S data output with I2S data input.

Theoretically it should be possible to obtain the timing information based on I2S and USB interrupts, but currently neither subsystem currently provides necessary timestamp information.

Building and Running

The code can be found in samples/subsys/usb/uac2_implicit_feedback.

To build and flash the application:

west build -b nrf5340dk/nrf5340/cpuapp samples/subsys/usb/uac2_implicit_feedback
west flash

See also

USB device core API
USB Audio Class 2 device API
I2S Interface