Uploaded by Rimantas Vaicius

CSR 8670 ADK Audio Sink Application User Guide

advertisement
BlueCore
®
ADK Audio Sink Application
User Guide
Issue 3
see pages 9, 18-20, 26,27
© Cambridge Silicon Radio Limited 2013-2014
Page 1 of 42
CS-236868-UGP3
www.csr.com
Document History
Revision
Date
History
1
15 FEB 13
Original publication of this document
2
15 DEC 13
Updated for ADK 3 and to the new CSR style
3
27 JAN 14
Minor editorial corrections
Contacts
www.csr.com
sales@csr.com
www.csrsupport.com
product.compliance@csr.com
comments@csr.com
Trademarks, Patents and Licences
Unless otherwise stated, words and logos marked with ™ or ® are trademarks registered or owned by CSR plc
and/or its affiliates.
Bluetooth® and the Bluetooth logos are trademarks owned by Bluetooth SIG, Inc. and licensed to CSR.
Other products, services and names used in this document may have been trademarked by their respective owners.
The publication of this information does not imply that any licence is granted under any patent or other rights owned
by CSR plc or its affiliates.
CSR reserves the right to make technical changes to its products as part of its development programme.
While every care has been taken to ensure the accuracy of the contents of this document, CSR cannot accept
responsibility for any errors.
Life Support Policy and Use in Safety-critical Compliance
CSR’s products are not authorised for use in life-support or safety-critical applications. Use in such applications is
done at the sole discretion of the customer. CSR will not warrant the use of its devices in such applications.
Performance and Conformance
Refer to www.csrsupport.com for compliance and conformance to standards information.
© Cambridge Silicon Radio Limited 2013-2014
Page 2 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
General information
Information on this product
Customer support for this product
More detail on compliance and standards
Help with this document
Contents
© Cambridge Silicon Radio Limited 2013-2014
Page 3 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
Document History ......................................................................................................................................................... 2
Contacts........................................................................................................................................................................ 2
Trademarks, Patents and Licences .............................................................................................................................. 2
Life Support Policy and Use in Safety-critical Compliance............................................................................................ 2
Performance and Conformance .................................................................................................................................... 2
Contents ....................................................................................................................................................................... 3
Tables, Figures and Equations ..................................................................................................................................... 4
1. Introduction ............................................................................................................................................................ 5
1.1. Hardware ........................................................................................................................................................ 5
2. Getting Started....................................................................................................................................................... 6
2.1. To Flash the Audio Sink Application onto Suitable Hardware ......................................................................... 6
2.2. Making a Bluetooth Connection with Another Device ..................................................................................... 7
3. To Set Up the xIDE Project Environment ............................................................................................................... 8
3.1. Libraries Used by the Audio Sink Application ................................................................................................. 8
3.2. To Enable Extra A2DP Codecs .................................................................................................................... 10
3.3. To Enable Debug Output .............................................................................................................................. 10
4. Peer Device Support............................................................................................................................................ 11
4.1. ShareMe ....................................................................................................................................................... 11
4.2. True Wireless Stereo (TWS)......................................................................................................................... 12
4.3. To Enable Peer Device Support ................................................................................................................... 12
4.4. Configuration ................................................................................................................................................ 14
4.5. Pairing Devices............................................................................................................................................. 15
4.6. Audio Relay Operation ................................................................................................................................. 15
4.7. Ending a Peer Session ................................................................................................................................. 15
4.8. TWS Audio Routing ...................................................................................................................................... 16
5. Soundbar Configuration ....................................................................................................................................... 17
6. AUDIO Configuration ........................................................................................................................................... 18
6.1. Input Sources ............................................................................................................................................... 18
6.2. SPDIF Input .................................................................................................................................................. 19
6.3. Output Sources............................................................................................................................................. 20
7. Audio Routing – Music Applications..................................................................................................................... 27
7.1. Low Latency Applications ............................................................................................................................. 27
7.2. Silence Detection.......................................................................................................................................... 27
7.3. SPDIF Configuration..................................................................................................................................... 27
8. Volume Control .................................................................................................................................................... 28
8.1. DAC Volume Control .................................................................................................................................... 28
8.2. Digital Volume Control .................................................................................................................................. 28
8.3. Hybrid Volume Control ................................................................................................................................. 29
9. Input Manager ..................................................................................................................................................... 30
9.1. Feature Overview ......................................................................................................................................... 30
9.2. Input Events.................................................................................................................................................. 30
9.3. Timers .......................................................................................................................................................... 31
9.4. To Configure the Input Manager ................................................................................................................... 31
10.
Bluetooth Smart Input Monitor.......................................................................................................................... 32
10.1.
HID Over GATT Profile ............................................................................................................................. 32
10.2.
Overview ................................................................................................................................................... 32
10.3.
Profile Dependencies ................................................................................................................................ 32
10.4.
Roles ......................................................................................................................................................... 32
Tables, Figures and Equations
Table 1.1: PS Keys to Read Using PSTool ................................................................................................................... 5
Table 3.1: Audio Sink Application Libraries................................................................................................................. 10
Table 4.1: DSP Application Build Configurations ........................................................................................................ 13
Table 4.2: TWS Pairing Modes ................................................................................................................................... 14
Table 4.3: Default Peer Session Initiation Events Button Mapping ............................................................................. 15
Table 4.4: Default Peer Session End Event Button Mapping ...................................................................................... 15
Table 4.5: TWS Audio Routing ................................................................................................................................... 16
Table 6.1: Configuration Parameters .......................................................................................................................... 20
Table 6.2: PSKEY_USR_36 Format ........................................................................................................................... 23
Table 12.1: Audio Sink Application States .................................................................................................................. 40
Figure 6.1: SPDIF Function Block Diagram ................................................................................................................ 19
© Cambridge Silicon Radio Limited 2013-2014
Page 4 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
10.5.
Feature Overview ...................................................................................................................................... 33
10.6.
Bluetooth Smart Input Monitor Events ...................................................................................................... 33
10.7.
User Events .............................................................................................................................................. 33
10.8.
System Events .......................................................................................................................................... 34
10.9.
Pairing and Connection Management ....................................................................................................... 34
10.10. To Set Up the HID Device ......................................................................................................................... 35
10.11. Using the Bluetooth Smart Input Monitor .................................................................................................. 36
10.12. Bluetooth Smart Input Monitor Configuration ............................................................................................ 37
11.
Infra-red Input Monitor...................................................................................................................................... 38
11.1.
Feature Overview ...................................................................................................................................... 38
11.2.
Infra-red User Events ................................................................................................................................ 38
11.3.
Infra-red System Events ........................................................................................................................... 38
11.4.
Supported Infra-red Consumer Protocols.................................................................................................. 38
11.5.
Infra-Red Transmissions ........................................................................................................................... 38
11.6.
Infra-red Learning Mode ........................................................................................................................... 39
11.7.
Configuring the Infra-red Input Monitor ..................................................................................................... 39
12.
Audio Sink Application States .......................................................................................................................... 40
Document References ................................................................................................................................................ 41
Terms and Definitions ................................................................................................................................................. 41
1.
Introduction
This document describes how to use the Audio Sink application included in this ADK. The Audio Sink application
provides a basis for developing Bluetooth enabled:

Headsets

Soundbars

Speakers
The application runs as a Bluetooth Audio Sink that supports the following profiles:
HSP v1.1

HFP v1.6

A2DP v1.3

AVRCP v1.5

MAP v1.0

PBAP v1.0
Additionally it supports the Bluetooth Smart profile:

Battery Level Service
This document should be used in conjunction with the document ADK Sink Application Configuration and ADK
Subwoofer User Guide.
1.1.
Hardware
The document describes the Audio Sink application in this ADK running on the CSR Bluetooth Headset example
design boards CNS10001v4 (CSR8670) and DEV-PC-1645 (BlueCore5-MultiMedia).
Note:
BlueCore5-Multimedia firmware only supports an external flash of 70 ns or faster. A DEV-PC-1309 interface
board and suitable SPI interface, such as a CSR 1324 USB-SPI converter, is required to program and debug
the device.
1.1.1.
Backing Up the Development Board
Before flashing the application onto the hardware CSR recommends clearing all the PS Keys from the development
board. This places the board into a known good state.
All tools are available in the [ADK]\tools\bin sub directory. Alternatively, tools with a GUI (e.g. PSTool, BlueFlash) can
be accessed from the Windows’ Start menu under ADK\Tools.
Note:
Read the values in the PS Keys listed in Table 1.1 using PSTool and record the values so that they can be
restored later:
BlueCore5-Multimedia
CSR8670
PSKEY_BDADDR
PSKEY_ANA_FTRIM
PSKEY_CHARGER_CURRENT
PSKEY_CHARGER_TRIM
PSKEY_BDADDR
PSKEY_ANA_FTRIM_OFFSET
PSKEY_CHARGER_CURRENT
Table 1.1: PS Keys to Read Using PSTool
© Cambridge Silicon Radio Limited 2013-2014
Page 5 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide

