DESK-MX8M-AN-0002: Adding an audio interface with an USB bluetooth audio transmitter

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box


200px-Emblem-important.svg.png

This application note has been validated using the kit version in the History table.

History[edit | edit source]

Version Date Development Kit version
1.0.0 Apr 2022 DESK-MX8M-L 2.0.0-rc2

Introduction[edit | edit source]

ORCA SOM has multiple SAI interfaces. In the ORCA EVK the SAI2 interface signals can be used to connect an external I2S codec for using the native audio interface.

This application note describes how to simply add another audio interface using a standard bluetooth to audio adapter like the Avantree DG80 USB to audio transmitter

USB bluetooth audio kernel driver[edit | edit source]

Once plugged on USB-C connector, using an USB-C to USB-A adapter like this, the kernel identify the BT adapter with the following ID:

root@desk-mx8mp:~# lsusb | grep DG80
Bus 001 Device 003: ID 0a12:1004 Cambridge Silicon Radio, Ltd Avantree DG80
root@desk-mx8mp:~#

and the kernel installs the proper device driver:

root@desk-mx8mp:~# [   57.058086] usb 1-1: new full-speed USB device number 3 using xhci-hcd
[   57.302616] input: Avantree DG80 Consumer Control as /devices/platform/32f10108.usb/38200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1:1.3/0003:0A12:1004.0002/input/input3
[   57.386964] input: Avantree DG80 as /devices/platform/32f10108.usb/38200000.dwc3/xhci-hcd.1.auto/usb1/1-1/1-1:1.3/0003:0A12:1004.0002/input/input4
[   57.400528] hid-generic 0003:0A12:1004.0002: input: USB HID v1.11 Device [Avantree DG80] on usb-xhci-hcd.1.auto-1/input3
root@desk-mx8mp:~#

audio device[edit | edit source]

If the kernel driver is present, the kernel creates the audio interface that can be listed with aplay e.g.

root@desk-mx8mp:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: DG80 [Avantree DG80], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@desk-mx8mp:~#

where card0 is the audio device used for the audio interface instantiated.

Accessing the audio device[edit | edit source]

Here below a simple command used for testing the audio interface.

Once the BT audio speaker has been paired with the USB audio adapter, the audio adapter can be tested with:

root@desk-mx8mp:~# speaker-test -c 1 -t wav

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 3840 to 5760
Period size range from 1920 to 1920
Using max buffer size 5760
Periods = 4
was set period_size = 1920
was set buffer_size = 5760
 0 - Front Left
Time per period = 1.393268
 0 - Front Left
Time per period = 1.479779
 0 - Front Left
Time per period = 1.479839
 0 - Front Left
...