BlueCore® ADK 3.0 Subwoofer User Guide Issue 1 © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 1 of 28 CS-310152-UGP1 www.csr.com Document History Revision Date History 1 26 FEB 14 Original publication of this document. Contacts General information Information on this product Customer support for this product More detail on compliance and standards Help with this document www.csr.com sales@csr.com www.csrsupport.com product.compliance@csr.com comments@csr.com 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 2014 Downloaded from www.Manualslib.com manuals search engine Page 2 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Trademarks, Patents and Licences Contents Tables, Figures and Equations Table 3.1: Subwoofer Project Configurations................................................................................................................ 7 Table 4.1: PS Keys Used by ADK 3.0 Subwoofer Application .................................................................................... 10 Table 4.2: Application Features PS Key Configuration ............................................................................................... 12 Table 4.3: Device ID PS Key Configuration ................................................................................................................ 13 Table 4.4: Remote Device ID PS Key Configuration ................................................................................................... 13 Table 4.5: LED Pattern Data Structure ....................................................................................................................... 14 Table 4.6: Plot Point Values for the Red LED of the Example Pattern ........................................................................ 15 Table 4.7: Plot Point Values for the Blue LED of the Example Pattern ....................................................................... 16 Table 4.8: Description of the Example LED Pattern with Populated Values ............................................................... 16 Table 4.9: Order LED Patterns Must be Stored to the LED Configuration Data .......................................................... 17 Table 4.10: Structure Used for the Button Configuration Data .................................................................................... 17 © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 3 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer 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 ..................................................................................................................................... 3 1. Introduction ........................................................................................................................................................ 5 2. Hardware ........................................................................................................................................................... 6 3. Getting Started ................................................................................................................................................... 7 3.1. Supported Development Platforms ................................................................................................................. 7 3.2. Building and Flashing the Subwoofer Application ........................................................................................... 7 3.3. Enabling Debug Output .................................................................................................................................. 8 3.4. Connecting to another Device via Bluetooth ................................................................................................... 8 3.5. Building a Soundbar with Subwoofer Support ................................................................................................ 9 4. Configuration .................................................................................................................................................... 10 4.1. Application Features (PSKEY_USR0) .......................................................................................................... 11 4.2. Device ID Configuration (PSKEY_USR1) ..................................................................................................... 13 4.3. Remote Device ID Configuration (PSKEY_USR2) ....................................................................................... 13 4.4. LED Configuration (PSKEY_USR3) ............................................................................................................. 14 4.5. Button Configuration (PSKEY_USR4) .......................................................................................................... 17 4.6. I²S Initialisation Configuration (PSKEY_USR6) ............................................................................................ 18 4.7. I²S Data Configuration (PSKEY_USR7) ....................................................................................................... 20 4.8. SWAT SDP Configuration (PSKEY_USR8) .................................................................................................. 20 5. The ADK 3.0 Subwoofer Application ................................................................................................................ 21 5.1. Libraries Used .............................................................................................................................................. 21 5.2. Application States ......................................................................................................................................... 22 5.3. Pairing with a Remote Device....................................................................................................................... 22 5.4. Connecting with the Paired Device ............................................................................................................... 23 5.5. Wired Mode .................................................................................................................................................. 24 5.6. Buttons ......................................................................................................................................................... 25 5.7. Amplifier Control ........................................................................................................................................... 25 Document References ................................................................................................................................................ 28 Terms and Definitions ................................................................................................................................................. 28 Table 5.1: Application States Supported by the ADK 3.0 Application ......................................................................... 22 Figure 1.1: Example System Block Diagram................................................................................................................. 5 Figure 4.1: Example LED Plot for a Pattern Using Two LEDs .................................................................................... 15 Figure 5.1: ADK 3.0 Subwoofer Device Connection Establishment Procedure .......................................................... 23 Figure 5.2: DAC, AMP & MUTE On/Off Control Mechanism ....................................................................................... 27 BlueCore ADK 3.0 Subwoofer User Guide © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 4 of 28 CS-310152-UGP1 www.csr.com 1. Introduction The ADK 3.0 Subwoofer application is a single-chip Subwoofer Audio Transfer (SWAT) sink device that enables a high-quality, robust wireless audio link from a CSR SWAT source capable device. Configuration of the application is held in PS Keys and simplified for developers by using the ADK Configuration Tool which allows customisation of the device to meet specific requirements, e.g to: Assign PIO functionality Associate device control with different button presses Configure User and Speaker EQ setting Configure volume control Define unique LED patterns for user actions, system states and events This document describes how the device can be configured and used. Figure 1.1: Example System Block Diagram © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 5 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Figure 1.1 shows a possible user case for a multi-channel audio Soundbar (based on a CSR device with an 8670 IC wireless subwoofer speaker). 2. Hardware This document describes the Subwoofer application in ADK 3.0. The Subwoofer application is suitable for use on CSR8670 or BlueCore5-Multimedia devices. These use either the CSR Bluetooth example CNS10001v4 (CSR8670) or DEV-PC-1645 (BlueCore5-Multimedia) design boards. Notes: A DEV-PC-1309 interface board and suitable SPI interface, such as a CSR 132 USB-SPI converter, is required to program and debug both BlueCore5-Multimedia and CSR8670 devices. 2.1.1. Backing Up the Development Board Before flashing the application to the hardware CSR recommends clearing all the PS Keys from the development board. This places the board in to a known good state. Note: Read the values in the following PS Keys using PSTool and record the values so that they can be restored later: PSKEY_BD_ADDR PSKEY_ANA_FTRIM (BlueCore5-Multimedia) PSKEY_ANA_FTRIM_OFFSET (CSR8670) PSKEY_CHARGER_CURRENT PSKEY_CHARGER_TRIM 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 then ready to be flashed from the xIDE development environment onto the development board. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 6 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide All tools are available in the [ADK]\tools\bin sub directory. Alternatively, tools with a GUI, e.g. PSTool and BlueFlash, can be accessed from the Windows Start menu under ADK\Tools. 3. Getting Started 3.1. Supported Development Platforms The Subwoofer application is designed so that it runs using default settings on either CSR8670 or BlueCore5Multimedia hardware. There are four project configuration settings to choose from, depending on the hardware and debug requirements,, the default configuration is to run on the CSR8670 hardware with debug disabled, see Table 3.1. Table 3.1 lists the available project configurations. Description Subwoofer-8670-Debug Select this configuration when using the CSR8670 hardware and debug output is desired Subwoofer-8670-Release Select this configuration when using the CSR8670 hardware and debug output is not required Subwoofer-BC5MM-Debug Select this configuration when using the BlueCore5-Multimedia hardware and debug output is desired Subwoofer-BC5MM-Release Select this configuration when using the BlueCore5-Multimedia hardware and debug output is not required Table 3.1: Subwoofer Project Configurations Note: When running on BlueCore5-Multimedia Hardware, the Execution mode needs to be set to Native mode, as Assisted Native mode is not available with this platform. Assisted Native mode should be selected when using the CSR8670. 3.2. Building and Flashing the Subwoofer Application To download the Subwoofer application to a suitable device: 1. 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 ADK 3.0. 4. Select Open Workspace from the Project menu and select the subwoofer 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 4. 6. Make sure the Transport is set correctly to do this choose Debug > Transport and select the required Debug Transport. 7. Use PSTool to merge the relevant PS Keys onto the device, for basic operation: If using a CSR8670 device (CNS10001v4 development board), merge the subwoofer_configuration_8670.psr file. If using a BlueCore5-Multimedia device (DEV-PC-1645B development board), merge the subwoofer_configuration_1645.psr file. 8. Select Build Active Project (F7) from the Build menu. 9. Select Run (F5) from the Debug menu. 10. The application is now running on the hardware. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 7 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Configuration Note: The Subwoofer can also be run independently of the xIDE environment by selecting Stop from the Debug menu when the application is running then resetting the hardware (as long as debug has not been enabled, see below). 3.3. Enabling Debug Output To enable debug output add DEBUG_PRINT_ENABLED to the Project Properties. Note: Debug functionality for particular files can be enabled and disabled by editing the relevant #define(s) in subwoofer_debug.h. When debug is enabled in the subwoofer application, the application does not run if a debugger, such as xIDE, is not attached. Connecting to another Device via Bluetooth 3.4.1. Pairing and Connecting the Subwoofer to a Soundbar Device To pair the Subwoofer application to a Soundbar device: 1. Turn on the Subwoofer application by connecting the power cable to the development board: 1.1. 1.2. For a non-empty paired device list: 1.1.1. The Subwoofer automatically enters connectable mode and begins making connection requests to paired device(s). 1.1.2. To manually put the Subwoofer into pairing mode, press and hold the Multi-Function button for 5 seconds. With an empty paired device list: 1.2.1. The Subwoofer automatically enters pairing mode and waits for a remote device to discover and pair to it. With the Subwoofer in pairing mode, a Soundbar device can discover and pair to the Subwoofer, see section 3.4.2. 3.4.2. Discovering the Subwoofer Device from a Soundbar Device When the Soundbar discovers the Subwoofer application, it automatically initiates pairing, when pairing completes, the Subwoofer and Soundbar are connected. 3.4.3. Paired Device List Management The Subwoofer application is designed to store one paired device. If the Subwoofer application needs to be paired with a different host, the Subwoofer application needs to be put back into pairing mode and an inquiry search performed. Any new pairing procedure overwrites existing pairing information and connections. The Subwoofer application does not support any method of clearing its paired device list. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 8 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide 3.4. 3.5. Building a Soundbar with Subwoofer Support To build a Soundbar device from a freshly installed ADK, open the sink project included with the ADK and select Soundbar-8670-Release from the Build menu. This sets all relevant build properties. However, if modifications to the sink project have been made for previous builds, check that the following VM build options are included in the Project Properties: SOUNDBAR Subwoofer Link If the Kalimba -'sbc_decoder' project has been modified in the past, check that SUB_ENABLE is included in the Project Properties. Note: SUB_ENABLE and RELAY_ENABLE cannot be used at the same time. If RELAY_ENABLE is defined it needs to be undefine when defining SUB_ENABLE. BlueCore ADK 3.0 Subwoofer User Guide © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 9 of 28 CS-310152-UGP1 www.csr.com 4. Configuration The ADK 3.0 Subwoofer application supports a number of configuration options allowing unique setups, This section describes the configuration options available, how the subwoofer application interprets each configuration and how to setup a valid configuration. Table 4.1 lists the PS Keys used by the subwoofer application: Description PSKEY_USR0 Application features configuration PSKEY_USR1 Device ID configuration PSKEY_USR2 Remote device ID configuration PSKEY_USR3 LED configuration PSKEY_USR4 Button configuration PSKEY_USR5 Reserved PSKEY_USR6 I²S initialisation configuration PSKEY_USR7 I²S initialisation data PSKEY_USR8 SWAT SDP record PSKEY_USR9 Reserved BlueCore ADK 3.0 Subwoofer User Guide PS Key ID Table 4.1: PS Keys Used by ADK 3.0 Subwoofer Application © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 10 of 28 CS-310152-UGP1 www.csr.com 4.1. Application Features (PSKEY_USR0) The ADK 3.0 Subwoofer application has a set of application features that can be used to enable/disable functions and modify configuration data within the application. These features are configured in PSKEY_USR0. Table 4.2 describes PSKEY_USR0. Word(s) Bit(s) Description 1 [0:15] DAC Power On Timer: Time it takes the DAC to fully power on Default = 10 ms 2 [0:15] Amplifier Power On Timer: Time it takes the amplifier to fully power on. default = 200 ms) 3 [0:15] Amplifier UNMUTE Timer: Time it takes for the amplifier to UNMUTE the audio. Default = 5 ms If MUTE I/O lines are not supported, CSR recommends the using a setting of 10 ms to allow time for digital mute to be applied. 4 [0:15] Amplifier MUTE Timer: Time it takes for the amplifier to MUTE the audio. Note: Default = 5 ms If MUTE I/O lines are not supported, CSR recommends the using a setting of 10 ms to allow time for digital mute to be applied. 5 [0:15] Amplifier Power Off Timer: Time it takes for the amplifier to fully power off 6 [0:15] DAC Power Off Timer: Time it takes for the DAC to fully power off 7 [0:7] [0] Default = PIO9 Enable/Disable Wired Mode: [1] Default = PIO4 External Amplifier Mute Control PIO 8 Default = 10 ms External Amplifier Power Control PIO [8:15] Default = 200 ms 0 = Disable (default) 1 = Enabled Audio Output Type: 0 = SUBWOOFER_OUTPUT_DAC (default), 1=SUBWOOFER_OUTPUT_I²S [2] Flag indicating whether or not the external amplifier supports Mute Control I/O. 0 = not supported (default) 1=supported [3] Flag to enable use of the external amplifier Power Control I/O line. 0 = Disabled 1 = Enabled (default)) © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 11 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Note: Word(s) Bit(s) Description 8 (cont.) [4] External Amplifier Mute Control I/O Type: Note: 0 = Active high (default) 1 = Active low This bit is ignored if the amp does not support Mute Control I/O. [5] External Amplifier Power Control I/O Type Note: 0 = Active high (default) 1 = Active low) This bit is ignored if amp Power Control I/O is disabled. [6:8] Restriction Level for Remote Devices: [9] 0 = Disabled (default) 1 = Vendor 2 = Vendor/product 3 = Vendor/product/min-version 4 = Vendor/product/exact-version) Use Link Encryption 9 0 = Disabled 1 = Enabled (default) [0:15] Reserved [0:7] Time to Connect ADC Audio After A Link Loss Occurrs 10 Default = 30 seconds Max = 255 seconds) [8:15] Reserved [0:15] Re-connection attempt delay in seconds: 11 0-15 BlueCore ADK 3.0 Subwoofer User Guide Default = 10 seconds Refresh encryption key interval in seconds: Default = 15 minutes (900 seconds) Table 4.2: Application Features PS Key Configuration © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 12 of 28 CS-310152-UGP1 www.csr.com 4.2. Device ID Configuration (PSKEY_USR1) The device ID configuration is used to set the Device ID used by the application. See the Bluetooth Device Identification Profile Specification for full details on the device ID parameters and their use. If PSKEY_USR1 (Device ID configuration) is empty, the application does not advertise the Device ID EIR data or the Device ID SDP record. Table 4.3 lists the structure for PSKEY_USR1: Bit(s) Description 1 [0:15] VendorIDSource 2 [0:15] VendorID 3 [0:15] ProductID 4 [0:15] Version Table 4.3: Device ID PS Key Configuration 4.3. Remote Device ID Configuration (PSKEY_USR2) The remote device ID configuration is used to restrict pairing requests from remote devices based on their Device ID SDP record. The level of restriction depends on the configured value of application Restriction Level feature. Table 4.4 lists the structure for PSKEY_USR2: Word(s) Bit(s) Description 1 0-15 VendorIDSource 2 0-15 VendorID 3 0-15 ProductID 4 0-15 Version 5 0-15 Alternate VendorIDSource 6 0-15 Alternate VendorID Table 4.4: Remote Device ID PS Key Configuration The Alternate VendorIDSource and Alternate VendorID are used when a specific vendor could have registered with both the Bluetooth Special Interest Group and the USB Implementers Forum. For example, CSR have different VendorIDs registered with both VendorIDSources: CSR Bluetooth Special Interests Group VendorID = 0x000A CSR USB Implementers Forum VendorID = 0x0A12 This allows a remote device requesting pairing to be authenticated regardless of the VendorID, it is using (so long as it matches). If no Alternate VendorID is required (for example, if a Vendor has only registered with either the Bluetooth Special Interests Group or the USB Implementers Forum, both words (Alternate VendorIDSource and Alternate VendorID) must be set to zero and they are ignored by the application when the configuration key is read; CSR recommends that they are not left blank as the application then ignores this feature. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 13 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Word(s) 4.4. LED Configuration (PSKEY_USR3) This section describes how to create an LED pattern. Every application state must have an associated LED pattern defined, this pattern could be blank (if required), but must still be defined. Note: LED patterns are continuously looped while the application state is valid for the configured pattern. The subwoofer LED patterns have been implemented to follow configured plots, there must be three plots (one for each supported LED) for each LED pattern. Each plot is time plotted against LED intensity. Table 4.1 lists the data structure for each LED pattern. Mandatory ID Description M Measured in milliseconds, this is a multiplier used by the plot (to save on data footprint) NUM_POINTS_A M The number of plotted points for LED_A NUM_POINTS_B M The number of plotted points for LED_B NUM_POINTS_C M The number of plotted points for LED_C POINTS A C.1 The first plot point for LED_A D.1 Intermediate plot point(s) for LED_B C.1 The Last plot point for LED_A C.2 The first plot point for LED_B D.2 Intermediate plot point(s) for LED_B C.2 The last plot point for LED_B C.3 The first plot point for LED_C D.3 Intermediate plot point(s) for LED_C C.3 The last plot point for LED_C POINTS B POINTS C Notes: If NUM_POINTS_A is not zero, C.1 is mandatory If NUM_POINTS_B is not zero, C.2 is mandatory If NUM_POINTS_C is not zero, C.3 is mandatory D.1: If NUM_POINTS_A is greater than 2, the required number of intermediate plot points is defined such that the sum of the first plot point, all intermediate plot points and the last plot point is equal to the number of plot points defined by NUM_POINTS_A D.2: If NUM_POINTS_B is greater than 2, the required number of intermediate plot points is defined such that the sum of the first plot point, all intermediate plot points and the last plot point is equal to the number of plot points defined by NUM_POINTS_B D.1:If NUM_POINTS_C is greater than 2, the required number of intermediate plot points is defined such that the sum of the first plot point, all intermediate plot points and the last plot point is equal to the number of plot points defined by NUM_POINTS_C Table 4.5: LED Pattern Data Structure © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 14 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide TIME_MULTIPLIER Rules for defining an LED pattern: Each pattern must have a multiplier, a number of LED_A, LED_B and LED_C points followed by a number curve points (the number of curve points depends on the value set by NUM_POINTS for the pattern), with the exception being for a blank LED pattern (No LEDs to be turned on) Each pattern must have at least two curve points defined for any LED that is required by the pattern The intensity range is from 0x0 through to 0xff, where 0xff is full brightness and 0x0 is fully off 4.4.1. Example LED Pattern LED patterns are simply plots of points for each LED that is required for that pattern. The number of points for each pattern is undefined but must be at least two for any LED that is used by the pattern. To create an empty pattern, set TIME_MULTIPLIER, NUM_POINTS_A, NUM_POINTS_B and NUM_POINTS_C to zero. No curve points must be defined for the pattern. Figure 4.1 shows an example LED plot for a pattern using two LEDs. Figure 4.1: Example LED Plot for a Pattern Using Two LEDs Table 4.6 and Table 4.7 list the values of the plot points required for this example LED pattern: Plot Point Time (ms) Intensity (0x0 <> 0xff) P1 0 0xff P2 500 0xff P3 500 0x0 P4 2000 0x0 Table 4.6: Plot Point Values for the Red LED of the Example Pattern © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 15 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide To create an example pattern where the red LED is flashed, followed by the Blue LED flashed, two plots are required; one plot for the red LED to follow and one plot for the blue LED to follow. Plot Point Time (ms) Intensity (0x0 <> 0xFF) P1 0 0x0 P2 500 0x0 P3 500 0xFF P4 1000 0xFF P5 1000 0x0 P6 2000 0x0 Table 4.7: Plot Point Values for the Blue LED of the Example Pattern ID Value Description TIME_MULTIPLIER 0x64 Multiply the time value for each point by this value (100 ms) NUM_POINTS_A 0x00 Green LED not required for this pattern NUM_POINTS_B 0x04 There are 4 red LED plot points for this pattern NUM_POINTS_C 0x06 There are 6 blue LED plot points for this pattern P1 0x00ff 0x00 (time = 0ms) 0xff (intensity = 0xff) P2 0x05ff 0x05 (time = 500ms) 0xff (intensity = 0xff) P3 0x0500 0x05 (time = 500ms) 0x00 (intensity = 0x00) P4 0x1400 0x14 (time = 2000ms) 0x00 (intensity = 0x00) P1 0x0000 0x00 (time = 0ms) 0x00 (intensity = 0x00) P2 0x0500 0x05 (time = 500ms) 0x00 (intensity = 0x00) P3 0x05ff 0x05 (time = 500ms) 0x00 (intensity = 0xff) P4 0x0aff 0x0A (time = 1000ms) 0x00 (intensity = 0xff) P5 0x0a00 0x0A (time = 1000ms) 0x00 (intensity = 0x00) P6 0x1400 0x14 (time = 2000ms) 0x00 (intensity = 0x00) POINTS_B POINTS_C Table 4.8: Description of the Example LED Pattern with Populated Values © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 16 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide To setup this pattern, the number of points for each LED is now known, 4 for the red LED, 6 for the blue LED and 0 for the green LED. The values for each plot point are also known so the pattern configuration data can be created, see Table 4.8. 4.4.2. Required LED Patterns For the ADK 3.0 Subwoofer application, an LED pattern must exist for each state that has been implemented; this allows the state manager to display a different LED pattern for each state (if required). Table 5.1 lists each application state. Each LED pattern must immediately follow the previous. The application parses the LED pattern configuration data during the initialisation state. The order the LED patterns are entered into the configuration data is very important, it must follow the state. Table 4.9 lists the order LED patterns must appear for each application state: Pattern Index Description subwoofer_init 0 LED Pattern for subwoofer_init subwoofer_discoverable 1 LED Pattern for subwoofer_discoverable subwoofer_connecting 2 LED Pattern for subwoofer_connecting subwoofer_connected 3 LED Pattern for subwoofer_connected subwoofer_open 4 LED Pattern for subwoofer_open subwoofer_streaming 5 LED Pattern for subwoofer_streaming Table 4.9: Order LED Patterns Must be Stored to the LED Configuration Data 4.5. Button Configuration (PSKEY_USR4) The button configuration can be used to modify the buttons supported by the ADK 3.0 Subwoofer application, 4 buttons can be configured for the application. Table 4.10 lists the data structure required to configure the buttons supported by the ADK 3.0 Subwoofer application. Word(s) Bit(s) Description 1 [0:15] Long press timer 2 [0:15] Enter DUT mode timer 3 [0:7] PIO for EQ select button [8:15] PIO for Start discoverable mode button [0:7] PIO for Volume down button [8:15] PIO for Volume up button [0:7] Single PIO when held high to enter continuous TX DUT mode [8:15] Single PIO when held high to enter DUT mode 6-7 [0:31] PIO bitmask for entering continuous DUT mode 8-9 [0:31] PIO bitmask for entering DUT mode 4 5 Table 4.10: Structure Used for the Button Configuration Data © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 17 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide State 4.6. I²S Initialisation Configuration (PSKEY_USR6) The application can be configured to drive an external I²S input amplifier. The external amplifier is configured using the I²C bus and relevant commands, these commands can be configured using a PS Key along with I²S interface settings. Words 1 to 4 Plug-in Type Master or Slave Operation Left or Right Justified I²S Justified Data Delay by 1 Bit Bits per Sample USR Data Key Length No of init I²C Commands No of I²C Volume Commands Volume Commands Offset Type Uint8 Uint8 Uint4 Uint4 Uint8 Uint8 uint8 Uint8 uint8 0-2 0-1 0-1 0-1 0-255 0- 255 0-255 0- 255 0-255 1 1 0 1 16 0 0 0 0 Range Default Value Words 5 to 11 Label No of I²C Shutdown Commands Shutdown Commands Offset Volume No of Bits Volume Range Max Volume Range Min Music Resampling Frequency Voice Resampling Frequency Master Clock Scaling Factor Type 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 0 0 16 15 0 48000 48000 256 Default Value © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 18 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Label For example 0001 0010 2806 021e 0000 0008 0000 00ff bb80 bb80 0100 Where: 0 = User defined using PSKEY_USR 36 and PSKEY_USR37 1 = SSM_2518 CSR I²S development board 2 = Customer developed plug-in Master or Slave Operation: Specifies master or slave operation: 0 = slave 1 = master Left or right Justified I²S: Choose between left justified and I²S data: 0 = left justified data format 1 = right justified data format Justified Data Delay by 1 Bit: The I²S data can be delayed by 1bit: 0 = no delay of I²S data output 1 = 1 bit delay of I²Sdata 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 PSKEY_USR37 in words. No of init I²C Commands: Specifies how many I²C initialisation commands are specified in PSKEY_USR37. No of I²C Volume Commands: Specifies the number of individual I²C volume commands that will be sent to the I²S capable device every time a volume change is made. Volume Commands Offset: Specifies the offset in words of the first I²C volume command in the PSKEY_USR37. No of I²C Shutdown Commands: Specifies the number of individual I²C commands that will be sent to the I²S capable device every time the device is hut down, i.e. close of SCO or A2DP media stream. Shutdown Commands Offset: Specifies the offset in words of the first I²C volume command in the PSKEY_USR37. Volume No of Bits: Specifies the number of bits of the volume setting in the I²C command, default is 8bits. Volume Range Max: Specifies the maximum volume value that will be sent to the I²S device to indicate maximum output level. Volume Range Min: Specifies the minimum volume value that will be sent to the I²S 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: Sspecifies 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 I²S master clock. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 19 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Plug-in Type: Specifies which I²S plug-in to use, currently available options are: 4.7. I²S Data Configuration (PSKEY_USR7) Label Packet length Volume Level Offset in Packet Type Uint16 Uint16 Range 0-255 0 Default Value 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 .... Packet Length: The length of the packet in words, data bytes are actually packed as words. For example, for an I²C initialisation command packet of: 0x68, 0x00, 0x81 The raw data would be: 0068 0000 0081 having 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 I²C volume packet of: I²C ID, set vol command, volume level 0x68, 0x05, 0x?? The volume level offset value would be 1, since the first byte is always the I²C device ID, the first data byte [0] is the 0x05 (set volume command), and the second data byte [1] is the actual volume level. The volume level is not necessarily 8bits only, 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: An array of I²C command bytes whose length is specified by the Packet_length value. For example, for an I²C initialisation command of: I²C ID, set sample rate, automatic sample rate control 0x68, 0x01, 0x01 The complete packet and header information would comprise of five bytes and would look like: Packet length, volume offset, I²C ID, I²C data 0x03, 0x00, 0x68, 0x01, 0x01 4.8. SWAT SDP Configuration (PSKEY_USR8) The SDP record advertised by the SWAT (Subwoofer Audio Transfer Protocol) can be modified using PSKEY_USR8, the first word of this configuration data is used to set the length of the SDP record (in the number of bytes), where the following n words contain the SDP data. No validation checks other than reading the correct length are done on this data, it is up to the implementation to get this data correct based on the Bluetooth SDP advertising requirements. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 20 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide The raw data is an array of I²C data packets, the I²C initialisation command packets must be first in the array followed by the I²C volume command packets, where: 5. The ADK 3.0 Subwoofer Application This section describes the fundamental features for the ADK 3.0 Subwoofer application and describes example use cases. 5.1. Libraries The Subwoofer VM application uses a number of Libraries which are specified in the VM Project Properties. Some libraries have different build variants to enable different configurations 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. Table 3.2 lists all libraries that the Subwoofer uses, the default variant is highlighted in bold. Available Variants Notes swat swat, swat_debug - connection connection, connection_l2cap, connection_rfcomm, connection_rfcomm_no_inquiry, connection_debug, connection_no_ble, connection_debug_no_ble Bluetooth Smart is not supported by the Subwoofer application bdaddr bdaddr - sdp_parse sdp_parse - region region - service service - csr_subwoofer_plugin csr_subwoofer_plugin, csr_subwoofer_plugin_debug - codec codec, codec_nowolfson - audio audio, audio_tts, audio_vp, audio_tts_debug, audio_vp_debug, audio_asr, audio_asr_vp, audio, audio_asr_vp_debug - csr_tone_plugin csr_tone_plugin, csr_tone_plugin_debug - pio_common pio_common, pio_common_debug - audio_plugin_common audio_plugin_common - csr_i2s_audio_plugin csr_i2s_audio_plugin - Table 3.2 Subwoofer Libraries © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 21 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Library 5.2. Application States The application makes use of a state machine to indicate the current state of the application. Table 5.1 lists the states and their descriptions. Reference Description 0 subwoofer_init The application is in the process of initialising 1 subwoofer_discoverable The application is discoverable waiting for a pairing request from a remote device 2 subwoofer_connecting The application is attempting to connect to the paired device 3 subwoofer_connected The application is connected with the remote device and a signalling channel is open 4 subwoofer_open The application is connected with the remote device and both a signalling channel and a media channel are open, no media data is streaming over the media channel 5 subwoofer_streaming The application is connected with the remote device and both a signalling channel and a media channel are open, media data is streaming on the media channel Table 5.1: Application States Supported by the ADK 3.0 Application 5.3. Pairing with a Remote Device The initial state of the device is unpaired and it enters the subwoofer_discoverable state to allow for a remote device to discover, pair and connect to it. This is the expected state when the subwoofer is first powered on (unless it is prepaired during the production test process). If an entry for a paired device exists in the paired device list of the device, it needs to be cleared so the application can move to the subwoofer_discoverable state. To manually clear the paired device list of the device and force the application into the subwoofer_discoverable state, perform a long press (default 3 seconds; configurable) of the Start discoverable mode button. When the device is in pairing mode (this can be confirmed by the LED pattern being displayed; the default pattern is alternate pulsing of the blue and red LEDs), the remote device must discover and initiate pairing. The default restriction level has been disabled, so any remote device is allowed to pair with the ADK 3.0 Subwoofer. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 22 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide ID 5.4. Connecting with the Paired Device When the device has been paired with a remote device, it continuously triesto re-connect the paired device as soon as it has been powered on, after a link loss or after a disconnection. If the remote device is not available, it keeps re-trying to connect, see Figure 5.1. While the device is in connecting state and it is continuously paging the paired device, the amount of time between each reconnection attempt is configurable using the Application Features configuration, described by section 4.1, the default value is 10 seconds between each reconnection attempt. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 23 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Figure 5.1: ADK 3.0 Subwoofer Device Connection Establishment Procedure 5.5. Wired Mode The wired mode feature is enabled or disabled using the Application Features configuration data, described in section 4.1. When wired mode is enabled, the ADK 3.0 Subwoofer application routes audio from the ADC input through the DSP and out to the speaker. 5.5.1. Wired Mode Operation For wired mode to be active, the device must be disconnected from its paired device, when in wired mode, the DSP is loaded and monitors the ADC input of the device, while there is no audio signal present on the input, the device does nothing other than monitor it. As soon as an audio signal is detected on the ADC input, the ADK 3.0 Subwoofer application turns on and un-mutes the amplifier so the audio signal can be rendered by the speaker. Wired mode is in operation for both discoverable and connecting states. 5.5.2. Wired Mode EQ Filters The wired mode supports audio processing through the use of digital EQ Banks. 3 EQ banks are supported by the ADK 3.0 Subwoofer application. The EQ banks are designed to apply different levels of low pass filtering on the input audio source. The EQ banks can be cycled through using the EQ Select button, which can be configured in the button configuration data, as described in section 4.5. The EQ banks can be configured using the CSR Universal Frond End application and then downloaded to the ADK 3.0 Subwoofer. 5.5.3. Wired Mode Volume Control When in wired mode, Volume Up and Volume Down buttons are used to control the audio gain of the output signal. The volume gain is applied digitally by the ADK 3.0 Subwoofer DSP application, and the volume table mapping can be re-configured using the CSR Universal Front End application and then downloaded to the ADK 3.0 Subwoofer. The Volume Up and Volume Down buttons can be configured in the button configuration data, as described in section 4.5. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 24 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide As soon as a Bluetooth connection is established with the paired device, wired mode is disabled. 5.6. Buttons The ADK 3.0 Subwoofer application supports buttons to allow user interaction with the application, the available buttons are: 1. Volume Up 2. Volume Down 3. EQ Select 4. Start Discoverable mode 5. Enter Continuous TX DUT mode 6. Enter DUT mode The Volume Up, Volume Down and EQ Select buttons are only available when the ADK 3.0 Subwoofer application is running in wired mode. The subwoofer can be configured to enter Bluetooth test modes for Device Under Test (DUT) and continuous test mode by holding a PIO when the device boots. The PIOs that are used to enter the test modes are configurable and can be set in the button configuration PS Key (PSKEY_USR_4). Entry into test modes are disabled by default and a valid PIO configuration needs to be created to enable the test modes. 5.7. Amplifier Control The ADK 3.0 Subwoofer offers complete control over the amplifier power on and power off procedures, this section details the amplifier control implementation for the application. 5.7.1. Connecting the Audio Stream To ensure there are no audio disturbances when connecting an audio stream, the following procedure is followed: 1. Connect the DAC 1.1. 2. 2.1. 3. Wait for the amplifier to fully power on Un-Mute the amplifier 3.1. 4. Wait for the DAC to fully power on Power on the amplifier Wait for the amplifier to un-mute Start streaming audio data from the DSP to the DAC The ADK3.0 Subwoofer should wait for the amplifier to un-mute before streaming the audio data because of the case where the audio is requested to be disconnected immediately after being connected (which is unlikely, but still possible), this ensures the amplifier is fully powered on and in a safe state to be powered off. Configurable timers exist to allow the timers between each process to be changed to suit different hardware requirements. Section 4 describes the configuration options available for these timers. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 25 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide The Start Discoverable mode button disconnects and then deletes the paired device and starts Discoverable mode awaiting a pairing request from a remote device. 5.7.1.1. Amplifiers That Do Not Support MUTE I/O For amplifiers that do not support MUTE I/O lines, a digital mute is applied by the DSP application (where the lowest possible gain is applied to the audio stream) as soon as the DSP application has been successfully loaded and connected to the DAC. When the amplifier has fully powered on, the digital mute is disabled and the correct volume applied. For amplifiers that do not support MUTE I/O lines, the mute timer should be set to zero in the Application Features configuration, see section 4. 5.7.1.2. Amplifiers That Support MUTE I/O For amplifiers that support MUTE I/O lines, the digital mute is applied but the MUTE I/O line is also toggled (depending on whether the MUTE I/O line is active high or active low) to put the external amplifier into MUTE mode. When the DSP has successfully connected and is ready to stream data, the amplifier is un-muted by the MUTE I/O line. 5.7.2. Disconnecting the Audio Stream To ensure there is no disturbance when disconnecting an audio stream, the following procedure must be followed: 1. Mute the amplifier 1.1. 2. 2.1. 3. Wait for the amplifier to mute Power off the amplifier Wait for the amplifier to power off Disconnect the DAC 3.1. Wait for the DAC to fully power off The ADK 3.0 Subwoofer should wait for the DAC to fully power off before allowing it to be powered on again. This is in case where the audio is requested to be disconnected and reconnected immediately after, which can happen quite often with this application when switching between low and standard latency SWAT media channels. This ensures the audio system is in a safe state to turn on after being disconnected and powered off. 5.7.2.1. Amplifiers That Do Not Support MUTE I/O For amplifiers that do not support MUTE I/O lines, a digital mute is applied by the DSP application (where the lowest possible gain is applied to the audio stream), this process is unlikely to take more than 10 ms which CSR recommends as the default configuration. 5.7.2.2. Amplifiers That Support MUTE I/O For amplifiers that support MUTE I/O lines, a digital mute is applied by the DSP application (where the lowest possible gain is applied to the audio stream), followed by pulling/driving the MUTE I/O line (depending on whether the amplifier MUTE line is active high or active low). The time it takes the amplifier to enable MUTE mode is dependent on the amplifier hardware, the timer is configurable in the Application Features configuration, see section 4. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 26 of 28 CS-310152-UGP1 www.csr.com BlueCore ADK 3.0 Subwoofer User Guide Only when the amplifier has entered UNMUTE mode and the audio system is active, is it considered safe for the application to disconnect the audio stream again. 5.7.3. Configurable Timers Used by Audio Connect/Disconnect Sections 5.7.1 and 5.7.2 describe connecting and disconnecting audio streams, this section describes the timers and when they operate. Figure 5.2 shows these timers: BlueCore ADK 3.0 Subwoofer User Guide Figure 5.2: DAC, AMP & MUTE On/Off Control Mechanism In Figure 5.2, the timers are referenced by: 1. DAC power on timer 2. Amplifier power on timer 3. Mute disable timer 4. Mute enable timer 5. Amplifier power off timer 6. DAC power off timer These timers are configurable in the Application Features configuration, described in section 4.1. 5.7.4. Supported Audio Output The device supports two modes of audio output, either by the DAC or the I²S, depending on the amplifier being used, the correct configuration needs to be set, if the wrong setup is configured, no audio is heard. 5.7.4.1. Analogue Amplifiers Analogue amplifiers need the audio output type to be set to AUDIO_OUTPUT_DAC in the Application Features configuration, see section 4. This results in the DSP being connected to the DAC output. 5.7.4.2. Digital Amplifiers Digital amplifiers need the audio output type to be set to AUDIO_OUTPUT_I²S in the Application Features configuration, see section 4. © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine Page 27 of 28 CS-310152-UGP1 www.csr.com Document References Document Reference Bluetooth Device Identification Profile Specification www.bluetooth.org Terms and Definitions Advanced Audio Distribution Profile ADC Analogue to Digital Converter codec Coder decoder CVC Clear Voice Capture DAC Digital to Analogue Converter DSP Digital Signal Processor (or Processing) DUT Device Under Test EEPROM Electrically Erasable Programmable Read Only Memory EQ EQualiser I/O Input/Output I²C Inter-Integrated Circuit Interface I²S Inter-Integrated Circuit Sound LED Light-Emitting Diode PC Personal Computer PIO Parallel Input/Output PS Key Persistent Store Key SDP Service Discovery Protocol; element of Bluetooth SPI Serial Peripheral Interface SWAT SubWoofer Audio Transfer USB Universal Serial Bus © Cambridge Silicon Radio Limited 2014 Downloaded from www.Manualslib.com manuals search engine BlueCore ADK 3.0 Subwoofer User Guide A2DP Page 28 of 28 CS-310152-UGP1 www.csr.com