To clear the board’s PS Keys using BlueFlash:
1.
Click Stop Processor and select Flash Erase.
2.
Check the Erase Persistent Store box and then select OK.
3.
Exit BlueFlash.
The application is ready to be flashed from the xIDE development environment onto the development board.
2.
Getting Started
2.1.
To Flash the Audio Sink Application onto Suitable Hardware
Connect the interface board to the development board and attach the SPI interface and USB charger.
2.
Attach suitable headphones and microphone to the sockets on the development board.
3.
Open the xIDE development environment from the ADK program folder.
4.
Select Open Workspace from the Project menu and select the sink application from the apps subdirectory.
5.
By default the application is setup to run on CSR8670 hardware, to change hardware or audio mode,
see section 2.
6.
Make sure the Transport is set correctly. Choose Debug > Transport and select the required Debug
Transport.
7.
Use PSTool to merge the relevant PS Keys onto the device, for basic operation, for:

CNS10001v4 development board: Use sink_system_csr8670.psr and
sink_config_10001v4_stereo.psr.
Note:
The following example configurations for use with the CNS10001v4 are available:

Car kit

Mono headset

Soundbar

Stereo headset

Wired/USB headset.
8.
Select Run (F5) from the Debug menu.
9.
The application is now running on the hardware.
Note:
The Audio Sink application can also run independently of the xIDE environment by selecting Stop from the
Debug menu when the Audio Sink application is running then resetting the hardware.
© Cambridge Silicon Radio Limited 2013-2014
Page 6 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
1.
2.2.
Making a Bluetooth Connection with Another Device
2.2.1.
To Pair and Connect the Audio Sink Application to an AG Device
1.
Turn on the Audio Sink application by pressing and holding the VREG button, if the Audio Sink
application has not been paired before it will automatically enter pairing mode and be connectable and
discoverable.
2.
Discover the Audio Sink application with the AG an initiate pairing. If a pin code is requested enter
0000.
3.
The Audio Sink application is now paired with the AG.
2.2.2.
To Clear the Audio Sink Application Paired Device List
© Cambridge Silicon Radio Limited 2013-2014
Page 7 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
In some cases, it is necessary to clear the PDL for successful connection or reconnection. This can be configured to
a button press using the Audio Sink Configuration Tool.
3.
To Set Up the xIDE Project Environment
Audio Sink application project configurations are provided for Headset and Soundbar use cases on CSR8670 and
BlueCore5-Multimedia, these can be selected from the drop down box in the xIDE tool bar.
Compile time options can then be selected from the Audio Sink application project properties and Enabled or
Disabled as required.
Note:
Including project options that are unsupported by the hardware you are using may produce the error:
Application uses trapsets which firmware doesn't support.
3.1.
Libraries Used by the Audio Sink Application
Many libraries are used by the Audio Sink VM application; they are specified in the VM Project Properties. Some
libraries have different build variants either to enable a different configuration or to exclude unused code to save
flash space.
Including libraries that are unused produces a harmless build warning. Many libraries have debug variants that can
be enabled by adding _debug.
Note:
Some library variants that are not commonly used are disabled from the build to optimise compile time. To
enable these variants edit the VARIANTS file for the required library and recompile.
Table 3.1 lists all libraries that the Audio Sink application uses, the default variant is highlighted in bold.
Library
Available Variants
Notes
avrcp
avrcp, avrcp_controller, avrcp_target,
avrcp_debug
Variants disable
controller/target parts
respectively.
power
power, power_debug
connection
connection, connection _l2cap,
connection_rfcomm,
connection_rfcomm_no_inquiry,
connection_debug, connection _no_ble,
connection _debug_no_ble
Variants to disable
L2CAP, RFCOMM and
BLE.
bdaddr
bdaddr
-
hfp
hfp, hfp_min_cfm, hfp_debug,
hfp_min_cfm_debug
min_cfm variant sends
region
region
-
service
service
-
codec
codec, codec_nowolfson
The nowolfson variant
excludes Wolfson codec
support.
© Cambridge Silicon Radio Limited 2013-2014
-
the minimum required
confirmation messages to
the application
Page 8 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
When running on BlueCore5-MultiMedia Hardware the Execution Mode should be left on the setting Hardware
Default or set to Native mode, Assisted Native mode is not available with this platform. The Sink application does
not fit in the memory available with VM mode firmware for BlueCore5-MultiMedia. Only Assisted Native should
be selected when using CSR8670.
Library
Available Variants
Notes
csr_tone_plugin
csr_tone_plugin, csr_tone_plugin_debug
-
audio
audio, audio_tts, audio_vp, audio_tts_debug,
audio_vp_debug, audio_asr, audio_asr_vp,
audio, audio_asr_vp_debug
Variants enable support
for:
csr_cvc_common_pl
ugin
csr_cvc_common_plugin,
csr_cvc_common_plugin_all,
csr_cvc_common_plugin_all_debug,
All variants support all
CVC types and stereo
mode
csr_voice_prompts
_plugin
csr_voice_prompts_plugin,
csr_voice_prompts_plugin_file_only,
-



Text To Speech,
Voice Prompts
Speech Recognition
csr_a2dp_decoder_
common_plugin
csr_a2dp_decoder_common_plugin_debug,
a2dp
a2dp, a2dp_debug, a2dp_multi_slot,
a2dp_multi_slot_debug, a2dp_atrac,
a2dp_sbc_only
csr_a2dp_decoder_common_plugin_stereo,
csr_a2dp_decoder_common_plugin_stereo_debug,
csr_a2dp_decoder_common_plugin _stereo_bidir,
csr_a2dp_decoder_common_plugin
_stereo_bidir_debug,
csr_a2dp_decoder_common_plugin
_stereo_bidir_wbs,
csr_a2dp_decoder_common_plugin_stereo_bidir_w
bs_debug,
Variants to enable aptX
back channel modes.
Variant to support atrac
and SBC only.
Note:
The Multi_slot
variant uses multiple
memory slots for
internal storage.
csr_common_exampl
e_plugin
csr_common_example_plugin
-
obex
obex, obex_debug, obex_v2
-
sdp_parse
sdp_parse
-
md5
md5
-
usb_device_class
usb_device_class,
usb_device_class_no_mass_storage,
usb_device_class
-
spp_common
spp_common, spp_common_debug
-
spps
spps, spps_debug
-
sppc
sppc, sppc_debug
-
pblock
pblock, pblock_debug
-
© Cambridge Silicon Radio Limited 2013-2014
Page 9 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
csr_voice_prompts_plugin_file_only_dsp,
csr_voice_prompts_plugin_file_only_dsp_debug
Available Variants
Notes
audio_plugin_comm
on
audio_plugin_common
-
csr_dut_audio_plu
gin
csr_dut_audio_plugin,
csr_dut_audio_plugin_debug
-
csr_speech_recogn
ition_plugin
csr_speech_recognition_plugin,
csr_speech_recognition_plugin_debug
-
pio_common
pio_common, pio_common_debug
-
pbapc
pbapc, pbapc_debug, pbapc_debug_print
-
mapc
mapc, mapc_debug
-
gatt
gatt, gatt_debug
-
batt_rep
batt_rep, batt_rep_debug
-
Table 3.1: Audio Sink Application Libraries
3.2.
To Enable Extra A2DP Codecs
By default the ADK is configured to use SBC for AD2P audio connections. Optionally it can be configured to use
MP3, AAC or aptX decoders:
1.
Ensure that the relevant add-on package has been installed onto the ADK.
2.
Add the Decoder application to the project workspace:
3.
From the Project menu select Insert Project into Workspace and select the relevant project from the
directory:
4.
Edit the sink.mak file to ensure that the decoders .kap file is copied into the Audio Sink application
image directory. The relevant code is provided commented out in the sink.mak file. If the .kap file is
not in the Audio Sink image directory the code crash when attempting to load the DSP decoder.
5.
In the Audio Sink project settings enable the Extra Codec feature.
6.
Run the project (F5), the new decoder should be built and installed in the image.
<ADK>\kalimba\apps\a2dp_sink
3.3.
To Enable Debug Output
Adding the DEBUG_PRINT_ENABLED define symbol enables debug output. This can be set in the sink_debug.h
file. Debug for particular files can be enabled and disabled by editing the relevant #define(s) in sink_debug.h.
Note:
When debug is enabled in the application or libraries the application does not run without a debugger attached.
© Cambridge Silicon Radio Limited 2013-2014
Page 10 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
Library
4.
Peer Device Support
The ADK has a feature that allows two ADK based devices to connect to each other and relay A2DP based audio.
The two connected ADK devices are known as Peer devices and connect in a “Peer” session, for the duration of this
connection.
The Peer device initiating a Peer session establishes both an A2DP Signalling channel and an AVRCP Control
channel to the other Peer device.
A Peer device acts as both an A2DP Source and Sink. It operates as an A2DP Source to relay audio received from
another input source. It acts as an A2DP Sink to render audio received from another Peer or input source.
The A2DP codecs supported, for audio relay between two Peer devices, are:
SBC

MP3

AAC

AptX.
Note:
The low latency Faststream and Aptx-LL codecs are not supported.
A Peer device acts as an AVRCP Controller and Target for both Category 1 and Category 2 commands. A Peer
device relaying audio to another Peer behaves as a Category 1 Target to allow the other Peer to control stream state
between the two Peers.
A Peer device receiving relayed audio behaves as a Category 1 Controller, as per normal ADK operation. Both
Peers also operate as Category 2 devices to allow volume to be adjusted.
SCO based audio connections are not supported between Peer devices, so it is not possible to relay HFP call audio
between Peer devices.
The ADK provides two modes of Peer Device support:
1.
ShareMe
2.
True Wireless Stereo (TWS)
Note:
It is possible to support both Peer Device modes on a single device.
4.1.
ShareMe
This mode of Peer device operation allows audio received from an A2DP Source to be relayed to another Peer
device that also supports ShareMe mode. The same audio is rendered by both devices but rendering is not
synchronised between the two Peer devices.
The audio input source, when operating in Audio Sharing mode, is restricted to A2DP based sources e.g. a mobile
phone.
© Cambridge Silicon Radio Limited 2013-2014
Page 11 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide

4.2.
True Wireless Stereo (TWS)
This mode of Peer Device operation allows audio received from an A2DP, USB or Wired Source to be relayed to
another Peer device that also supports TWS mode. The same audio is rendered by both devices and is
synchronised between the two Peer devices.
When operating in TWS mode the audio input source is restricted to an A2DP based source, e.g.

Mobile phone

USB audio

Analogue wired audio.
Note:
SPDIF and FM input sources are not supported.
Features include:

Tightly synchronised audio playback

Synchronised volume control

Device specific trim gain when operating as a TWS device

Flexible audio routing
TWS is designed to ensure tight audio playback synchronisation between two peer devices. It does this using
timestamps embedded in the relayed audio data, and a combination of synchronization delays and rate matching to
ensure synchronous playback.
In addition to synchronized audio playback, TWS provides synchronized volume control on the two peer devices,
taking advantage of the digital volume control framework in Music Manager to allow greater control of the timing of
volume changes.
4.3.
To Enable Peer Device Support
Support for Peer Device functionality needs to be enabled in the VM Sink application project settings as well as the
appropriate DSP Decoder applications, see sections 4.3.1 and 0.
4.3.1.
VM
Under the VM Sink application project settings, select the f Peer Device operation mode supported from the Peer
Device Support dropdown. The options available are:

Disabled

ShareMe

TWS

ShareMe and TWS
These are used to enable/disable support in the VM application as required.
© Cambridge Silicon Radio Limited 2013-2014
Page 12 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
When operating in TWS mode, vendor specific AVRCP commands are used to assist operation for relaying current
user EQ settings etc.
4.3.2.
DSP
Each DSP Decoder application that is used by a device must have the appropriate level of Peer device support
enabled. The VM application assumes that any of the DSP applications used for rendering audio during a Peer
session have the correct level of support enabled.

The SBC, MP3 and AptX DSP Decoder applications supports:

ShareMe
or


ShareMe and TWS.
The AAC DSP Decoder application supports TWS functionality.
Note:
The SBC Decoder also supports USB and Analogue wired input sources.
Table 4.1 describes the options available for enabling/disabling the four DSP Decoder applications.
Configuration
Description
Release
No Peer Device support
ShareMe
ShareMe supported only (not supported by AAC Decoder)
TWS
Both ShareMe and TWS supported
TWS_WIRED_MODE
ShareMe and TWS with additional USB and Analogue wired input support (only supported
by SBC Decoder)
Table 4.1: DSP Application Build Configurations
© Cambridge Silicon Radio Limited 2013-2014
Page 13 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
AAC is not natively supported by the ShareMe feature. Instead the VM application closes any AAC
stream and re-opens it using one of the other available codecs to relay audio.
4.4.
Configuration
4.4.1.
General
4.4.1.1. Device ID
The Device ID record presented by a device can be used to allow/deny connection to another Peer device. The first
three records of a remote Peer’s Device ID i.e. the Vendor ID Source, Vendor ID and Product ID are matched
against the local Peer’s Device ID. If a match is found then connection is allowed.
4.4.1.2. Single Device Operation
When operating in a Peer session, AVRCP commands issued on the Slave and can be routed, via the Master, to the
AV Source. This allows control of media streaming from the Slave device as well as the Master.
4.4.2.
ShareMe
4.4.2.1. UUID
A 128-bit UUID can be used to advertise support for the ShareMe feature. This can be used in conjunction with the
Device ID record if required. A match of the remote Peer’s ShareMe UUID against the local Peer’s ShareMe UUID
determines if ShareMe functionality is enabled.
4.4.3.
True Wireless Stereo
4.4.3.1. UUID
A 128-bit UUID can be used to advertise support for the TWS feature. This can be used in conjunction with the
Device ID record if required. A match of the remote Peer’s TWS UUID against the local Peer’s TWS UUID
determines if TWS functionality is enabled.
4.4.3.2. Pairing Mode
ShareMe pairings are always deemed temporary. However, TWS devices can have different levels of pairing
dependant on the required application.
Table 4.2 describes the pairing options available for TWS devices.
Pairing Type
Description
Temporary
No pairing information is retained when the Peer session ends. However, attempts to recover
from a link loss situation are made.
Normal
Pairing information is stored in the normal way. An entry is used within the device’s PDL. This
entry can drop of the end of the list if too many pairings with other devices are made.
Permanent
Pairing information is retained, even after a clear of the PDL. It can only be overwritten by
pairing another TWS device. The paired device always appears as the first device in the PDL.
Table 4.2: TWS Pairing Modes
© Cambridge Silicon Radio Limited 2013-2014
Page 14 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
When a call is taken on either Peer Device, audio streaming is suspended on both devices. It is only possible to
answer a call on the Peer device that is actually receiving the call.
4.4.3.3. SBC Encoder Params
When using a USB or Analogue wired input with a TWS device, audio is encoded as SBC for relay to a Peer device.
The various parameters that set up the encoder are specified here. See the A2DP Specification for details.
4.4.3.4. Device Trim Volume
When operating in a TWS Peer session, the relative volume levels of each Peer device can be adjusted using the
Device Trim mechanism. The parameters in this section allow the default Device Trim gains to be defined along with
the range and resolution of adjustment.
4.5.
Pairing Devices
Table 4.3 shows the standard key mappings for the two peer events. These can be changed using the Sink
Configuration tool.
Event
Button Mapping
Duration
EventPeerSessionInquire
VREG + PIO10
Very Long (2.5 secs)
EventPeerSessionConnDisc
VREG + PIO12
Very Long (2.5 secs)
Table 4.3: Default Peer Session Initiation Events Button Mapping
4.6.
Audio Relay Operation
Either Peer device may be connected to an AV Source. When streaming is initiated from one AV Source, an A2DP
media channel is established between the two Peer devices and used to relay the received audio to the other device.
When audio is rendered, the level of synchronisation between both Peer devices is determined by the mode of
operation. ShareMe makes no attempt to synchronise the audio. For True Wireless, the audio between the two Peer
devices is synchronised to within a few samples.
If both Peer devices are connected to separate AV Sources, then both may relay audio to their corresponding Peer.
However, audio relay can only occur in one direction at one time.
The Peer device that is currently relaying audio from its connected AV Source to another Peer is known as a Master
Peer device. The Peer device receiving relayed audio is known as a Slave Peer device.
The Master/Slave Peer status changes depending on which device is relaying audio.
4.7.
Ending a Peer Session
To terminate the connection between two Peer devices, without affecting the connection to any other device, use the
EventPeerSessionEnd event.
Table 4.4 shows the standard key mapping for this event. This can be changed using the Headset Configuration tool.
Event
Button Mapping
Duration
EventPeerSessionEnd
VREG + PIO10 or
VREG + PIO12
Very Long (2.5 secs)
Table 4.4: Default Peer Session End Event Button Mapping
© Cambridge Silicon Radio Limited 2013-2014
Page 15 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
A different mechanism is used to pair Peer devices and establish a Peer session. One Peer device must be placed
into Peer Inquiry mode and the other Peer device must be placed into Peer Discoverable mode. This is done by
generating the application events EventPeerSessionInquire and EventPeerSessionConnDisc, respectively.
4.8.
TWS Audio Routing
TWS offers a flexible audio routing mechanism to meet the specific needs of a wireless audio system. Default routing
options are specified in the PS Keys and all routings can be tied to user events to allow dynamic control of channel
assignments.
The audio routing changes are also synchronised and under the control of the master TWS device.
Mono Output(one DAC)
Stereo
Left ,Right
Left+Right
Left
Left , Left
Left
Right
Right, Right
Right
Downmix
Left+Right, Left+Right
Left+Right
BlueCore ADK Audio Sink Application User Guide
Stereo Output(both DACs)
Table 4.5: TWS Audio Routing
The audio routing configuration can be set using the Sink Configuration Tool.
© Cambridge Silicon Radio Limited 2013-2014
Page 16 of 42
CS-236868-UGP3
www.csr.com
5.
Soundbar Configuration
The Sink application has configuration aimed at Soundbars using CSR8670. In addition to the usual features of the
Sink application this enables manual selection of audio sources (see events in ADK Sink Configuration) and optional
use of a wireless Subwoofer device, see ADK Subwoofer User Guide.
To configure this, load the Sink application as described in section 2.1 but merge the .psr file
sink_config_10001v4_soundbar.psr and select the Soundbar project configuration type from the xIDE menu
bar.
BlueCore ADK Audio Sink Application User Guide
© Cambridge Silicon Radio Limited 2013-2014
Page 17 of 42
CS-236868-UGP3
www.csr.com
6.
AUDIO Configuration
6.1.
Input Sources
The Sink application accepts audio input from a variety of different sources including:

Analogue wired input

USB wired input

SPDIF wired input

Bluetooth audio inputs as well as FM receive
The default PSR configuration files for the Headset build configures the application to accept the following input
sources:
Bluetooth SCO and A2DP

Analogue wired

USB Wired
The default PSR configuration files for the Soundbar build configures the application to accept the following input
sources:
Bluetooth SCO and A2DP

Analogue wired

USB wired

SPDIF wired or optical
The Headset and Soundbar builds differ in the way they handle the audio routing, for a Headset build the audio is
routed automatically when an audio source becomes available, audio is routed based on a priority system, headset
audio priorities are:
1.
Bluetooth Audio
2.
USB audio
3.
Analogue wired audio
The priorities cannot be changed without modifications to the audio routing code in the sink_audio_routing.c
file, if required the order of the function calls checking for available audio sources can be re-ordered to suit a
particular application.
Audio routing for the Soundbar is a manual process, audio sources are routed as a direct result of a user generated
event tied to a particular button press, the default .psr file comes with the capacitive touch sensors pre-configured
to select the individual audio sources, there is no priority based switching available, any source can be selected at
any time. The default configuration for use on a CSR8670 development board is:

Cap 0 sensor: Select FM audio source

Cap 1 sensor: Select Analogue wired source

Cap 2 sensor: Select USB wired source

Cap 3 sensor: Select AG1 Bluetooth source

Cap 4 sensor: Select AG2 Bluetooth source

Cap 5 sensor: Select SPDIF wired source

Input Source selections can be configured using the Sink Configuration Tool.
© Cambridge Silicon Radio Limited 2013-2014
Page 18 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide

6.2.
SPDIF Input
The SPDIF wire digital audio input supports all the features that are available to the analogue input types including:

Music enhancement

User EQ

Configurable volume control

High quality voice prompts

Audio routing

Subwoofer connections;
Note:
TrueWireless is not available for SPDIF input.
The SPDIF input interface supports all SPDIF standard sample rates:

48 KHz

44.1 KHz

32 KHz
The sample rate is automatically detected and any transient is smooth and glitch-free. It also supports detection of
compressed digital audio defined by the IEC 61937 standard. CSR’s ADK 3.0 support s the Dolby Digital AC-3
format which can be used to connect the output of DVD players or game consoles. Contact CSR to get the Dolbycertified AC-3 decoder and instructions on how to enable Dolby Digital in ADK 3.0.
(Optional)
S/PDIF Input
IEC-61937
Dolby Digital AC-3
Decoder for
Compressed Audio
Enhancement
User EQ, Bass Manager,
Volume control, etc
To Speakers
(Analogue, I2S, or
S/PDIF)
To Wireless
Subwoofer
Figure 6.1: SPDIF Function Block Diagram
To build and include Contact CSR input support:
1.
Open sink application in xIDE.
2.
Insert Kalimba spdif_sink project into the sink project. The spdif_sink project is located in:
3.
The default setting for the project includes Subwoofer support and plays only PCM uncompressed
audio, Go to the spdif_sink Project Properties and configure the project if you want to change it.
4.
Make sure in the sink.mak that the SPDIF is included in the build image:
ADK_FOLDER\kalimba\apps\a2dp_sink
image/spdif_sink/spdif_sink.kap :
$(mkdir) image/spdif_sink
$(copyfile)
..\..\kalimba\apps\a2dp_sink\image\spdif_sink\spdif_sink.kap $@
image.fs : image/spdif_sink/spdif_sink.kap
Note:
In the default configuration for Soundbar application, the CAP-SENSE-5 sensor has been defined to select and
route SPDIF input audio.
© Cambridge Silicon Radio Limited 2013-2014
Page 19 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
There are hardware reference designs for both coaxial (phono) and optical (TOSLINK) SPDIF connections.
6.2.1.
SPDIF-specific Configuration
Table 6.1 lists the configuration parameters which can be set using the Sink Configuration tool.
Feature
Default
Range
Target Latency
40
20 to 150 (ms)
Supported Data types
0
-
Table 6.1: Configuration Parameters
Description of Configuration Parameters:

Target Latency: This is the amount of required latency needed by the user.
Note:
The target latency is used to synchronise the audio and video by adjusting the required latency in
the audio path. The range of the value for target latency is 20 ms to 80 ms.
When playing compressed Dolby Digital audio the maximum latency can be increased up to
150 ms.

Supported Data Types: By default the application only plays uncompressed stereo digital audio, i.e.
PCM audio, coming from the SPDIF input interface.
To support Dolby Digital AC-3 compressed audio the corresponding check box needs to be ticked.
When receiving unsupported compressed audio from S/PDIF input interface, the output will be muted.
6.3.
Output Sources
Both the Headset and Soundbar applications can outputt t audio using DAC, I2S or SPDIF. The default configuration
.psr files for both the Headset and Soundbar are configured to use the DAC output using the digital volume control
scheme, detailed in section 8.2.
6.3.1.
I2S Output
Soundbar and Headset applications can be configured to use I2S to output audio data to an external audio
DAC/amplifier.configuration of the I2S interface using the Sink Configuration Tool allows a range of output clock
rates to be chosen along with the creation of customised I2C control instructions.
An external amplifier typically requires an I2C interface to configure registers within the device for channel
configuration and volume control. The PS key settings allow I2C instructions to be created that are sent to the
external device at audio connect, disconnect and volume control events.
The I2S functionality is enabled using the Sink Configuration Tool to change the AudioOutput Type parameter in the
Audio Routing tab, by default this is set to DAC, changing this to I2S enables the I2S output for all the DSP audio
applications.
Two PS Keys are used to configure I2S functionality:
For Sink/Soundbar use:
1.
PSKEY_USR_35 : To define Initialisation data and raw data structures
2.
PKSEY_USR_36: To set raw data forI2C commands and volume commands
Configuration of the I2S interface can be performed using the Sink Configuration Tool, for reference the PS Keys the
tool creates are:
© Cambridge Silicon Radio Limited 2013-2014
Page 20 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
The Target Latency is defined by the delay between the time an audio sample reaches the IC until it is
rendered at the output audio interface. This is the latency that occurs within the IC and does not include
any latency that might occur in any external digital speaker.
PSKEY_USR_35 Format:
e.g. 0001 0010 2806 021e 0000 0008 0000 00ff bb80 bb80 0100”
where:
PluginType
Master or Slave Operation
Left or Right Justified I2S
Justified data delay by 1 bit
Bits per sample
Usr data key length
No of initI2c commands
No of i2c volume
commands
Volume commands offset
Type
Uint8
Uint8
Uint4
Uint4
Uint8
Uint8
uint8
Uint8
uint8
Range
0-1
0–1
0-1
0-1
0 -255
0 – 255
0-255
0 – 255
0-255
Default
Value
1
1
0
1
16
0
0
0
0
Shutdown commands offset
Volume no of bits
Volume range max
Volume range min
Music resampling frequency
Voice resampling frequency
uint8
uint8
Uint16
Uint16
Uint16
Uint16
Uint16
Uint16
Range
0-255
0-255
0-65535
0–65535
0-65535
0 -65535
0–65535
0-65536
Default
Value
0
0
16
15
0
48000
48000
256
Scaling factor
No of i2c Shutdown
commands
Type
Master clock
Label
Words 5 to 11:
Description of PSKEY_USR_35:

Plugin Type: Specifies which I2S plugin to use:
0 = User defined via PSKEY_USR_35 and PSKEY_USR _36,
1 = SSM_2518 CSR I2S development board
2 = Customer developed plugin
© Cambridge Silicon Radio Limited 2013-2014
Page 21 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
Label
Words 1 to 4:

Master or Slave Operation: Specifies master or slave operation:
0 = slave,
1 = master.

Left or right Justified I2S: Select left justified or I2s data:
0 = left justified data format,
1 = right justified data format.

Justified data delay by 1 bit: The I2S data can be delayed by 1 bit:
0 = no delay of I2S data output,
1 = 1 bit delay of I2Sdata output.
Bits per sample: Specifies the number of bits in each audio sample, defaults to 16.

USR data key length: Specifies the length of raw data commands in PSKEY_USR_37 in words.

No of init I2c commands: Specifies how many I2C initialisation commands are specified in
PSKEY_USR_37, the data key.

No of i2c volume commands: Specifies the number of individual I2C volume commands that will be
sent to the I2S capable device every time a volume change is made.

Volume commands offset: Specifies the offset in words of the first I2C volume command in the data
PSKEY_USR_37.

No of i2c shutdown commands: Specifies the number of individual I2C commands that will be sent to
the I2S capable device every time the device is shut down, i.e. close of SCO or a2dp media stream.

Shutdown commands offset: Specifies the offset in words of the first I2C volume command in the
data PSKEY_USR_37.

Volume no of bits: Specifies the number of bits of the volume setting in the I2C command, default is 8
bits.

Volume range max: Specifies the maximum volume value that will be sent to the I2S device to indicate
maximum output level.

Volume range min: Specifies the minimum volume value that will be sent to the I2S device to indicate
minimum output level.

Music resampling frequency: Specifies whether the music (A2DP codecs, USB, wired audio) output
rate needs to be resampled to a fixed rate, a value of 0 indicates no resampling is performed, otherwise
specify the required output frequency, e.g. 48000.

Voice resampling frequency: Specifies whether the voice (CVC, tones, voice prompts) output rate
needs to be resampled to a fixed rate, a value of 0 indicates no resampling is performed, otherwise
specify the required output frequency, e.g. 48000.

Master clock Scaling factor: Specifies the scaling factor for the I2S master clock.
© Cambridge Silicon Radio Limited 2013-2014
Page 22 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide

PSKEY_USR_36 format:
This key contains the raw data of the I2C initialisation and volume commands. Table 6.2 describes the format of
PSKEY_USR_36.
Volume
level
offset in
packet
Type
Uint16
Uint16
Range
0-255
Default
Value
0
Packet
length
Volume
level offset
in packet
Uint16[packet
length]
Uint8
0 –255
0-255
0
0
Packet data
Packet data
etc
Uint8
Uint8[packet
length]
....
0-255
0 –255
0-255
....
0
0
0
....
Table 6.2: PSKEY_USR_36 Format
The raw data is effectively an array of packets, the initialisation command packets must be first in the array followed
by the volume command packets.
Description of PSKEY_USR_36

Packet length: This is the length of the packet in words, data bytes are actually packed as words, e.g.
for an I2C initialisation command packet of:
0x68, 0x00, 0x81
Raw data is:
0068 0000 0081
with a packet length of 3.

Volume level offset in packet: This word is only applicable to data packets that set the volume/audio
level output of the left and right channels, its value is ignored for non-volume related packets. For
example. for an I2C volume packet of:
I2C ID, set vol command, volume level
0x68, 0x05, 0x??
The volume level offset value would be 1, since the first byte is always the I2C Device ID, the first data
byte [0] is the 0x05 (set volume command), the second data byte [1] is the actual volume level.
The volume level is not necessarily only 8-bits, its size is configured in the initialisation PS Key, if the
volume level size is larger than 1 byte then the volume level offset indicates the start of the data to be
replaced with the current sink or subwoofer volume level.

Packet data:The packet data is an array of i2C command bytes whose length is specified by the
Packet_length value, e.g. for an I2C initialisation command of:
I2C ID, set sample rate, automatic sample rate control
0x68, 0x01, 0x01
The complete packet and header information would comprise of five bytes and would be:
Packet length, volume offset, I2C ID, I2C data
0x03, 0x00, 0x68, 0x01, 0x01
© Cambridge Silicon Radio Limited 2013-2014
Page 23 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
Label
Packet
length
6.3.1.1. To Create an I2S/I2C Configuration PS Key
This section gives an example that describes how to create an I2S/I2C Configuration PS Key.
For this example the following is assumed:
The configuration will use plugin type of 0 – fully configurable I2S and I2C interface control by PS Key.
2.
The I2S interface on the sink/sub will run in master mode.
3.
The clock multiplier will be 256x.
4.
The sink/sub will use the DSP apps to resample all audio to always output at 48 Khz
5.
The I2S device will support configuration by I2C commands
6.
The I2S device will support volume control of the left and right channels separately by I2C commands
and will use 8 bits for the volume level setting, its scaling will be 255 to 0 representing minimum to
maximum volume respectively.
7.
The I2C initialisation commands are:
8.

0x68, 0x00, 0x81 – clock selection

0x68, 0x00, 0x04 – reset control

0x68, 0x01, 0x01 – automatic sample rate control

0x68, 0x02, 0x02 – set sample rate

0x68, 0x03, 0x00 – Set external clock control

0x68, 0x07, 0x00 – Set mute to off
The I2C volume commands are:

0x68, 0x05, 0x00 – set left channel volume

0x68, 0x06, 0x00 – set right channel volume
Example:
1.
Create the raw I2C commands data. This comprises of all of the initialisation commands followed by
the volume commands.
0x68,0x00,0x81
0x68, 0x00, 0x04
0x68, 0x01, 0x01
0x68, 0x02,0x02
0x68, 0x03,0x00
0x68, 0x07, 0x00
0x68, 0x05,0x00
0x68,0x06,0x00
2.
Add the packet length and volume level offset values:
0x03, 0x00,
0x03, 0x00,
0x03, 0x00,
0x03, 0x00,
0x03, 0x00,
0x03, 0x00,
0x03, 0x01,
offset byte
0x03, 0x01,
3.
0x68,
0x68,
0x68,
0x68,
0x68,
0x68,
0x68,
0x00, 0x81 - initialisation commands
0x00, 0x04
0x01, 0x01
0x02,0x02
0x03,0x00
0x07, 0x00
0x05,0x00
- Volume commands, include volume level
0x68,0x06,0x00
Convert the bytes into words for writing to the PS Key:
0003 0000 0068 0000 0081 0003 0000 0068 0000 0004 0003 0000 0068 0001
0001 0003 0000 0068 0002 0002 0003 0000 0068 0003 0000 0003 0000 0068
0007 0000 0003 0001 0068 0005 0000 0003 0001 0068 0006 0000
© Cambridge Silicon Radio Limited 2013-2014
Page 24 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
1.
4.
Create the PS Key initialisation:
4.1.
Set the plugin type, for this example a fully configurable PS Key:
0x00
4.2.
Set I2S master mode of operation:
0x01
4.3.
Set I2S data format:
0x00
4.4.
- False indicates I2S data format
Set the number of bits per sample:
0x10
4.5.
- 16-bits per sample of I2S audio data
Set the complete length of the raw data PS Key:
4.6.
- Length of PSKEY_USR_37
Set the number of separate I2C initialisation commands, NOT including the volume
commands:
0x06
4.7.
- Six I2C initialisation commands
Set the volume of volume I2C commands:
0x02
4.8.
- Two I2C volume commands, one for left channel one for right channel
Set the offset (in words) of the start of the first volume I2C packet:
0x1e
4.9.
- Offset in words of first volume command in PSKEY_USR_37
Set the number of bits of volume level to replace in the I2C volume commands:
0x0008
4.10.
Set the volume maximum value accepted by the I2C command:
0x0000
4.11.
- resample to 48000 Hz
Set voice resampling frequency, for cvc and voice prompts audio sources
0xbb80
4.14.
- Volume is inverted and scaled appropriately
Set music resampling frequency, for A2DP, wired and USB audio sources:
0xbb80
4.13.
- volume is effectively inverted for this device
Set the volume minimum value accepted by the I2C command:
0x00ff
4.12.
- Volume setting is 8-bits for this device
- resample to 48000 Hz
Set the master clock scaling factor
0x0100
- I2S clock scaling factor to 256
Create the PS Key for the initialisation of the I2S and raw data commands using the settings above:
PSKEY_USR_35 0001 0010 2806 021e 0000 0008 0000 00ff bb80 bb80 0100
6.
Combine this with the raw data PS Key created in step 3:
PSKEY_USR_36 0003 0000 0068 0000 0081 0003 0000 0068 0000 0004 0003 0000
0068 0001 0001 0003 0000 0068 0002 0002 0003 0000 0068 0003 0000 0003
0000 0068 0007 0000 0003 0001 0068 0005 0000 0003 0001 0068 0006 0000
The I2C command data can be entered using the Sink Configuration Tool I2S Command Data option.
© Cambridge Silicon Radio Limited 2013-2014
Page 25 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
0x28
5.
- True indicates master operation
6.3.2.
SPDIF Output
The DSP applications can be configured to output audio output using SPDIF connection. This is done using the Sink
Configuration tool set the audio output type to SPDIF.
BlueCore ADK Audio Sink Application User Guide
© Cambridge Silicon Radio Limited 2013-2014
Page 26 of 42
CS-236868-UGP3
www.csr.com
Audio Routing – Music Applications
7.
Both the Headset and Soundbar applications have a PS Key that configures the audio routing capabilities of the
device, PSKEY_USR_37, this key can be configured with the Sink Configuration Tool and allows control of both the
input and output routing options as well as other optional settings.
7.1.
Low Latency Applications
The sink workspace contains music DSP applications for:
SBC decoder

SPDIF decoder

Faststream decoder

Low Latency Faststream and Aptx decoder with 1-mic CVC back channel support

Low Latency Faststream and Aptx decoder with 2-mic CVC back channel support
By default the standard Faststream decoder is used when the Faststream codec is negotiated, this decoder can be
replaced at runtime with a low latency version with CVC back channel support for gaming applications by enabling
either of the following configuration options:
1.
Use 1-mic Back Channel
2.
Use 2-mic Back Channel
The low latency DSP applications support Faststream or APTX Low latency codec types and provide 1 or 2-mic CVC
back channel functionality.
7.2.
Silence Detection
The Headset or Soundbar music DSP applications support silence detection, this can be configured in the Audio
Routing tab of the Sink Configuration Tool and can be used to power down an external amplifier to save power etc.
7.3.
SPDIF Configuration
The SPDIF functionality can be configured to support PCM or PCM with AC3 support, the AC3 functionality is not
shipped with the ADK by default and must be obtained directly from CSR.
© Cambridge Silicon Radio Limited 2013-2014
Page 27 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide

8.
Volume Control
Both the Headset and Soundbar support three types of volume control:
1.
DAC Volume Control
2.
Digital Volume Control
3.
Hybrid Volume Control
The Sink Configuration Tool is used to configure the three different types of volume control using the Volume
Configuration tab.
8.1.
DAC Volume Control
8.2.
Digital Volume Control
This mode of volume control is only available to DSP music applications, CVC voice applications continue to use
DAC volume control.
The digital volume control works by setting the chip DAC to a fixed level and applying digital attenuation to the audio
signal within the DSP itself.
This method of volume control is able to provide a much higher granularity of the volume changes as well as
increased range and an overall lower output level than that achieved using DAC control only.
The digital attenuation gives a usable range of 0 dB max down to -80dB minimum output level.
The Sink Configuration tool can be used to configure the digital volume control other settings:

Volume Control Type:

Number of Steps from Min to Max:



Default of 32 but may be configured to any number of steps
DAC Gain:


Set to digital
The DAC gain is fixed when using digital control, a value of 15 gives 0 dB output level
Left Channel Trim:

Default of 0 but a trim can be applied to the left channel only in dB units

Right Channel Trim:

Volume steps for Knee value 1 and 2:



The volume level increase/decrease curve can be adjusted to have a non-linear relationship
using two knee values, the volume level in dB is calculated as a linear function between the
min/max knee 1 and knee2 points.
Volume level for knee value 1 and 2:


Default of 0 but a trim can be applied to the right channel only in dB units
Specifies the dB audio output levels for the knee points of the steps versus audio output level
curve.
Maximum and Minimum Gain in dB:

These values set the actual dB audio output level at Max and Min volume steps.
Note:
USB and AVRCP volume levels are scaled appropriately to give the same overall range as that configured but
depending upon the volume range and number of steps chosen there may be some rounding errors with the
USB or AVRCP volume level changes, keeping to a multiple of the AVRCP volume levels minimises these
errors, i.e. CSR recommends using 128, 64, 32 or 16 steps.
© Cambridge Silicon Radio Limited 2013-2014
Page 28 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
This legacy mode of volume control is available to both CVC voice and Music applications. The on-chip DACs are
used to control the level of the audio output signals, these have a range of 16 steps giving a minimum volume level
of -45 dB up to a maximum volume level of 0 dB. The step volume levels are set in the Sink Configuration Tool.
8.3.
Hybrid Volume Control
To give the best signal to noise ratio volume control it is necessary to use the Hybrid Volume Control mechanism,
this is a combination of DAC and DSP volume control.
The configuration is the same as for the digital volume control with the exception of setting the volume control type to
hybrid.
Hybrid volume control works by using the DAC control to give steps of 3 dB in combination with the digital DSP
control to give increased resolution of 0 to 3 dB.
As with the digital volume control the resolution can be whatever is required for the product but attention should be
paid to the step size to smooth operation with USB and AVRCP volume level changes.
BlueCore ADK Audio Sink Application User Guide
© Cambridge Silicon Radio Limited 2013-2014
Page 29 of 42
CS-236868-UGP3
www.csr.com
9.
Input Manager
9.1.
Feature Overview
The Input Manager for the Soundbar application is responsible for managing events received from all Input Monitor
Tasks. There are two parts to the Input Monitor:
1.
Bluetooth Smart Input Monitor
2.
Infra-red Input Monitor
The Input Manager decides which input events are used to generate user events that the Soundbar application then
processes.it gives a clear layered structure to managing input events of various types.
Figure 8.1 outlines the design structure of the Input Manager:
9.2.
Input Events
The Input Manager task generates user events based on input events, these input events can be considered as
virtual buttons, the supported list of input events is:

InputEventDown:

The input(s) have been pressed down.

InputEventVShortRelease:

InputEventShortTimer:

InputEventShortRelease:




The input(s) have been released before the short timer fires.
The short timer fires whilst the input(s) are still pressed down.
The input(s) have been released after the short timer has fired, but before the long timer has
fired.
InputEventLongTimer:

The long timer fires while the input(s) are still pressed down.
© Cambridge Silicon Radio Limited 2013-2014
Page 30 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
Figure 8.1: Design Structure of the Input Manager

InputEventLongRelease:


InputEventVLongTimer:


The input(s) have been released after the long timer has fired, but before the very long timer
has fired.
The very long timer fires while the input(s) are still pressed down.
InputEventVLongRelease

The input(s) have been released after the very long timer has fired, but before the very very
long timer has fired.

InputEventVVLongTimer:

InputEventVVLongRelease:

InputEventRepeatTimer:


The input(s) have been released after the very very long timer has fired
The repeat timer has fired while the input is still pressed down.
Note:
The repeat timer continues to fire every configured (ms) duration until the input(s) are
released.
9.3.
Timers
The Input Manager is the only place where timers used by input monitors are configured, each input monitor must
inherit the configured timers from the input manager so all inputs are based on the same user interaction.
For ADK 3.0, the buttons are not controlled by the Input Manager; they are managed by the Button Manager.
9.4.
To Configure the Input Manager
The Input Manager uses a lookup table to convert input events to user events, this lookup table is configured using
PS Keys, see the ADK Sink Application Configuration User Guide for further details on all configuration options for
this feature.
© Cambridge Silicon Radio Limited 2013-2014
Page 31 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide

The very very long timer fires while the input(s) are still pressed down.
10.
Bluetooth Smart Input Monitor
10.1. HID Over GATT Profile
10.2. Overview
The HID Over GATT Profile (HOGP) defines the procedures and features to be used by Bluetooth Smart HID
Devices using GATT and Bluetooth HID Hosts using GATT.
This profile is an adaptation of the USB HID specification to operate over a Bluetooth low energy wireless link. This
profile only operates over a Low energy transport.
10.3. Profile Dependencies

Generic Attribute Profile (GATT)

Battery Service

Device Information Service

Scan Parameters Profile
10.4. Roles
The profile defines three roles:
1.
HID Device: The HID Device shall be a GATT server.
2.
Boot Host: The Boot Host shall be a GATT client.
3.
Report Host: The Report Host shall be a GATT client.
HID Host refers to both Host roles, Boot Host and Report Host.

A Report Host: Required to support a HID Parser and be able to handle arbitrary formats for data
transfers (known as Reports).

A Boot Host : Not required to support a HID Parser as all data transfers (Reports) for Boot Protocol
Mode are of predefined length and format.
10.4.1. Concurrent Role Limitations and Restrictions
A Boot Host shall not concurrently be a Report Host.
A Report Host shall not concurrently be a Boot Host.
There are no concurrency limitations on either HID Host roles from also being a HID Device.
10.4.2. Limitations and Restrictions
The HID Device shall use the GAP Peripheral role.
The Boot Host shall use the GAP Central role.
The Report Host shall use the GAP Central role.
10.4.3. Multiple Service Instances
Multiple service instances shall not be supported for the following services:

Device Information Service

Scan Parameters Service
Multiple service instances of the HID Service may be supported to allow implementers to define composite HID
Devices whose combined functions require more than 512 octets of data to describe.

Multiple service instances of the Battery Service may be supported.
© Cambridge Silicon Radio Limited 2013-2014
Page 32 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
This profile requires the:

Multiple service instances of the following may be supported, but are not considered a part of this
profile:

Any Service other than HID Service, Device Information Service, or Scan Parameters Service.
10.5. Feature Overview
The Bluetooth Smart HOGP feature within the CSR Soundbar application has been implemented such that the
device adopts the Report Host Role as defined by the HOGP specification.
The feature runs as a standalone task that has been named BLE Input Monitor, it manages connections with HID
Devices acting as remote controllers that are able of sending HID commands to the Soundbar device.
10.6. Bluetooth Smart Input Monitor Events
10.7. User Events
The following list describes each of the user events that are supported by the BLE Input Monitor:

EventUsrBleEnablePairingMode:

EventUsrBleDisablePairingMode:

EventUsrBleEnablePtsTestMode:

EventUsrBleDisablePtsTestMode:

EventUsrBleConnectStoredRemote:

EventUsrBleDisconnectStoredRemote:







Used to enable BLE Pairing Mode.
Used to disable BLE Pairing Mode.
Used to enable BLE PTS Test Mode.
Used to disable BLE PTS Test Mode.
Used to initiate a connection request to the stored remote.
Used to initiate a disconnection request to the stored remote.
EventUsrBlePtsModeNext:

Used to progress to the next stage when running in PTS Test Mode.

EventUsrBleChangeWriteModePriority:

EventUsrBleEnterSuspendMode:

EventUsrBleExitSuspendMode:

EventUsrBleEnableNotifications:

EventUsrBleDisableNotifications:





Used to change the write mode priority.
Used to put all connected remote controllers into suspend mode.
Used to take all connected remote controllers out of suspend mode.
Used to enable notifications for all connected remote controllers.
Used to disable notifications for all connected remote controllers.
© Cambridge Silicon Radio Limited 2013-2014
Page 33 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
The BLE Input Monitor feature relies on a set of user events (that can be configured using the Sink Configuration
tool) to control the task and its mode of operation. This section describes user and system events that are used by
the BLE Input Manager.
10.8. System Events
The following list describes each of the system events that are supported by the BLE Input Monitor:

EventSysBleRemotePairingTimeout:

EventSysBleRemotePairingSuccess:



This event is used to indicate when a Bluetooth Smart HID Device has successfully paired
with the Soundbar device.
EventSysBleRemotePairingFailed


This event is used to indicate when the Bluetooth Smart Pairing Timeout timer fires.
This event is used to indicate when a Bluetooth Smart HID Device has unsuccessfully paired
with the Soundbar device.
EventSysBleRemoteConnected
This event is used to indicate when a Bluetooth Smart HID Device has connected with the
Soundbar device
10.9. Pairing and Connection Management
The Soundbar application manages Bluetooth Smart connections with HID Devices allowing them to transfer HID
commands to the Soundbar device, this section describes how the Soundbar application managers these
connections.
10.9.1. Supporting Multiple HID Devices
The BLE Input Monitor is capable of managing multiple concurrent connections with HID Devices, the number of
concurrent connections is limited depending on the configuration setup, this section will discuss multiple concurrent
connections in more detail.
To configure the maximum number of supported concurrent connections, see ADK Sink Configuration User Guide.
10.9.2. Pairing with a HID Device
The Bluetooth Smart Input Monitor uses a pairing mode for pairing with new HID Devices, this pairing mode is
controlled by both user events and a pairing mode timeout.
10.9.2.1. Enabling Bluetooth Smart Pairing Mode
The user event EventUsrBleEnablePairingMode is used to enable the Bluetooth Smart Pairing Mode, when the
pairing mode has been enabled, any nearby (and unpaired) HID Device that is advertising is paired and connected.
Advertisements from unpaired HID Devices are ignored at all other times.
Pairing success with a particular HID Device cannot be guaranteed if there are multiple unpaired HID Devices
advertising at the time Bluetooth Smart Pairing Mode is enabled. It is based on a first come first serve basis, where
the first advertisement from an unpaired device is the device that is paired and connected to(if possible).
When a nearby HID Device has been successfully paired, Bluetooth Smart Pairing Mode is automatically disabled.
Pairing mode is not enabled if the maximum number of concurrent connected devices is already equal to the
maximum supported.
10.9.2.2. Explicitly Disabling Bluetooth Smart Pairing Mode
The user event EventUsrBleDisablePairingMode is used to disable the Bluetooth Smart Pairing Mode, if required the
user can generate this event to disable the Bluetooth Smart Pairing Mode at any point while Bluetooth Smart Pairing
Mode is enabled.
© Cambridge Silicon Radio Limited 2013-2014
Page 34 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide

10.9.2.3. Connections with Paired Devices While Bluetooth Smart Pairing Mode is Enabled
While the Bluetooth Smart Pairing Mode is enabled, paired HID Devices are still able to connect with the Soundbar.
If a paired device connects while Pairing Mode is active, the pairing mode is only automatically disabled if the
number of connections is equal to the maximum supported, see the ADK Sink Configuration User Guide for further
details on configuring this option.
10.9.3. To Establish Connections with Paired HID Devices
10.9.3.1. Connection Establishment Procedure
HID Devices must be paired before they can be connected; paired HID Devices are able to connect and disconnect
as they like while they are still paired with the Soundbar device. A nearby HID Device can send out Bluetooth Smart
advertisements that are picked by the Soundbar device; when an advertisement is picked up the Soundbar checks
whether the advertisement is coming from a paired device, if it is, it sends a connection request to the HID Device.
The BD/EDR state for the Soundbar is irrelevant to the Bluetooth Smart Input Monitor when managing connections
with HID Devices, they may connect and disconnect whenever they require.
Any paired HID Device can freely connect with the Soundbar while the number of c connected HID Devices is less
than the maximum number allowed. When the number of concurrently connected HID Devices reaches the
maximum allowed, the Soundbar device ignores advertisements from all other paired devices.
10.9.3.2. To Connect the Stored Device
The Soundbar allows the Bluetooth address of a HID Device to be stored with the configuration data. The Soundbar
can issue a connection request to this HID Device whenever the user requires by use of the
EventUsrBleConnectStoredRemote user event. If the HID Device is not available for connection, the connection
timesout and the device is not connected.
10.10. To Set Up the HID Device
When the Soundbar has connected with a HID Device, even though the connection has been setup and the devices
are connected, the devices are not ready to communicate. This section describes the processes to setup the HID
Device so it is ready to communicate with the Soundbar.
10.10.1.
Service Discovery
The Soundbar must discover the services that are supported by the HID Device. Since the HID Device can update
its GATT Database at any time while it is not connected; it is not safe for the Soundbar to store the GATT service
handles between connections. Therefore, after each reconnection, the Soundbar must always discover which
services are supported by the HID Device.
10.10.2.
Included Services
When all services of the HID Device have been discovered, the Soundbar must then find any included services that
the HID Device has setup.
10.10.3.
Characteristic Discovery
When all the #includes (if any) have been discovered, the Soundbar must discover all the characteristics for each
service and store the GATT handles.
© Cambridge Silicon Radio Limited 2013-2014
Page 35 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
The Soundbar device must have enabled Bluetooth Smart scans to read advertisements being broadcast from
nearby HID Devices, the Soundbar enables and disables Bluetooth Smart Scans automatically. While the number of
connections to HID Devices is less than the maximum configured, Bluetooth Smart Scans are enabled to allow other
paired HID Devices to connect.
10.10.4.
Descriptor Discovery
When all the characteristics for each service have been discovered, the Soundbar must discover all descriptors for
each characteristic that the HID Device has setup.
The Descriptors are used to describe each characteristic. Ssome characteristics may have multiple descriptors to
describe what features are or are not supported.
10.10.5.
Processing the Characteristics
When all the descriptors have been discovered, the Soundbar has a clear picture of the GATT Data Base that has
been setup for the HID Device. At this stage, the Soundbar knows what characteristics are supported, but does not
know enough information about each one to make decisions on how they can be used.
When the properties for each characteristic have been read and stored, the Soundbar finds Report characteristics
defined by the HID Device. Report characteristics are used to transfer data from the HID Device to the Soundbar. In
most cases they are used to notify when buttons are pressed on the HID Device. The Soundbar is only interested in
Input Reports so must discover which input reports exist on the HID Device and enable notifications for each one
that supports notifications.
Enabling notifications allows the HID Device to know that the Soundbar wants to be notified of important events for
that characteristic.
When all notifications have been setup, the Soundbar needs to discover whether or not the HID device supports
Suspend Mode, which is used to inform the HID Device when the Soundbar enters/exits a low power mode. The
Soundbar searches for all HID Control Point characteristics defined on the HID device and stores a list of the ones
that support Suspend Mode.
When this is complete, the HID Device is considered fully connected. It is at this point that the system event
EventSysBleRemoteConnected is used to indicate that an RC has connected and is ready for use.
10.10.6.
Enabling and Disabling Notifications Manually
If required, the Soundbar application allows the user to enable or disable notifications from all connected HID
Devices. While notifications are disabled, the HID Device never sends notifications signalling that an event has
occurred on the HID Device. This is not something is used often, but could be used to enable/disable the feature
without having to disconnect all connected remote controllers.
Note:
This feature exists to pass PTS tests for the HID Over GATT Profile.
10.10.7.
Enabling and Disabling Suspend Mode Manually
If required, the Soundbar application allows the user to enable or disable Suspend Mode for all connected HID
Devices.
Note:
This feature exists to pass PTS tests for the HID Over GATT Profile.
10.11. Using the Bluetooth Smart Input Monitor
When a HID Device has connected with the Soundbar application, the Bluetooth Smart Input Monitor is responsible
for managing this HOGP connection. Incoming report notifications from the HID Device that contain HID code(s) are
converted to Input IDs (based on the configured lookup table), the Bluetooth Smart Input Monitor task then sends
messages to the Input Manager task to indicate when a button on the HID Device has been pressed. If a HID code is
received that does not exist within the configured lookup table, the Bluetooth Smart Input Monitor ignores the event.
© Cambridge Silicon Radio Limited 2013-2014
Page 36 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
Each characteristic must have a characteristic declaration descriptor that declares the characteristic, part of this
descriptor includes the properties of the characteristic and reading the properties lets the Soundbar know a list of
operations it can perform on the characteristic, so the first stage is to find each characteristic declaration descriptor,
read the descriptor and store the properties for each discovered characteristic.
While the button is pressed and held, the Bluetooth Smart Input Monitor task continues to send input event
messages to the input monitor (depending on the timer configuration), informing the input manager of the duration of
the button press, when the button is released, the Bluetooth Smart Input Monitor sends an event to the input
manager indicating that the button has been released.
It is the responsibility of the input manager to listen to these input events from the Bluetooth Smart Input Monitor and
generate user events the Soundbar application can process.
10.12. Bluetooth Smart Input Monitor Configuration
See the ADK Sink Configuration User Guide for a complete guide on configuration for the Bluetooth Smart Input
Monitor.
BlueCore ADK Audio Sink Application User Guide
© Cambridge Silicon Radio Limited 2013-2014
Page 37 of 42
CS-236868-UGP3
www.csr.com
11.
Infra-red Input Monitor
11.1. Feature Overview
The Infra-Red Input Monitor for the Soundbar application is responsible for managing events received from Infra-red
remote controllers. Infra-red events are converted to input events and sent to the Input Manager so they can be
processed. This section describes how to use the Infra-red Input Monitor task.
Note:
The Infra-red Input Monitor does not support Multiple Infra-red buttons being pressed.
11.2. Infra-red User Events

EventUsrStartIRLearningMode:

Event to enable Infra-red learning mode.

EventUsrStopIRLearningMode:

EventUsrClearIRCodes:


Event to disable Infra-red learning mode.
Event to clear all Infra-red codes learnt by the Soundbar.
11.3. Infra-red System Events
The Infra-red Input Monitor has a set of system events that are used to notify of events that have occurred, the list of
events is:

EventSysIRCodeLearnSuccess:

Inform that a new Infra-red event has been learnt.

EventSysIRCodeLearnFail:

EventSysIRLearningModeTimeout:

EventSysIRLearningModeReminder:



Indicates that a new Infra-red event failed to be learnt.
Indicates that the Infra-red Learning mode has timed out and is now disabled.
Repeat reminder to indicate that Learning mode is still active.
11.4. Supported Infra-red Consumer Protocols
ADK 3.0 supports two Infra-red protocols:
1.
NEC
2.
RC5
However, ADK 3.0 cannot support both protocols simultaneously, i.e. cannot communicate with both an NEC and an
RC5 remote simultaneously.
11.5. Infra-Red Transmissions
Infra-red remote controllers transmit Infra-red data that is received by the Soundbar, these transmissions have two
bits of information that identify the event being transmitted:
1.
Address
2.
IR Code
The address is an 8-bit data type that contains the remote controller’s address.
The IR Code is an 8 bit-data type that contains the IR Code the controller is transmitting.
© Cambridge Silicon Radio Limited 2013-2014
Page 38 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
The Infra-red Input Monitor can be controlled through user events. The list of user events used to configure and
setup the Infra-red input monitor are:
When the Soundbar application is notified of an Infra-red transmission, the address and code must match an entry in
either the default configuration lookup table or a special lookup table containing learnt Infra-red codes.
11.6. Infra-red Learning Mode
The Infra-red Learning mode is a feature whereby new Infra-red codes can be learnt by the Soundbar application.
When a new code has been learnt, it is added to a lookup table so that when the learnt code is received, the
associated user event can be generated.
To learn a new code Learning mode must be enabled, using the EventUsrStartIRLearningMode event.
The process of learning a new code is with Learning mode enabled, a pre-configured (or pre-learnt) code from a
remote controller is pressed, then the unknown button (the button to learn) is pressed on the second remote
controller.
Events can be learnt from any connected input whose input is monitored by an Input Monitor task that sends
input events to the Input Manager.
Infra-red learning mode can be explicitly disabled at any time by generating the EventUsrStopIRLearningMode user
event.
11.7. Configuring the Infra-red Input Monitor
See the ADK Sink Configuration User Guide for a complete guide on configuration for the Infra-red Input Monitor
feature.
© Cambridge Silicon Radio Limited 2013-2014
Page 39 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
Note:
12.
Audio Sink Application States
The Audio Sink application defines the application states in the source file sink_states.h. Each Bluetooth profile
has its own state machine. Table 12.1 describes the main states used by the application.
Description
deviceLimbo
The Audio Sink application is logically off but physically on – limbo.
deviceConnectable
The Audio Sink application is connectable - page scanning
deviceConnDiscoverable
The Audio Sink application is connectable and discoverable - page
and inquiry scanning.
deviceConnected
The Audio Sink application is connected to an AG.
deviceOutgoingCallEstablish
The connected AG has an outgoing call in progress.
deviceIncomingCallEstablish
The connected AG has an incoming call in progress.
deviceActiveCallSCO
The connected AG has an active call in progress and the audio is in
the Audio Sink application.
deviceTestMode
The Audio Sink application is in test mode.
deviceThreeWayCallWaiting
The connected AG has an active call and a second incoming call.
deviceThreeWayCallOnHold
The connected AG has an active call and a second call on hold.
deviceThreeWayMulticall
The connected AG has more than one active call.
deviceIncomingCallOnHold
The connected AG has an incoming call on hold.
deviceActiveCallNoSCO
The connected AG has an active call and the audio is in the handset.
deviceA2DPStreaming
The Audio Sink application is streaming A2DP audio.
deviceLowBattery
Low battery state, does not actually change to this state but will be
used for independent low battery LED warning.
Table 12.1: Audio Sink Application States
© Cambridge Silicon Radio Limited 2013-2014
Page 40 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
State
Document References
Document
Reference
ADK Subwoofer User Guide
CS-237475-UG
ADK Sink Application Configuration User Guide
CS-306726-UG
Terms and Definitions
Advanced Audio Distribution Profile
AAC
Advanced Audio Coding
ADC
Analogue-to-Digital Converter
ADK
Audio or Application Development Kit
AG
Audio Gateway
AVRCP
Audio/Video Remote Control Profile
BLE
Bluetooth low energy, now Bluetooth Smart
BlueCore®
Group term for CSR’s range of Bluetooth wireless technology chips
Bluetooth®
Set of technologies providing audio and data transfer over short-range radio connections
Bluetooth Smart
Previously BLE
CSR
Cambridge Silicon Radio
DIP
Device ID Profile
DSP
Digital Signal Processor
e.g.
exempli gratia, for example
GAIA
Generic Application Interface Architecture
HFP
Handsfree Profile
i.e.
Id est, that is
IC
Integrated Circuit
ID
Identifier
LED
Light Emitting Diode
MAP
Message Access Profile
PBAP
Phone Book Access Profile
PC
Personal Computer
PDL
Paired Device List
PIO
Programmable Input/Output
© Cambridge Silicon Radio Limited 2013-2014
Page 41 of 42
CS-236868-UGP3
www.csr.com
BlueCore ADK Audio Sink Application User Guide
A2DP
PS Key
Persistent Store Key
RSSI
Received Signal Strength Indication
SBC
Sub-band Coding
SCO
Synchronous Connection-Oriented
SIG
(Bluetooth) Special Interest Group
SPI
Serial Peripheral Interface
USB
Universal Serial Bus
xIDE
CSR’s Integrated Development Environment
BlueCore ADK Audio Sink Application User Guide
© Cambridge Silicon Radio Limited 2013-2014
Page 42 of 42
CS-236868-UGP3
www.csr.com
Download