Melody 5.7 Manual

Melody 5.7 Manual

Melody 6.0.31

Melody 6.0.31

Key Specifications

Best-in-Class Configurable Bluetooth 4.0 + BLE and Wireless Audio

Embedded Software and Stack that provides an abstraction layer of the Bluetooth Link

Controlled via UART, USB, BLE or SPP interfaces

BR/EDR Profiles: HFP (AG and HF), A2DP (Sink and Source),

AVRCP, PBAP, MAP, HID, SPP

BLE Profiles: BC Smart, BC Proximity, DIS, PXP

Multipoint Support

True Wireless Stereo (TWS) support

Supports data transfer over BLE, SPP, iAP1, and iAP2

1

protocols

Supports SBC, AAC, aptX and MP3(optional) codecs

Supports digital audio input and output I2S, PCM, SPDIF

Supports analogue audio input and output from module ADC and DAC

GPIO control, LED indications, capacitive touch sensor

Future proof - uses the latest hardware and supports firmware upgrade

(DFU)

Description

Melody is an embedded firmware running on the BC127 module. It offers both Classic Bluetooth and Bluetooth

Low Energy functionality. It provides all functions needed for designing a wireless Audio device that can connect seamlessly to Smartphone's applications and deliver the best audio quality and user experience

Applications

Wireless Speakers, Docks and Headsets

SmartPhone Controlled Audio Systems

Automotive Infotainment Systems

Medical Devices

High Quality Audio Streaming

Gaming Accessories and MP3 Players

1

Only on MFI builds. iAP1 and iAP2 protocols are available to Apple MFI Licensees. Please, contact

BlueCreation for more information.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 1 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

Table of Contents

Key Specifications ................................................................................................................................................ 1

Description ............................................................................................................................................................ 1

Applications ........................................................................................................................................................... 1

Introduction ........................................................................................................................................................... 5

Getting started ...................................................................................................................................................... 5

1.

Setting up - Equipment ............................................................................................................................. 5

2.

Default behavior ........................................................................................................................................ 6

Link ID management ............................................................................................................................................. 7

Operating Modes .................................................................................................................................................. 8

Melody Commands ............................................................................................................................................... 9

Melody Configuration .......................................................................................................................................... 19

Power management ............................................................................................................................................ 27

1.

Battery configuration ............................................................................................................................... 27

PIO functionalities ............................................................................................................................................... 28

1.

GPIO control enabled ............................................................................................................................. 28

2.

GPIO control disabled ............................................................................................................................. 29

3.

Audio Enable PIO ................................................................................................................................... 29

4.

Restoring the default configuration ......................................................................................................... 29

5.

Capacitive touch sensors ........................................................................................................................ 29

LED Indications ................................................................................................................................................... 30

Pairing and connection ....................................................................................................................................... 31

1.

Secure Simple Pairing capabilities ......................................................................................................... 31

2.

Pairing commands .................................................................................................................................. 31

3.

Connection .............................................................................................................................................. 31

Audio configuration ............................................................................................................................................. 32

1.

Analog interface ...................................................................................................................................... 32

2.

Digital interface ....................................................................................................................................... 32

Bluetooth profiles ................................................................................................................................................ 36

1.

A2DP / AVRCP ....................................................................................................................................... 36

True Wireless Stereo ................................................................................................................................... 36

2.

AGHFP & HFP ........................................................................................................................................ 37

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 2 of 80

Melody 6.0.31

Melody 6.0.31

3.

BLE ......................................................................................................................................................... 38

General BLE functionalities ......................................................................................................................... 38

Connection parameters ............................................................................................................................... 39

BC Smart service ......................................................................................................................................... 39

4.

HID .......................................................................................................................................................... 40

5.

iAP .......................................................................................................................................................... 41

6.

MAP ........................................................................................................................................................ 41

7.

PBAP ...................................................................................................................................................... 42

8.

SPP ......................................................................................................................................................... 44

Features .............................................................................................................................................................. 45

1.

Speech Recognition ................................................................................................................................ 45

2.

Device Firmware Upgrade ...................................................................................................................... 45

Appendix A: Event Notifications.......................................................................................................................... 46

Appendix B: Tone parameters and flags ............................................................................................................ 49

Appendix C: Examples ....................................................................................................................................... 52

1.

Pairing and connection with Melody ....................................................................................................... 53

2.

SPP ......................................................................................................................................................... 54

3.

AGHFP & HFP ........................................................................................................................................ 58

4.

PBAP ...................................................................................................................................................... 63

5.

MAP ........................................................................................................................................................ 64

6.

Music source (A2DP & AVRCP) ............................................................................................................. 65

7.

HID .......................................................................................................................................................... 66

8.

Multi-connection and audio routing ......................................................................................................... 69

9.

True Wireless Stereo (TWS) ................................................................................................................... 70

10.

BLE (BC Smart Service) ..................................................................................................................... 71

11.

BLE central (Generic commands) ....................................................................................................... 72

12.

Beacons .............................................................................................................................................. 73

13.

Tones .................................................................................................................................................. 74

Appendix D: Error codes ..................................................................................................................................... 75

Terms and definitions ......................................................................................................................................... 76

General Notes ..................................................................................................................................................... 77

Change Log ........................................................................................................................................................ 78

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 3 of 80

Melody 6.0.31

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 4 of 80

Melody 6.0.31

Melody 6.0.31

Introduction

Melody is an embedded firmware solution running on the BC127 module. It includes an application, the

Bluetooth profiles and the Bluetooth protocol stack both for Classic Bluetooth and Bluetooth Low Energy. It therefore allows using the BC127 module to develop a Bluetooth device without detailed knowledge of the

Bluetooth standard. Melody provides a simple high level UART-based command interface. So the Bluetooth module can be controlled from a host processor.

Getting started

1. Setting up - Equipment

To start you need to have: a) A Bluetooth Development board such as BC127-DEVKIT. Please contact [email protected]

for more information. b) A computer with a serial port running a serial terminal, such as HyperTerminal or PuTTY for Windows or an equivalent program, to communicate over the COM interface.

Connect your PC to your Bluetooth module using the serial port. By default, Melody uses the following UART settings:

Baud rate

Data bits

Stop bits

Parity bit

HW Flow Control

: 9600bps

: 8

: 1

: No parity

: Disabled

Figure 1: Example configuration

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 5 of 80

Melody 6.0.31

Melody 6.0.31

Once you have configured your serial terminal and opened the COM port, power up the development kit. You should see a prompt appear on the screen of the terminal. If you see a prompt and a "Ready", the module is ready to operate. Note that end of line character expected by Melody is a Carriage Return ('\r' or 0x0D).

You are now ready to control the module!

Figure 2: Melody initial load

If you do not see the prompt and "Ready" appear, please check that:

- The module is powered ON and receiving power

- The UART settings on your serial terminal are the same as above

- The module is preloaded with Melody firmware

2. Default behavior

When Melody boots with factory default settings, it is discoverable. Any Bluetooth enabled phone or other

Bluetooth device can see it when scanning (discovering) Bluetooth devices.

Melody will appear as 'BC-XXXXXX'

2

and once connected, it will transparently transfer any audio stream to the audio interface (DAC, I2S, PCM, SPDIF or USB).

2

XXXXXX will be six hexadecimal digits that correspond to the last four hexadecimal digits of the device

Bluetooth address. If you are using the BC127-DEVKIT, the LED will be flashing alternatively to indicate It is

Discoverable.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 6 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

Link ID management

Melody provides an easy way for the user to interact with devices, profiles and other interfaces through Link

IDs. A Link ID is an 8-bit hexadecimal value 0xAB. In most cases, the first digit identifies a device and the second digit refers to a profile as described in the tables bellow:

Device (A) Description

0

Reserved Values

1

Device 1

2

3

Device 2

Device 3

Table 1: Device Field values

Profile (B)

0

1

2

3

4

5

6

7

8

9

A

B-F

Description

Advanced Audio Distribution Profile (A2DP)

Audio\Video Remote Control Profile (AVRCP)

Hands-Free Profile (AGHFP), audio gateway

Hands-Free Profile (HFP), hand-free device

Bluetooth Low Energy (BLE)

Serial Port Profile (SPP)

Phone Book Access Profile (PBAP)

Human Interface Device Profile (HID)

Manage Access Profile (MAP) iPod Accessory Protocol (IAP)

True Wireless Stereo (TWS)

Reserved for Future Use

Table 2: Profile Field values

For example the link '24' refers to the BLE connection with the second device.

In case the device field has a value of zero, the value of the profile field indicates any of the following interfaces:

Profile (B) Description

1

Analog Interface

2-F

Reserved for Future Use

Table 3: Reserved values for Profile Field

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 7 of 80

Melody 6.0.31

Melody 6.0.31

Operating Modes

Melody has two operating mode which define the way the data coming from UART (or USB) is processed.

By default Melody is in Command mode.

Command Mode:

In this mode, Melody parses the commands received over UART and executes them. This allows controlling

and configuring Melody.

Data Mode:

If one or more BLE, IAP or SPP link are established, the user can enter Data Mode for any of these links to be able to transfer data without having to use a command. The raw data received through the connection is seamlessly transferred to the UART interface and vice versa.

The UART interface is hence exclusively dedicated to this mode and Melody won't parse any command expect the special sequence "$$$$" to exit Data mode. Note that it is still possible to interact with Melody by using another link (BLE or SPP) to send commands.

Data transfer can be speeded up with the high speed feature for SPP (~700kbps) or iAP(~500kbps). For BLE connections, the MTU size negotiated between Melody and the remote device has an influence on the rate

(~75kpbs from a peripheral to a central device with a MTU of 100).

To switch between Melody operating modes the following commands can used. PIO_5 can also be used if

GPIO control is disabled (see PIO functionalities ).

Command

$$$$

ENTER_DATA_MODE [link_id]

Table 4: Operating mode commands

Switch from:

Data Mode

Command Mode

Switch to:

Command Mode

Data Mode

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 8 of 80

Melody 6.0.31

Melody 6.0.31

Melody Commands

When in Command mode, the module accepts commands from the host via the UART interface. The generic syntax for commands is:

COMMAND (parameter_1) (parameter_2) … (parameter_n)\r

with a space between each parameter and a Carriage Return ('\r' or 0x0D) at the end of each command.

The different commands to control the Bluetooth link are listed in alphabetical order below. Mandatory parameters are listed in "

( )

" optional parameters are listed in "

[ ]

".

The maximum length for a command is 150 characters, if a command larger than this is provided, Melody will return an error.

UART Command

$$$$

ADVERTISING (mode)

Description

Exit Data mode. Must be sent through the UART interface.

ON starts BLE advertising and OFF stops BLE advertising.

Please note that this command is only available when the device is configured as peripheral.

AT (link_ID) (command to send)

AVRCP_META_DATA

(link_ID)(type)(data)

BATTERY_STATUS

BC_SMART_COMMAND (link)(command)

BC_SMART_NOTIF (link)(data)(cmd)

BLE_GET_SERV (link)

Send a command over the HFP link to the remote device.

Send a notification (track changed) to inform that the AVRCP

Meta Data has changed. The result will be pending until the remote device sends a request to get the attributes. Melody will respond with the data provided and reply OK.

link_id: AVRCP link

type: attribute type

1 – Title

2 – Artist

3 – Album

4 – Number

5 – Total number

6 – Genre

7 – Playing time

data: attribute data (string)

Returns the battery status of the battery attached to the module by detecting the voltage level

Send a command over BLE.

This command is allowed only when there is a BLE connection opened and Melody role is in central.

Enable/disable notifications on the Data and Command characteristics of the BC Smart service.

This command is allowed only when there is a BLE connection opened and Melody role is in central.

List all the primary services in the following format:

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 9 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

BLE_GET_CHAR

(link)[handle_start][handle_end]

BLE_NOTIF (link)(handle)(value)

BLE_READ (link)(handle)

BLE LINK TYPE UUID [HANDLE_START HANDLE_END]

TYPE: U16(16bits UUID) or U128(128bits UUID)

HANDLE: value in hex between 0x0001 and 0xFFFF

This command is allowed only when there is a BLE connection opened and Melody role is in central.

List the characteristics between handle_start and handle_end in the following format:

BLE LINK TYPE UUID [HANDLE]

TYPE: U16(16bits UUID) or U128(128bits UUID)

HANDLE: value in hex between 0x0001 and 0xFFFF

If there is no parameter, lists all the characteristics.

This command is allowed only when there is a BLE connection and Melody is in central mode.

Enable notifications of the characteristic associated to the handle when value=ON. Disable notifications when value=OFF.

Melody will return OK in case of success or an error code if the operation fails (invalid handle).

This command is allowed only when there is a BLE connection and Melody is in central mode.

Return the value of the characteristic associated to the handle in the following format:

BLE LINK [HANDLE] SIZE DATA

HANDLE: value in hex between 0x0001 and 0xFFFF

SIZE: nb bytes of data

DATA: in hex

Melody will return an error if the operation fails (invalid handle, read no permitted...).

This command is allowed only when there is a BLE connection and Melody is in central mode.

BLE_WRITE (link)(handle)(size)(data) Write command on a characteristic.

Size is the number of bytes of the data; each byte in data is separated by a space.

Please note that the maximum size (MTU-3) depends on the

MTU value negotiated when establishing the connection with the remote device.

Melody will return OK in case of success or an error code if the operation fails (invalid handle, write not permitted, invalid length..).

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 10 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

CALL (link) (action) [param]

CLOSE (link/device)

CONFIG

CVC_CFG (type) [(key) (length)]

This command is allowed only when there is a BLE connection and Melody is in central mode.

Call interactions with the specified HFP or AGHFP link.

For an HFP link, action can be any of the following:

- REDIAL: Notifies the AG that the HF wants to establish an outgoing call with the last number dialled.

- MEMORY: Notifies the AG that the HF wants to establish an outgoing call using memory dialling. In this case, param is a combination of alphanumeric characters supplied to the

AG by the HF. The memory string is AG specific.

- OUTGOING: Notifies the AG that the HF wants to establish a call with the number specified in param

- REJECT: Reject an incoming call from the HF.

- ANSWER: Answer an incoming call from the HF.

- END: Terminate an outgoing or active call from the HF.

For an AGHFP link, action can be any of the following:

- ANSWER: For an incoming call, answer the call from the

AG. For an outgoing call, notify the AG that the remote side has answered.

- END: Terminate an incoming, outgoing or active call.

- TRANSFER: Performs an audio connection transfer towards the HF (when value is ON_HF) or an audio connection transfer towards the AG (when value is ON_AG). If param is not provided, Melody will decide depending on where the audio is currently routed.

- INCOMING: Setups the AG in incoming call mode for the number specified in param. Number can by any combination of alphanumeric characters.

- OUTGOING: Setups the AG in outgoing call mode for the number specified in param. Number can be any combination of alphanumeric characters.

Terminates the Bluetooth Profile connection. link is a number that defines the connection ID. all closes all links.

It is also possible to give the device number as parameter to close all the connections for with this device.

Shows all configuration registers

Read or write the CVC configuration stored on the module.

type can be WB or NB.

If only type parameter is supplied all 4 config keys for this type will be displayed.

If key and length parameters are present, the key indicated will be written with a value of size length.

key can be 0 - 3

length is in 16 bit words and can be 0 - 64. 0 will delete the

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 11 of 80

Melody 6.0.31

Melody 6.0.31

DFU

DISCOVERABLE (mode)

ENTER_DATA_MODE (link)

HID_DESC (size)

HID_READ (BT_addr)

HELP

GET (config_name)

IAP [Parameter=value]

key.

The CVC_CFG command will reply with OK/ERROR.

If length was supplied after OK a raw list of up to 24 space separated words followed by carriage return has to be supplied.

Each carriage return will be replied to with an OK/ERROR if the operation is successfully.

If more than the length words are supplied the overall operation will fail.

Causes a reset to make the device boot in DFU

3

mode

ON puts the module in discoverable mode, OFF makes the device non discoverable.

Configure the behaviour of the specified link to be in Data mode.

The parameter link can be any active BLE or SPP link.

In Data mode, Melody sends the data received through the

UART interface directly to the remote device and prints the data received without handling it.

Note that to use Data mode, you must enable hardware flow control on the UART interface, otherwise Melody will return an error.

Sets the USB descriptor to use when acting as a hid device. Size is the length of binary data following (similar to Send when using raw data). By default a USB descriptor for a simple keyboard is loaded. When using this command any previously loaded USB descriptor is deleted. Any USB descriptor loaded with this command is not persistent across a reset.

Reads USB descriptor from SDP of the remote HID device with address BT_addr.

Returns available list of commands.

Reads the value of a configuration parameter.

Set iAP parameters. These are the parameters that identify the device for iOS and iOS application. Maximum sizes of configurations in bytes/chars:

ACCESSORY_NAME 48 characters

MANUFACTURER_NAME 48 characters

MODEL_NAME 48 characters

SERIAL_NO 16 characters

SEED_ID 10 characters

PROTOCOL_STRING 48 characters

HARDWARE_VER 3 characters

3

DFU allows downloading a new firmware upgrades onto the Bluetooth module via the UART interface and allows users to upgrade melody to new releases.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 12 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

FIRMWARE_VER 3 characters

If no parameter is provided, all parameters are displayed.

Refer to the Application Note on iAP for more information.

IAP_APP_REQ [protocol]

INQUIRY (timeout) [type filter]

LICENSE [type] [=value]

LIST

MM_CFG (key) [(length)]

This command will send a request to the iOs device to open an application with the specified protocol (works only with iAP2)s.

If no protocol is specified, the default protocol set with the IAP command will be used.

Searches Bluetooth devices in the area for maximum period of time (equal to 1.28s * timeout). Timeout takes a value between 1 and 48. If the command succeed, it will return

PENDING and a maximum of 16 inquiry results will be displayed as inquiry notifications.

Results can be filtered by providing the optional parameters

type and filter:

-

type=0

Filter the results by name. filter is a string, for example, if the string is “BC-“, only devices with a name starting with “BC-“ will be shown.

-

type=1

Filter the results by class of device. filter is the COD.

-

type=2

Filter the results with an RSSI value in dB, for example -72.

filter is the min value.

-

type=3

Show only TWS devices. filter is the ON or OFF.

Sets or returns the APTX or CVC license.

Type can be any of the following:

- CVC: Sets or gets the CVC license.

- APTX: Sets or gets the APTX license.

If parameter value is provided along with parameter type, the command updates the specified license to the one provided by the user in the value parameter.

A valid license has the following format:

XXXX XXXX XXXX XXXX XXXX

Where X is any hexadecimal digit.

If no parameters are provided, the current CVC and APTX licenses are returned.

Lists paired devices in the format

LIST (BT addr) (Space separated list of supported profiles).

Read or write the Music Manager configuration stored on the module.

MM_CFG key will read the PSKey at that location. MM_CFG

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 13 of 80

Melody 6.0.31

Melody 6.0.31

MUSIC (link_ID)(instruction)

NAME (BT_addr)

OPEN (BT_addr) (profile) [type]

PAIR (BT_addr)

PASSKEY (type) (key)

PIO (PIOx) (state)

key length will be write the PSKey. Keyis DSP PSKey number. It can be between 24 and 38. length is the number of 16bit words to be written for that PSKey. Length can be 0 -

64. 0 will delete the key.

The MM_CFG command will reply with OK/ERROR. After a valid

MM_CFG keylength command, BC127 will reply OK and expect a raw list of 16bit values followed by carriage (\r). If the list is greater than 24 x 16 bits values, an additional \r has to be supplied after 24 x 16bits values are sent. Each carriage return will be replied to with an OK/ERROR if the operation is successfully. If more than the length words are supplied the overall operation will fail.

Controls the music stream state and sends AVRCP instructions

(PLAY, PAUSE, STOP, FORWARD

,

BACKWARD)

Returns the friendly name of device with the provided

Bluetooth address

Establishes a connection with a given Bluetooth address for a certain profile.

BT_addr: Bluetooth address formatted as 12 Hexadecimal digits with no separators (e.g.: 3859F9CCB893).

profile: Bluetooth profile. Can be: HFP, AGHFP, A2DP,

AVRCP, BLE, SPP, MAP

4

, HFP, PBAP

5

, HID or IAP. If profile is left blank, SPP will be assumed.

type (optional): Type of address

0 – public address

1 – random address

Note that type is only used for BLE connections. It corresponds to the type in the scan results.

Enter discoverable mode and attempt to pair with the device that has the Bluetooth address given as parameter (without opening any profile).

This function is used to respond to a SSP request.

Use type = 1 for a confirmation type and key = 1 to accept or key = 0 to reject the pairing.

Use type = 0 and followed by 6 digit passkey to confirm the pairing with your key.

Sets the specified PIO pin to the specified state.

- PIO: Output PIO pin index.

- State: ON to set (level high), OFF to reset (level low).

Before using this command, GPIO control must be disabled.

5

PBAB requires an active HFP connection.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 14 of 80

Melody 6.0.31

Melody 6.0.31

POWER (mode)

PB_PULL

(link_id)<repository><phonebook><max list><start index>

<filter>

6

PB_ABORT (link_id)

RESET

RESTORE

ROLE (devX)[role]

ROUTE (value/link_id)

OFF disconnects all active connections and puts the device in limbo mode, where it is not connectable, or discoverable. As a consequence, the UART commands that cannot be executed are rejected. ON returns the device to a connectable state.

Downloads the phonebook from the connected device. The default parameters are:

Repository: 1 = local to the device (uint8)

Phonebook: 1 = phonebook (uint8)

Max list: 0x1000 entries (uint16)

Start index: 0x0000 (uint16)

Filter: 0x0087 = version, name, full name and phone number

(uint16)

This command will send the downloaded phonebook in raw format to the host. Received data will be surrounded by:

PB_PULL_START <link_id> and PB_PULL_END <link_id>

When the download is finished or aborted the event

PB_PULL_OK <link_id> will be sent.

For the full description of the parameters, look at the PBAP section.

Aborts an active phonebook download.

By default, the PBAP profile will not be closed if an active download is in process.

Aborting the operation is required before closing the pbap profile.

Link_id is the PBAP link id in status

Resets the device

Resets and restores the configuration parameters to default factory settings.

Changes the classic connection role of the local device.

A notification will be sent if the new role is different from the current role.

devX: id(dev1, dev2...) of the remote device

role(optional):

M - Change the role of the local device to be the slave of the link.

S - Change the role of the local device to be the slave of the link.

If role is not provided, a notification will be sent with the current role of the local device.

Select which audio routing to apply. When an audio routing is applied, automatic-routing is disabled. You can re-enable the automatic-routing using the value 0 as parameter.

6

The phonebook download requires a baud rate of 115200 or above. Lower baud rates can cause the UART to stall and lose phonebook data

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 15 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

RSSI (link_id)

SCAN (timeout) [raw_data melody_filter]

SEND (link) (string)

SEND_RAW (link) (nb_bytes)

SET (config)=value

You can use either use a link_id (A2DP or HFP only) or the following values to route the audio stream:

0 – Enable automatic routing

1 – Analogue input to Analogue output

2

Digital interface to Analogue in/out

3

Digital Interface to Digital Interface

4– USB to Analogue in/out

5 – USB to Digital Interface

Note1: Routing an A2DP link is possible only if music is streaming. Routing an HFP link is only possible during a call. If the routing is not possible or already done an error is returned.

Note2: Upscalling/downscaling is not supported when routing the Digital interface to the Analogue interface. They both need to work at the same frequency.

Returns the receiver signal Strength of the link. -70dBm is a good link, -80dBm is a poor link

Searches BLE-enabled devices in the area for maximum period of time (given in seconds). raw_data and melody_filter are optional parameters. They are set to OFF if they are not provided. raw_data can be used to retrieve the raw advertising packets. melody_filter can be used to look only for Melody devices.

Following this command, a SCAN notification is received when an advertising device is found.

Please note that this command is only available when the device is configured in central mode.

Sends a string to a device through the specified profile.

The parameter link can be any active SPP, BLE link or iAP link.

Define the number of bytes that will be sent to the device through the specified profile.

The parameter link can be any active BLE, SPP, iAP or HID link.

After this command, the next nb_bytes received over UART are sent to the remote device.

Sets a new value to a configuration parameter.

SPEECH_REC (value)

The value can be ON or OFF to respectively activate and deactivate the Speech Recognition.

SSRD (size) (raw_data)

Set the scan response data. This is a manufacturer specific data blob. The first 2 bytes need to be Bluetooth SIG manufacturer ID to be SIG compliant.

Size – the size of the data in decimal (including company id).

Size must be <= 29. Size 0 with no additional arguments deletes

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 16 of 80

Melody 6.0.31

Melody 6.0.31 the current Scan response data

Raw_data – SIZE number of space separated ASCII represented unsigned octet values.

Structure is: [company_id LSB] [company_ID MSB]

[SIZE-2 data bytes in manufacturer determined order]

Eg. SSRD 8 01 23 45 67 89 AB CD EF

Please note that this function will return error if Melody is not configured in BLE Peripheral mode; for wrong size, or if the function cannot allocate size number of bytes when called.

STATUS (param)

TOGGLE_VR (link)

TONE

7

(flag) (value) (flag) (value)

If function successfully performs internal actions “PENDING” result will be returned, followed by an asynchronous “OK” or

“ERROR” status once the scan data registration request completes.

Please note that this function may be called at any time, and will overwrite any pre-existing registered scan response data.

Lists the device status for Classic and BLE:

STATUS (Classic status) (BLE status)

Where Classic status can be:

OFF, CONNECTABLE

DISCOVERABLE, CONNECTABLE, CONNECTED and BLE status can be:

OFF, IDLE, ADVERTISING, CONNECTED.

And Link status for established links in the format:

LINK (link id) CONNECTED (BT_Addr)

(Audio_Codec/AVRCP_State)

(if applicable)

Param can be any of the following:

- A link.

- A profile identifier. (SPP, HFP, A2DP…)

- A device identifier (RES, DEV0, DEV1, DEV2)

When param is supplied, the status command returns the relevant information associated to the value of param.

Start/Stop Voice call command on the phone.

The link provided must be an HFP link.

Plays a tone based on the input.

A tone must have at least 1 note.

A note must have a length parameter.

Please refer to Appendix B for full information regarding, flags,

7

Currently not supported over digital audio output.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 17 of 80

Melody 6.0.31

Melody 6.0.31

UNPAIR [addr]

VOLUME [link] [command]

VERSION

WRITE

Table 5: Command Mode Bluetooth Commands

accepted values and descriptions.

Flags :

Tempo TE 0 – 4095

Timbre TI 0 – 7

Volume V 0 – 255

Decay D 00 – FF(enter value in hex

8

)

Note N A – F + octave 0 – 9eg AF7, A7, AS7

Length L 1,2,4…64 or 3,6,12…96triplets

Please note that this command will return an error if you have used the ROUTE command to route the analog, digital or USB interface (ROUTE 1, 2, 3, 4 or 5).

If the Bluetooth address provided currently exists in the paired device list it is removed, otherwise the user is notified that the

Bluetooth address provided could not be found in the PDL.

If no parameters are provided, clears all of the Bluetooth addresses from the paired devices list.

When the VOLUME command is used with no parameters, it will lists the volumes of the ANALOG and A2DP, HFP and AGHFP profiles currently connected.

The parameter link can be any ANALOG, A2DP, HFP or AGHFP link that is currently routed. When a link is provided, a

command must be provided as well.

The parameter command can be any of the following:

- UP, increases the volume on the specified link by one.

- DOWN, decreases the volume on the specified link by one.

- An hexadecimal value between 0x00 and 0x0F, sets the volume on the specified link to the value specified.

If when increasing the volume the resulting volume is greater than the maximum volume allowed on the channel, the volume is fixed to the maximum level allowed. Similarly, when decreasing the volume, if the resulting volume is lower than the minimum volume allowed for the channel, the volume is fixed to the minimum volume allowed. These same rules apply when setting the volume to a specified value.

Returns information on the firmware version number and the

Bluetooth address of the device.

Store configurations.

8

Parsed as fixed point of the following format in binary bbbb.bbbb or hexadecimal X.X

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 18 of 80

Melody 6.0.31

Melody 6.0.31

Melody Configuration

The user can configure general parameters for the module. These parameters are stored in the RAM memory.

If required, the parameters can be stored to Flash memory. When the module reboots, it will boot with the parameters that are saved to Flash memory.

There are 4 main commands to configure parameters. The commands to modify configuration parameters are described below. Mandatory parameters are listed in "

( )

" optional parameters are listed in "[ ]".

Command

CONFIG

GET (config_name)

RESTORE

Description

Shows all parameters.

Reads the value of a configuration parameter.

settings.

Resets and restores the configuration parameters to default factory

Sets a new value to a configuration parameter.

SET (config_name)=param_1 param_2 …param_n

WRITE

Write configuration changes to Flash memory. This command writes all the current configuration parameters to non-volatile memory.

These are then read at boot-up time.

Table 6: General Configuration Commands

Note: If the module boots up with PIO_0 high, the factory default configurations are reset. This allows reverting to a known and working configuration state if severe problems are encountered.

The different configuration parameters are described in alphabetical order in the table below. Once modified, many configuration parameters will not take effect before a reboot. Therefore they need to be stored to Flash before rebooting.

Configuration Parameter Description Default

0

Require s

Reboot

Yes

AUDIO=(value)

AUDIO_ANALOG=(rate)(ga in)(def_vol)(micbias)( preamp)

Select the audio interface:

0 – Analog

1 – Digital

2 – USB

Configuration of the analog audio interface(AUDIO=0): rate: Value in Hertz between (39kHZ – 50kHz) gain: Input gain (0 – 31) def_vol: Default volume level (0 – 15) micbias: Enable mic bias (2.6V) pream: Enable microphone preamplifier

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

44100 15 10

ON OFF

Yes

Page 19 of 80

Melody 6.0.31

Melody 6.0.31

AUDIO_DIGITAL=(format)

(rate)(param1)(param2)

AUTOCONN=(value)

BATT_CONFIG=(status)(c ritLvl)(chrgLvl)(vthm_ max)(current)

BC_SMART_UUIDS=(srv_uu id)(char_uuid)

Configuration of the digital audio interface(AUDIO=1): format: digital output format

0 –I2S

1 – PCM

2 – SPDIF

Check the digital interface section in the Audio

Configuration chapter for more information about the rest of the parameters.

0 – Disabled

1 – Paired Device List.

Melody attempts to connect to previously paired devices at power on (see LIST command).

2– Remote address.

Melody attempts to connect to the device with the

Bluetooth address specified by the REMOTE_ADDR parameter at power on.

When autoconn is enabled and Melody is establishing a connection, it automatically connects all the other profiles that have been connected before. This also applies when using the OPEN command.

Note: Melody can store up to 8 paired devices in its persistent memory. When the pairing memory is full,

Melody erase the oldest paired device and keep the 8 most recently paired devices in memory.

Configures the battery charger and other settings related to the battery:

- status: ON to enable charging. Should be OFF when not using a battery.

- critLvl: Critical battery level. Device will shut off until charged above this level (in units of 20mV).

- chrgLvl: Charge voltage limit threshold. Charging will stop once the battery reaches this voltage (in mV).

- vthm_max: Thermistor voltage limit threshold.

Charging will stop once the thermistor reaches this voltage (in mV).

- current: Set the current for charging the battery in mA. Values should be in range 0-200 mA. If set to zero, charging is disabled.

Change the default value for Melody Smart primary service UUID and Melody Smart Data Characteristic

0 44100 64

100A00

0

OFF 145 4250

1500 150

68E3 28F0

89F7 D93C

Yes

Yes

Yes

Yes

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 20 of 80

Melody 6.0.31

Melody 6.0.31

BEACON_DATA=(data)

BLE_CONFIG=(role)[auto

_adv][indication][mtu]

[random_addr]

BLE_CONN_PARAM

CMD_TO=(value)

COD=(value)

CODEC=(value)

UUID.

Configure Beacon.

The first byte define the type of Beacon:

0- iBeacon

1- Eddystone UID

2- Eddystone URL

The following 21 bytes defines the Beacon parameters.

Refer to the BLE Beacon section for more info.

role: Set the BLE role of the device

0- Peripheral

1- Central

2- Beacon

auto_adv: Enable/Disable BLE constant advertisements when the device is not connected (only when BLE role is Peripheral)

indication: If ON, Melody Smart will use indications instead of notifications when configured as server (only when BLE role is Peripheral)

mtu: Maximum transmission unit (effectively maximum packet length)

random_addr: Generate a random address for BLE connections

Sets the BLE advertising, scanning and connection parameters. Refer to BLE Connection Parameters for more info.

Guard time for detecting a $$$$ command to switch from data mode to command mode. There should be

20ms x CMD_TO between the last character and the

$$$$. And there should be 20ms x CMD_TO after the

$$$$ for the command to be recognised.

Class of Device.

Some common examples of COD values are the following:

- 240404: Wearable Headset Device

- 200404: Audio headphones

The value specifies which A2DP optional codecs are enabled. bit[0] – AAC bit[1] – aptX bit[2] – aptX Low Latency

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

0 00 11 22 33

44 55 66 77

88 99 AA BB

CC DD EE FF

04 D2 16 2E

EE

0 OFF OFF 40

ON

128 12 6 40 0

400 50 400

400 64 400

400

20

240404

0

Yes

Yes

Yes

No

No

Yes

Page 21 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

CONN_TO=(value)

DEEP_SLEEP=(value)

DEVICE_ID=(word_1) …

(word_8)

DISCOVERABLE=(value)(t imeout)

Example: CODEC=3 (0b011) means aptX and AAC are enabled, aptX LL is disabled.

Note: SBC is always enabled. When optional codecs are enabled, the order of selection when establishing a stream is: aptX LL > aptX > AAC > SBC

Time Melody stays connectable (in seconds) after a connection has been established in Multipoint.

Values accepted: 0 – 65534.

0 – never stop being connectable;

Enable and Disable Deep Sleep

The Device ID sets the configuration parameters for the

Device ID Profile. This profile sets the following as an

SDP record so that remote devices can get extra information about the product:

Vendor Id source (2 bytes)

Vendor Id(2 bytes)

Product Id(2 bytes)

BCD version (2 bytes)

Software version (8 bytes)

For more information about these settings, refer to

Device ID profile specification on the Bluetooth.org adopted specification page

Configure the discoverable behaviour.

Mode: 0 - not discoverable after power on

1 - discoverable after connection failed

(including reconnection when auto-connect is enabled)

2 – discoverable after power on

Timeout: Pairing timeout in seconds. Zero to disable.

Enables and disables the iOS battery indication

9

0

OFF

0000 0000

0000 0000

0000 0000

0000 0000

2 0

No

No

Yes

Yes

ENABLE_BATT_IND=(value

)

ENABLE_CAPSENSE=(value

)

Enables and disables cap senses. When it is enabled,

CAPSENSE notification are received when the state of a pad changes.

Enables and disables GPIO control.

ON

OFF

No

Yes

ENABLE_GPIO_CONTROL=(v alue)

ENABLE_LED=(value)

ENABLE_SPP_SNIFF=(stat e)(min_interval)(max_i nterval)(attempt)(time

Enables and disables LED support in Melody

Enables SPP only connections to go into sniff mode which allows Melody to use low power modes. These values take effect if SPP is the only connected profile

ON

ON

Yes

No

OFF0 0 0 0 0 No

10

9

Due to iOS behaviour, this needs to be changed before initial Pairing to iOS device. Changing after that will not remove indicator on iOS.

10

Changing the sniff parameters require the connection to restart.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 22 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

out)[duration]

GPIO_ANALOG=(value)

HFP_CONFIG=(cvc)(wbs)( inband)(nrec)(comm) state:

OFF – active

ON – passive (if all parameters are 0)

– sniff with passive (with all parameters supplied)

Parameters:

min_interval: the minimum interval of the sniff period

max_interval: the maximum interval of the sniff period

attempt: Determines for how many slots the slave shall listen when the slave isnot treating this as a scatternet link.

Timeout: Determines for how many additional slots the slave shall listen whenthe slave is not treating this as a scatternet link.

Duration: the time to stay in this sniff state.

Configures the analog input detection pin. Value can be any of the following:

- 0 to 31: Pin 0 to 31.

- 254: Disabled.

- 255: Assume always connected.

The analog input detection pin is active low.

Configuration of the HFP and AGHFP profiles:

cvc: Enables or disables CVC (Clear Voice Capture).

wbs: Enables or disables Wide-Band Speech support.

inband: Enables or disables in-band ringing for incoming calls.

nrec: Sets the HFP NREC flag, which tells the AG not to use its internal Noise Reduction/Echo Canceller

254

OFF OFF OFF

OFF OFF algorithm. We suggest you set this to ON if using CVC or an external noise reduction platform.

comm: Enables or disables AT commands communications from the host.

Note: Whether Wide Band Speech is used or not depends on the result of the codec negotiation between the hands free device and the audio gateway device.

IAP_HIGH_SPEED=(value) Enable/Disable High Speed.

This feature can be used to speed up data transfer with

LOCAL_ADDR=(value

MAX_REC=(value)

11

)

MUSIC_MANAGER (enable)

[(user_eq_en) (bank)

iAP2 in Data mode. Please note that when it is enabled and the iAP link in Data mode, the audio is disabled.

Contains the local Bluetooth address of the device. -

Maximum times to try to reconnect to a device in PDL 2

Configure the Music Manager audio enhancements for

A2DP music streams. All configuration parameters

OFF

OFF OFF 0

OFF

11

Please note that value is a read only.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Yes

Yes

Yes

-

Yes

No

Page 23 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

(bass_boost_en)

(3d_enhance_en)

(compander_en)

(dither_en)

(speaker_eq_en)]

following MUSIC_MANAGER are ON or OFF except bank which is between 0 and 6. enable – mandatory, enable or disable MM

All subsequent parameters are optional but must be provided in order. i.e. if you want to modify (bass boos) you have to supply (user_eq_en) and (bank). user_eq_en – enable/disable the user equaliser block bank – set the equaliser bank to use when user equaliser is enabled. Available banks are 0 to 6. bass_boost_en – enable/disable the bass boost block

3d_enhance_en – enable/disable the 3D enhancement block compander_en – enable/disable the compander block dither_en – enable/disable the post processing/dither block speaker_eq_en – enable/disable the speaker equaliser block

Please note that these configurations only enable/disable music manager blocks. Those need to be configured use UFE, as specified by CSR.

Enables and disables AVRCP Meta Data

MUSIC_META_DATA=(value

)

MUSIC_OLD_AVRCP=(value

)

NAME=(value)

NAME_SHORT=(value)

PROFILES=(hfp)(aghfp)( a2dp_snk)(a2dp_src)(av rcp)(ble)(spp)(pbap)(h id_device)(hid_host)(m ap)(iAP)

Switch AVRCP version to 1.0. This will disable Meta

Data and Absolute volume support.

Name of the device (32 characters max). The last 5 symbols (“XXXXX”) are the last 6 symbols of the

Bluetooth address.

Short name (7 characters max) used for Melody Smart

Advertisements. The last 5 symbols (“XXXXX”) are the last 5 symbols of the Bluetooth address.

Configuration of the Bluetooth profiles.

The value for each profile indicates the maximum number of connections (up to 3).

Notes:

- It is not possible to have HFP and AGHFP at the same time. It means that one of the values must be 0. Same for A2DP Sink and A2DP Source.

- BLE is limited to a single connection in Peripheral mode and up to 3 in Central mode.

- It is not possible to have HID host and HID device in the same device.

- iAP is limited to a single connection.

12

OFFOFFOFFO

FF

OFF

OFF

BC-XXXXXX

BCXXXXX

2 0 2 0 2 1 2

1 0 0 1 0

No

Yes

Yes

Yes

Yes

12

Only on MFI builds. iAP1 and iAP2 protocols are available to Apple MFI Licensees. Please, contact

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 24 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

PIN=(value)

Pin Code

REMOTE_ADDR=(value)

Address of device to auto-connect to on reset. Works only if devices are paired. Will attempt MAX_REC times and then go discoverable

SPP_HIGH_SPEED=(value) Enables or disables high speed mode for SPP connections during data mode.

Note that when using this mode, the escape sequence

SSP_CAPS=(value)

is disabled, use the correct GPIO to exit from data mode instead.

Set the Secure Simple Pairing capabilities for this device. Accepted values are:

TWS_CONFIG=(autoconn)

(master) (slave)

0 – display only

1 – display yes/no

2 – keyboard only

3 – no display, no keyboard (i.e.JustWorks)

4 – display and keyboard

5 – reject SSP request

True Wireless Stereo configuration:

autoconn: if ON, connect automatically TWS after an

A2DP connection provided that there is there is a TWS present in the paired list and no other TWS device is already connected.

master/slave: Audio routing for a Master/Slave TWS device relaying/receiving audio in a TWS session.

UART_CONFIG=(baud)(flo w_ctrl)(parity)

USB_HOST=(value)

UUID_SPP=(value)

0 – stereo

1 – left channel

2 – right channel

3 – downmix

Note that the audio routing applied on both devices is the one configured on the master device.

By default, the master device is left and the slave is right.

UART configuration:

baud: UART Baud rate (9600, 19200, 38400, 57600,

115200, 230400, 460800, 921200).

flow_ctrl: Enable or disable flow control.

parity: UART Parity (0=none, 1=odd, 2=even).

Determine the host interface: value is ON for USB and OFF for UART.

Change the UUID for the SPP profile

0000

0

OFF

3

OFF 1 2

9600OFF 0

OFF

00 00 11 01

00 00 10 00

80 00 00 80

Melody 6.0.31

No

Yes

Yes

No

No

No Yes

No

Yes

Yes

BlueCreation for more information.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 25 of 80

Melody 6.0.31

VREG_ROLE=(value)

Changes behaviour of VREG button when held (3s press)

0 – Nothing

1 – Power On/Off

Table 7: Configuration Parameters and values

5F 9B 34 FB

0 No

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 26 of 80

Melody 6.0.31

Melody 6.0.31

Power management

Melody is configured to reduce the power consumption in both connected and not connected state.

Not Connected

By default, if Melody is not connected, it will be connectable and stays discoverable for a certain amount of time (configurable). If connection is lost, Melody will attempt to reconnect the number of times specified by the

MAX_REC parameter. After that, and if Deep Sleep is enabled, Melody will go into Deep sleep mode (a very low power consumption mode). In this mode Melody will not be discoverable or able to accept any connection.

This allows reducing current consumption to a minimum when the device is not connected and not operational.

In order for Melody to get out of this mode, a random character has to be sent through the UART. After a

20ms wake-up time the module will be operational again. If GPIO commands are enabled, any GPIO change will also get Melody out Deep Sleep.

Note: Waking Melody up will not disable Deep Sleep and the module will go back into Deep Sleep after the command is executed. It is recommended if Deep Sleep is enabled, to always send a carriage return before a command. This will not return anything if Melody wakes up from Deep Sleep and will return ERROR if Melody is already awake. After sending the carriage return, wait for 20ms (the chip wake-up time) and then send the command. The chip will stay awake for 1s after the last byte is received on the UART.

Connected:

When Melody is connected, it is set-up to reduce power consumption while maintaining the connection. In this state, Melody will automatically establish a link policy to allow it to reduce power consumption while still being able to receive link updates.

Note: If Deep Sleep is enabled, Melody will go into deep sleep after 50ms of no activity.

1. Battery configuration

The battery configuration is in BATT_CONFIG. The value of the charging current is configurable (between 0 and 200 mA) and three levels define the battery behavior.

- Vbat Battery Voltage:

When the voltage drops to the critical voltage (145*20=2900mV by default), Melody automatically shuts down to preserve remaining power.

- Vchg Threshold Voltage:

Melody will stop charging if the value is superior to this limit (4250mV by default).

- Vthm Thermistor Threshold Voltage:

The Vthm is on AIO1

13

input. Melody will not charge if the value is superior to this limit (1350mV by default).

13

Note that AIO readings saturate above 1.35V

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 27 of 80

Melody 6.0.31

Melody 6.0.31

PIO functionalities

PIOs have a different behaviour depending on the parameter ENABLE_GPIO_CONTROL which can be set to

ON or OFF.

1. GPIO control enabled

By default, GPIO control is enabled. It allows the module to work autonomously without the need of a host processor as in a wireless speaker for example. The table below lists the functionalities that are attributed to the PIOs. Please note that when in Multipoint, PIO controls will take effect on the active link.

GPIO

14

UART Equivalent Description

VREGEN single DISCOVERABLE ON

Melody will become discoverable.

VREGENlong if VREG_ROLE=0

nothing if VREG_ROLE=1

POWER ON/OFF

PIO_0 single VOLUME UP

PIO_1 single VOLUME DOWN

PIO_2 single

15

MUSIC PLAY/PAUSE or

CALL ANSWER/END

Depends on the configuration of VREG_ROLE.

Increases volume of the current link (HFP or A2DP).

Decreases volume of the current link (HFP and A2DP).

Starts playing music or stop playing music for A2DP

Source and Sink.

If there is an incoming HFP call it will answer the call.

During an ongoing call it will end the call.

PIO_2 long

15

CALL

If HFP is enabled, it will initiate a CALL (last number redial).

PIO_4 single MUSIC BACKWARD

Sends AVRCP instruction BACKWARD

PIO_5 single MUSIC FORWARD

Table 8: Command Mode General PIO Bluetooth Commands

Sends AVRCP instruction FORWARD (Next track)

Note: 'single' is defined as any press and release that happens within 50ms. 'long' is defined as holding the

PIO high for 1000ms. A repeated 'long' press will be detected if the PIO is held high for multiples of 1000ms.

14

Refer to BC127 Datasheet for location of PIO on the module pinout.

15

Only on non-MFI builds.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 28 of 80

Melody 6.0.31

Melody 6.0.31

2. GPIO control disabled

If PIO control is disabled PIO_0 and PIO_5 are used as the table below:

PIO Type Description

PIO_0 Output

High if Melody is connected (at least one profile opened, BLE or Classic).

PIO_5 Input

Low if Melody is not connected.

On a rising edge, all BLE, IAP and SPP connections enter Data mode

On a falling edge, all BLE, IAP and SPP connections enter Command mode

Table 9: PIO control and indication

3. Audio Enable PIO

On non-MFI builds, PIO 3 will go high during a call (active SCO) or when streaming music (A2DP). This can be used for example as an audio enable to an amplifier. This feature is not configurable.

4. Restoring the default configuration

If the module boots up with PIO_0 high, the factory default configurations are restored. This allows reverting to a known and working configuration state if severe problems are encountered. It is the equivalent of using the

RESTORE command.

5. Capacitive touch sensors

This features can be enabled or disabled with the parameter ENABLE_CAPSENSE (OFF by default). If enabled, CAPSENSE notifications are received to indicate when a change (press or release) occurs on any of the 6 pads.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 29 of 80

Melody 6.0.31

LED Indications

LEDs can be enabled or disabled easily by changing the parameter ENABLE_LED.

They are enabled by default and the indications are described in the following tables:

Classic State

Discoverable

Connected

Connectable

Table 10: LED Patterns Classic

LED pattern (repeating)

Fast Flash Toggle LED 0 and LED1

LED 1 flashes once approx 2.5s

LED 0 flashes once approx 2.5s

LED pattern (repeating)

LED 2 off

LED 2 blinks quickly

LED 2 flashes once approx 2.5s

Smart State

Idle/Off

Advertising

Connected

Table 11: LED Patterns Smart

Other states

Powering On

Powering Off

Off or DFU

Table 12: Other indications

LED pattern (once)

All LEDs ON for 1s

All LEDs quick blink 3 times

All LEDs OFF

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 30 of 80

Melody 6.0.31

Melody 6.0.31

Pairing and connection

1. Secure Simple Pairing capabilities

When discoverable, Melody will accept any pairing request from devices in range. By default Melody will use secure simple pairing (Bluetooth 2.1 and above). If the devices trying to pair are older (Bluetooth 2.0 and below), Melody will accept the older pairing procedure.

For Bluetooth 2.1 devices and newer Melody support different type of pairing (see SSP_CAPS configuration).

By default it will accept any pairing request using the ‘Just Works’ Bluetooth 2.1 method. This means that the module will accept any connection from Smartphones and other devices. The user of the device will not be required to enter a PIN code.

If SSP_CAPS is no set to 3, you might have to use the PASSKEY command to respond to a pairing request

For Bluetooth 2.0 devices and older Melody will require a PIN code to accept a connection. The PIN code is set to 0000 by default, but can be reconfigured. This means that the phone user will be required to enter the pin code in order to pair successfully.

2. Pairing commands

You can use the PAIR command to send a pairing request. A notification will be received

(PAIR_OK/PENDING/ERROR or PAIR_PASSKEY). When you pair with a device it is automatically added to the Paired Device List (PDL) that can be seen using the LIST command. Finally you can remove any device from your pairing list using the UNPAIR command.

3. Connection

Melody can be put in discoverable mode using the DISCOVERABLE command. It means it will be visible to other devices. To scan for discoverable devices, you can use the INQUIRY command.

When you have the Bluetooth address of the device you want to connect to, use the OPEN command to connect and open a Bluetooth profile. If you are not paired, Melody will automatically pair before connecting.

Note that there are a limited number of connections allowed per profile. This can be configured by setting up the PROFILES parameter. When a connection is established, an OPEN notification is received (see Event

Notifications). All connected devices are listed with their respective profiles when using the STATUS command. The CLOSE command can be used to disconnect the connected profiles.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 31 of 80

Melody 6.0.31

Melody 6.0.31

Audio configuration

Melody has different 3 types of audio interfaces that are configurable. To select an audio interface change the value of the AUDIO parameter (0: Analog, 1:Digital, 3:USB ).

1. Analog interface

The analog configuration is stored in the parameter AUDIO_ANALOG:

AUDIO_ANALOG = rate gain def_vol micbias preamp

rate: Value in Hertz between (39kHZ

– 50kHz). Used only with the ROUTE command, otherwise the

ADC and DAC adjust automatically the sampling rate (8/16kHz for HFP and 44.1/48kHz for A2DP connections).

gain: Input gain (0-31).

def_vol: Default volume level (0-15). def_vol is the volume used when establishing an A2DP or HFP connection for the first time with a device or when selecting the analogue interface with the ROUTE command. The volume can then be changed using the VOLUME command. When disconnecting and reconnecting, the current volume value is saved and restored.

Note that with devices using Absolute volume, this value is not used.

micbias: ON to activate the mic bias (2.6 V).

preamp: ON to enable the preamp.

2. Digital interface

The digital configuration of the digital audio interface is stored in the parameter AUDIO_DIGITAL:

AUDIO_DIGITAL = format rate param1 param2

format:

0 - I2S

1 - PCM

2 - SPDIF

rate: Word clock (WCLK) in hertz for I2S/ PCM or output rate for SPDIF. Please note that I2S supports re-sampling for HFP Narrow Band (8KHz) / Wide Band (16kHz) and for A2DP when the rate is superior or equal to 44100 Hz.

param1: Bit clock scaling factor for I2S. Master clock in kHz for PCM. Not used for SPDIFF.

param2: refer to the tables below. Depends on the format.

By default, I2S is selected and configured in Master mode, Left Justified with 1 Bit delay, 16 bps with a Word clock (WCLK) at 44100Hz and a Bit clock (BCLK) at 2.822Mhz (64*44100Hz).

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 32 of 80

Melody 6.0.31

Melody 6.0.31

Please note:

In Slave mode, due to hardware limitations, a Bit clock (BCLK) of at least 4*bps*WCLK and up to

256*WCLK must be supplied.

In Master mode we also recommend to generate a Bit clock of at least 4*bps*WCLK. The Bit clock scaling factor should be superior or equal to 4*bps.

The following tables describe param2 of the digital interface for each format:

I2S

[24:31] Not used.

[16:23] Bits per sample (bps). If larger than the internal format used by Melody, the additional bits will be output as zeros in the least significant bits.

[12:15] Not used.

[11]

Master mode - clock and sync will be generated by the I2S hardware.

[10]

Justify format - 0: left justified, 1: right justified.

[9]

Left justify delay - 0: left justified formats: 0 is MSB of SD data occurs in the first SCLK period following WS transition. 1: MSB of SD data occurs in the second SCLK period.

[8]

[7]

Channel polarity. Valid values: 0 (SD data is left channel when WS is high), 1 (SD data is right channel when WS is high).

Audio attenuation enable - 0: 17 bit SD data is rounded down to 16 bits. 1: the audio attenuation defined in Audio attenuation is applied over 24 and 20 bits of incoming data with saturated rounding.

Requires crop enable to be 0.

[5:6]

Audio attenuation in 6 dB steps. Valid range: 0 to 15 inclusive.

[3:4]

Justify resolution - Resolution of data on SD_IN, 00=16 bit, 01=20 bit, 10=24 bit, 11=Reserved.

This is required for right justified format and with left justified LSB first.

[2]

[1]

[0]

Crop enable 0: 17 bit SD_IN data is rounded down to 16 bits. 1: only the most significant 16 bits of data are received.

Start Tx sampling 0: during low wclk phase. 1: during high wclk phase.

Start Rx sampling 0: during low wclk phase. 1: during high wclk phase.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 33 of 80

Melody 6.0.31

Melody 6.0.31

PCM

[24:31] Not used.

[23]

Enable PCM master mode - clock and sync will be generated by the PCM hardware.

[22]

PCM slot count. Valid range 0 to 4 inclusive. If 0, slot count will be derived from master clock and synchronisation rate.

[21]

Enable PCM Manchester encoding mode.

[20]

Enable PCM short synchronisation - Short frame sync (falling edge indicates start of frame), rising edge indicates start of fame in long sync mode.

[19]

Enable PCM Manchester slave mode - Force transmit frames to follow receive frames with constant delay. Requires extended features to be enabled.

[18]

Enable PCM sign extend - Sign extend 13/8 bit sequence to 16 bit sequence, else pad with the

STREAM_PCM_AUDIO_GAIN for 13-bits or 0s for 8 bits.

[17]

Enable PCM LSB first - Transmit data LSB first.

[16]

Enable PCM Tx tristate - 0: drive PCM_OUT continuously. 1: tri-state PCM_OUT immediately after falling edge of PCM_CLK in the last bit of an active slot, assuming the next slot is not active.

[15]

Enable PCM Tx tristate rising edge - 0: tri-state PCM_OUT immediately after falling edge of

PCM_CLK in last bit of an active slot, assuming the next slot is also not active. 1: tri-state

PCM_OUT after rising edge of PCM_CLK.

[14]

Enable PCM synchronisation suppress - Suppress PCM_SYNC while generating PCM_CLK (in master mode). Some CODECs (connected to the PCM interface) use this to enter a low power state.

[13]

Enable PCM GCI mode.

[12]

Mute PCM_DATA output.

[11]

Enable PCM long length sync - Set PCM_SYNC to 8 or 16 PCM_CLK cycles.

[10]

Enable PCM sample rising edge - Sample PCM_DATA on rising edge of PCM_CLK

[7:9]

Rx rate delay - Selects the number of clocks to wait before receive DDS update rate is changed to match the new internal clock frequency. Valid range: 0 to 7 inclusive.

[5:6]

Sample format - Valid values: 0 (13 bits in 16 cycle slot duration), 1 (16 bits in 16 cycle slot duration), 2 (8 bits in 16 cycle slot duration), 3 (8 bits in 8 cycle slot duration).

[3:4]

Manchester receive offset - When in Manchester mode, selects the delay between receiving the start bit and sampling the first significant bit from the voice sample. Valid range: 0 to 3 inclusive

[0:2]

Audio gain. Valid range: 0 to 7. Used to pad the end 3 bits of a 13 bit PCM sample. It is used by

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 34 of 80

Melody 6.0.31 some CODECs (connected to the PCM interface) to allow their gain to be controlled.

SPDIF

[4:31]

Not used.

[3]

Set the reporting mode for the SPDIF Rx channel Status.

Set the SPDIF Tx channel B status same as that of channel A.

[2]

[1]

Set the SPDIF Tx channel status word value.

[0]

Set SPDIF RX in auto rate detect mode.

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 35 of 80

Melody 6.0.31

Melody 6.0.31

Bluetooth profiles

All the Bluetooth profiles can be enabled or disabled by changing the PROFILES configuration.

1. A2DP / AVRCP

A2DP(v1.3) and AVRCP(v1.6) profiles can be enabled by setting up their maximum number of connections in the parameter PROFILES. They can both have up to 3 connections. Please note that for A2DP, there are 2 values, one for the A2DP Sink role and one for the A2DP Source role. Only one A2DP role can be enabled at the time (i.e. Sink or Source). Two commands allow you to control the audio streams and select the one to route when there multiple devices connected. The VOLUME command can be used to adjust the volume for each link independently.

SBC is the codec used by default, additional codecs can be enabled with the CODEC configuration (note that aptX requires a license key).

Extra information related to a song (title, artist, album, genre...) can be displayed on the UART when metadata are enabled (MUSIC_META_DATA).

True Wireless Stereo

Melody 6 includes True Wireless Stereo (TWS) support. TWS allows two Melody boards to connect to each other and share audio that is being streamed to one of them. The Melody boards can be configured to be Left,

Right or Stereo channels (cf. TWS_CONFIG configuration). This allows the use case for True Wireless Stereo speakers over Bluetooth.

Figure 3- TWS connection between two melody boards

You can find TWS devices using the INQUIRY command with the TWS filter enabled andthen use the OPEN command to open the TWS connection (see TWS example).

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 36 of 80

Melody 6.0.31

Melody 6.0.31

2. AGHFP & HFP

The AGHFP/ HFP (v1.6) can be enabled in PROFILES. Melody allows up to 3 HFP connections or 2 AGHFP connections. The configuration for theses profiles is stored in HFP_CONFIG.

Melody 6 supports 4 codecs:

Narrow Band (8kHz)

Wide Band Speech (16kHz)

 cVc Narrow Band (8kHz)

 cVc Wide Band (16kHz)

Please note that the use of Clear Voice Capture (cVc), which is an algorithm provided by Cambridge Silicon

Radio (CSR) for echo and noise cancellation, requires a license key. Please contact [email protected] or your distributor for more information about cVc.

Use the CALL command to initiate, answer, reject or transfer calls on the AG or HF (see AGHFP & HFP

example).

During a call, if the analog interface is selected, the ADC/DAC will automatically adjust the sample rate; there is no need to modify the analog rate. When using the digital interface with I2S, Melody re-samples the audio if the required digital rate (WCLK) is superior or equal to 44100 Hz. Otherwise you need to match the sample rate of the codec (ie. 8kHz or 16 kHz).

Since the audio is a mono signal, the input is always taken on the left channel (Analog or Digital). The output is stereo (same signal copied on both left and right channel).

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 37 of 80

Melody 6.0.31

Melody 6.0.31

3. BLE

General BLE functionalities

Melody allows BLE connections. It supports two BLE roles: peripheral and central (see BLE_CONFIG).

The profiles available are BC Smart, BC Proximity and PXP profile.

Peripheral:

When Melody is in Peripheral mode (role=0), the ADVERTISING command can be used to start / stop advertising. The advertisement data include a name (NAME_SHORT) and the UUID of the BC Smart service

(BC_SMART_UUIDS). Note that if Melody uses a random address it will not advertise as a Dual Mode device.

The scan response can also be set using the SSRD command. Melody can connect to only one central device.

Central :

In Central mode, you can use the SCAN command to look for advertising devices and the OPEN command to establish a connection. Melody can connect up to 3 peripheral devices. Note that when you try to connect to a device that uses a random address (see "type" in the scan result) you need to provide the optional parameter of the command to indicate the type of the address (by default it is public address). A set of generic BLE commands (starting by "BLE_") gives the possibility once connected to a peripheral device to retrieves the list

of all its services and characteristics and to read or write their values. See BLE central example .

Beacon:

Different types of Beacons are supported: iBeacon, Eddystone UID and Eddystone URL. The type of Beacon

and its parameters are set in BEACON_DATA (See Beacon example ). Just like with the Peripheral role, the

ADVERTISING command can be used to start / stop advertising.

iBeacon

Eddystone-UID

Eddystone-URL

0

1

2

ProximityUUID

(16 bytes)

Namespace

(10 bytes)

Tx Power

(1 byte)

BEACON_DATA

Major

(2 bytes)

Instance

(6 bytes)

Prefix

(1 bytes)

Minor

(2 bytes)

Tx Power

(1 byte)

Tx Power

(1 byte) unused

(4 bytes) encoded URL

(17 bytes)

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 38 of 80

Melody 6.0.31

Melody 6.0.31

Connection parameters

The BLE connections parameters can be modified by changing the values in the parameter

BLE_CONN_PARAM. Theses parameters are used by Melody to set the following:

- Advertising parameters. This will control how Melody advertises (fast advertisements or slow advertisements). While fast advertisements allow remote devices to see and connect to melody faster (melody will be consuming more power), slow advertisements will reduce the power consumption and make the scanning and connection slower.

- Scanning parameters. This will control melody scanning intervals. As in advertising, fast scanning will find more devices with higher power consumption, and slow scanning will require more time to find the required device, but with lower power consumption.

- Connection parameters. Once a BLE link is established, the connection parameters control how often and quick the data transfer is. For example to achieve a higher data rate or lower the power consumption.

The parameters are the following:

scan_interval: The time interval from when BC-127 started its last LE scan until it begins the subsequent LE scan.

scan_window: Amount of time for the duration of the LE scan. LE Scan Window shall be less than or equal to LE Scan Interval.

conn_interval_min: Minimum value for the connection event interval. This shall be less than or equal to Connection Interval Max.

conn_interval_max: Maximum value for the connection event interval. This shall be greater than or equal to Connection Interval Min.

conn_latency: Slave latency for the connection in number of connection events.

supervision_timeout: The timeout before disconnecting when no communication is present on the lower layers.

conn_attempt_timeout: Time to wait for connection to be fully established. Changing this value can reduce the number of successful connection.

adv_interval_min: Minimum advertising interval for non-directed advertising. (Melody does not support directed advertisements)

adv_interval_max: Maximum advertising interval for non-directed advertising.

conn_latency_max: Maximum allowed slave latency

supervision_timeout_min: Minimum allowed supervision timeout. The minimum allowed supervision timeout that is accepted if slave requests connection parameter update once connected.

supervision_timeout_max: Maximum allowed supervision timeout. The maximum allowed supervision timeout that is accepted if slave requests connection parameter update once connected.

BC Smart service

The BC Smart service can be used to send easily data and commands over BLE. See BC Smart example .

The UUIDs of the BC Smart service and its Data characteristic are store in the parameter

BC_SMART_UUIDS.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 39 of 80

Melody 6.0.31

Melody 6.0.31

4. HID

The HID profile is a generic implementation of HID, this gives better control of the HID capabilities and the supported hid descriptors.

HID host will connect to any HID device, and to identify the HID device, it is possible to use

HID_READ {BD ADDR} command to read the HID descriptor of the remote device.

In HID device mode, Melody starts with the default descriptor. The default descriptor is for a simple keyboard without any extra keys (e.g. media keys).

To modify the descriptor, the HID_DESC {size} command should be used.

>DESC {size}

> {binary data}

Size is the number of octets of binary data following. Make sure you set the descriptor before opening the HID connection.

The

When HID reports are received over hid, an event will be received:

> RECV HID {size} {data}

Size is the number of octets of binary data following. Melody simply outputs the received data without processing. It is the responsibility of the host to handle it.

To send data:

>SEND {link id} {size}

> {binary data}

"link id" is the id of the HID connection (can be retrieved by sending STATUS command). "size" is the length of binary data to send. Similarly to receive data, any data sent is not parsed or processed by Melody, only sent to the remote device.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 40 of 80

Melody 6.0.31

Melody 6.0.31

5. iAP

This profile is only on MFI builds. iAP1 and iAP2 protocols are available to Apple MFI Licensees.

Contact BlueCreation for more information.

Please refer to the iAP Application Note to configure iAP.

Once configured it is possible to open the iAP profile and send data using the SEND command.

It is also possible to send data in Data mode (see Operating Modes ). Note that in Data mode, transfer can be

significantly faster with iAP2 when using the High Speed feature (IAP_HIGH_SPEED config).

The IAP_APP_REQ command can be used to send a request to open a application.

6. MAP

Melody 6 includes a generic access to receiving messages over MAP(v1.1) profile. When MAP is connected, a notification service is registered and the phone notifies Melody when a new message is arrived.

When notified, Melody notifies the host with the following event:

MAP_NEW_SMS [link id]

After receiving the notification the full message will be received and passed on to the host without any modification. The full message is surrounded with

MAP_MSG_BEGIN [link id]

And

MAP_MSG_ENG [link Id]

Note that in cases where a message is big, it can arrive inside multiple MAP_MSG_BEGIN and

MSP_MSG_END events, and in this case, different events might come between the different MAP messages.

When using MAP with an iOS device, iOS requires the user to enable notification for the paired device from the Bluetooth menu.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 41 of 80

Melody 6.0.31

Melody 6.0.31

7. PBAP

Melody 6 includes a generic access to downloading the phonebook with PBAP(v1.1.1). To download the phonebook the following command can be used.

PB_PULL (link_id) [repository] [phonebook] [max_list] [start] [filter]

LINK ID

Melody PBAP link id, this will be 16, 26, 36, etc., and it be retrieved from the STATUS command.

REPOSITORY

Value Description

0 Not used, will default to 1

1

2

Local repository: the phonebook will be retrieved from the phones local memory

Sim repository: the phonebook will be retrieved from the SIM card

3 Any: the phone will select which repository to select.

PHONEBOOK

Value Description

0 Not used, will default to 1

1

2

3

Main Phonebook folder

Incoming calls history

Outgoing calls history

4

5

MAX LIST

Missed calls history

Combined call history:

The maximum number of entries to download from the remote device. If the remote device number of entries is lower than MAX LIST, then the download will finish.

START

The index of the entry to start download from. To download the whole phonebook, this should be set to 0.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 42 of 80

Melody 6.0.31

Melody 6.0.31

FILTER

The filter defines what information to download. The filter is a 32 bit value where each bit represents a phonebook entry attribute (bits 29-31 are ignored).

TEL

EMAIL

MAILER

TZ

GEO

TITLE

ROLE

LOGO

Name

VERSION

FN

N

PHOTO

DAY

ADR

LABEL

AGENT

ORG

NOTE

REV

SOUND

URL

UID

KEY

11

12

13

14

7

8

9

10

5

6

3

4

1

2

Bit

0

19

20

21

22

15

16

17

18

Description

vCard Version

Formatted Name

Structured Presentation of Name

Associated Image or Photo

Birthday

Delivery Address

Delivery

Telephone Number

Electronic Mail Address

Electronic Mail

Time Zone

Geographic Position

Job

Role within the Organization

Organization Logo vCard of Person Representing

Name of Organization

Comments

Revision

Pronunciation of Name

Uniform Resource Locator

Unique ID

Public Encryption Key

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 43 of 80

Melody 6.0.31

23

Melody 6.0.31

NICKNAME

24

25

26

27

28

Nickname

Categories CATEGORIES

PROID Product ID

Class information CLASS

SORT-STRING String used for sorting operations

X-IRMC-CALL-DATETIME Time stamp

Mandatory attributes that should be enabled all the time are:

VERSION, N, and TEL.

Melody defaults are:

VERSION, N, FN, TEL which from the table are bits 0, 1, 2, and 7. This turns into 135 decimal, 0x87 hex or

10000111 binary.

Note that the phonebook download requires a baud rate of 115200 or above. Lower baud rates can cause the

UART to stall and lose phonebook data.

8. SPP

The SPP(v1.1) profile emulates a serial cable to provide a simple substitute for existing RS-232.

It is possible to open up to two SPP connections.

Once connected, you can send data using the SEND or SEND_RAW commands or you can enter in Data

mode and everything that will be received over UART will be transferred seamlessly (see Operating Modes ).

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 44 of 80

Melody 6.0.31

Melody 6.0.31

Features

1. Speech Recognition

Speech Recognition can be activated / deactivated with the SPEECH_REC command.

When it is ON, notifications are sent when a "YES" or a "NO

” is detected on the mic input. You can use theses notifications to trigger actions such as answering or rejecting a phone call.

Note that the Speech Recognition has a highest audio priority. It means that during a call or when music is being streamed the audio won't come out while the Speech Recognition is active.

2. Device Firmware Upgrade

Melody support firmware upgrade. This can be done over UART from your PC using the Melody Device

Firmware Upgrade Tool available on our website. Please contact [email protected]

for more details.

You can use DFU to upgrade to a newer version of Melody and get additional features.

The DFU command can also be used to enter DFU mode.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 45 of 80

Melody 6.0.31

Melody 6.0.31

Appendix A: Event Notifications

Melody uses

‘notifications’, or text prompts, to notify the host of events in the Bluetooth link (for example, completed commands or incoming connections), to provide information, or to require action. Notifications are generated only when Melody is in command or remote configuration mode.

The syntax used is

NOTIFICATION [link_ID](Parameter).

Event

A2DP_STEAM_START [link_ID]

Description

Indicates that the A2DP media stream has been opened. One or more of these messages may be displayed when the remote or local side has requested the A2DP media channel state to change. Please note that an open media stream does not guarantee that there is an active music stream.

A2DP_STEAM_SUSPEND [link_ID]

Indicates that the A2DP media stream has been suspended. One or more of these messages may be displayed when the remote or local side has requested the A2DP media channel state to change. Please note that an a media stream suspend may come sometime after the active music stream has ended, or depending on phone implementation, may not come at all.

ABS_VOL [link_ID](value)

The current absolute volume set as an integer in the range 0 – 127

(representing 0 – 100% as per spec).

AT [link_ID] (length) (data)

Indicates that the remote device sent an AT command or AT reply. The

AVRCP_MEDIA

[link_ID](property: value)

reply is sent over UART as is without modification. The length indicates the length of the data.

ARTIST: string

TITLE: string

ALBUM: string

NUMBER: integer

TOTAL_NUMBER: integer

PLAYING_TIME(MS): integer

AVRCP_PLAY [link_ID]

AVRCP_STOP [link_ID]

AVRCP_PAUSE [link_ID]

AVRCP_FORWARD [link_ID]

When an AVRCP play event is received from the remote device

When an AVRCP stop event is received from the remote device

When an AVRCP pause event is received from the remote device

When an AVRCP forward event is received from the remote device

AVRCP_BACKWARD [link_ID]

BC_SMART PROX (value)

When an AVRCP backward event is received from the remote device

BC Smart Proximity Service indicates that this is the closest (1) or not (0) device. If an indication of 0 is received the remote side may disconnect.

BLE_NOTIF link_ID [handle] size data

Notification received on the specified link. Size is a decimal value. The data received and the handle are in hexadecimal.

CALL_ACTIVE AGHFP [link_ID]

CALL_ACTIVE HFP [link_ID]

Notifies that there is an active call on the specified AGHFP link.

Notifies an active call on the specified HFP link.

CALL_DIAL AGHFP [link_ID]

(number)

Notifies that the HFP connected with the AGHFP on the link specified wants to establish an outgoing call to the number specified.

CALL_END AGHFP [link_ID]

CALL_IDLE HFP [link_ID]

Notifies that a call termination on the AGHFP link specified.

Notifies that there are no outgoing, incoming or active calls on the HFP link specified.

CALL_INCOMING AGHFP [link_ID]

Notifies that there is an incoming call procedure on the AGHFP link specified.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 46 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

CALL_INCOMING HFP [link_ID]

Notifies that there is an incoming call procedure on the HFP link specified.

CALL_MEMORY AGHFP [link_ID]

(mem_string)

Notifies that the HF connected to the AGHFP on the link specified wants to establish an outgoing call using memory dialling with the memory string specified. The memory string is AG specific.

CALL_OUTGOING AGHFP [link_ID]

Notifies that there is an outgoing call procedure on the AGHFP link specified.

CALL_OUTGOING HFP [link_ID]

Notifies that there is an outgoing call procedure on the HFP link specified.

CALL_REDIAL AGHFP [link_ID]

Notifies that the HF connected to the AGHFP link specified wants to

CAPSENSE (PAD) (DIRECTION)

establish a call to the last number dialled.

Notifies when a cap sense pad has changed. PAD can be 0-5 and

DIRECTION is UP when pressing the pad or DOWN when releasing it.

CHARGING IN PROGRESS

CHARGING COMPLETE

CHARGER DISCONNECTED

CLOSE_ERROR (profile)

[link_ID]

CVC_CFG (TYPE)(KEY)[value]

The charger is currently charging the battery.

The battery is charged and the charger is in standby mode.

The charger has been disconnected.

A connection could not be closed for the profile indicated.

DMTF AGHFP [link_ID] (code)

ERROR 0xXXXX

TYPE – WB or NB for wideband and narrowband CVC keys.

KEY is the key id 0 – 3;

Value – is the key value in ASCII representation of 16bit hexadecimal words. Value will not be present if the key is empty.

The HF connected to the AGHFP on the link specified requests the AGHFP to send the following DTMF code to the network.

An error with a code is returned when a command has not been

INBAND_RING AGHFP[link_ID]

INQUIRY(BDADDR)(NAME)(COD)

(RSSI)

executed or the parameters are not correct. You can refer to the error codes in the appendix to find out more about the issue.

Ring indicator received periodically when there is an incoming call.

Returned after an INQUIRY command is used if there are discoverable devices nearby. Returns Bluetooth address, name, class of device and

RSSI

LINK_LOSS [link_ID]

This notification indicates the link with which link loss has occurred.

MAP_NEW_SMS [link_ID]

Notifies that a new SMS has been received on the link.

MAP_MSG_BEGIN [link_ID]

Returned when a message data is going to be sent to the host

MAP_MSG_END [link_ID]

Returned when a message data was completely sent to the host

NAME [addr] [remote_name]

Returned the BT address and the name of a remote device in response to a NAME command.

OPEN_ERROR (profile)

[link_ID]

OPEN_OK (profile) [link_ID]

PAIR_ERROR (Bluetooth address)

PAIR_OK (Bluetooth address)

A connection has failed or there was a link loss for the profile indicated

A connection has been successfully established for the profile indicated

When the module fails to pair with the remote device with the address specified

When the module successfully pairs with the remote device with the

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 47 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

PAIR_PASSKEY (BDADDRESS)

(TYPE) [PASSKEY]

PAIR_PENDING

PB_PULL_START [link_ID]

PB_PULL_END [link_ID]

PB_PULL_OK

PXP IMM (level)

PXP LLA (level)

SCAN (BT ADDRESS)(TYPE)(<BT

SHORT NAME> (ADVERTISING

FLAGS) (RSSI)

address specified

A SSP passkey request is being made. Depending on type these may require user action.

TYPE:

0 – Passkey request. Enter passkey using the PASSKEY command

1 – Confirm passkey. Display passkey and have user confirm passkey using the PASSKEY command

2 – Display passkey. Display passkey for user.

Note: the PASSKEY parameter will not be supplied for type 0.

When the module is starting to pair with a remote device

Returned when a phonebook data is going to be sent to the host

Returned when a phonebook data was completely sent to the host

Returned when the phonebook download has been completed or aborted

Proximity Profile, Immediate Alert Service alert level set to:

0 – No Alert; 1- Mild Alert, 2 – High Alert

Proximity Profile, Link Loss Service alert level set to:

0 – No Alert; 1- Mild Alert, 2 – High Alert

Melody is ready to take commands

“YES” has been detected with Speech Recognition

“NO” has been detected with Speech Recognition

An unrecognised word has been detected with Speech Recognition

Data received from a BLE, HID, IAP or SPP link.

READY

SR: YES

SR: NO

SR: Unrecognised word

RECV [link_ID] (size) (report data)

ROLE (BT ADDRESS)<role>

ROLE_OK <role>

ROLE_NOT_ALLOWED <role>

SCAN_RAW (BT ADDRESS) (RSSI)

(size) (data)

SCO_OPEN (link_ID)

When the remove device changes the classic role, an indication event will be sent to the host with the remote device request a role change.

Successful change of the classic role when the ROLE command was sent by the host.

Failure to change the classic role. This is reached when the remote device refuses the role change requested by the host.

Returned after calling SCAN and contains information about advertising devices.

Type is 0 when the address is public and 1 when it is a randomly generated address.

If the advertising data does not contain a short name, UNKNOWN will be displayed.

The Advertising flags indicate device capabilities: 0x0A indicated this is a

General Discoverable Dual Mode device (such as Melody), 0x02 indicates this is a General Discoverable Single mode device (such as Melody

Smart).

Returned after calling SCAN with the parameter raw_data ON. size is the length of the advertising data in decimal. data is the advertising data, in hexadecimal.

A SCO connection has been opened and audio is routed.

SCO_CLOSE (link_ID)

A SCO connection has been closed and audio is no longer routed.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 48 of 80

Melody 6.0.31

Melody 6.0.31

Table 13: Melody Notifications

Appendix B: Tone parameters and flags

Tones are defined as a sequence of notes described with pitch (N or TN) described through length (L), tempo

(TE), loudness (V), timbre (TI) and decay (D). All of these parameters can be individually set for each note, changed at any place in the tone string or omitted (all except length) to use default values. Below you can find tables describing the different parameters and the flags used to set them and the values accepted.

Parameter

Tempo

Timbre

Flag

TE

TI

Accepted value and meaning

0 – 4095

Given in quarter notes (crotches) per minute. If no tempo is specified, default is 120.

0 – 7

Defines timber of following notes. Please see Table 9 for all available timbres. Default is 0 (Sine).

Volume V

0 – 255

Sets the volume for the tone. Default is 255 (max).

Decay D

00 – FF

Takes a hexadecimal values that is interpreted as a fixed point decimal number according to this format 0000.0000. Eg 15 = 1.5.

As each tone is played, its volume decreases with a variable rate.

Low values for this parameter cause notes to decay very quickly, whereas high values cause the notes to continue with an almost constant volume.

A value of 005 (meaning 0.5) will cause each note to reach zero halfway through its duration giving a staccato feel.

A value of 20 (meaning 2.0) will cause each note to reach half its initial volume when the next note starts.

The default value is 20. This allows notes of the same length to be tied together with TN.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 49 of 80

Melody 6.0.31

Melody 6.0.31

Note N

This describes a note pitch in the format:

Note{F/S}[octave]

Note is any note in A – G or R. R is used for a rest or pause. It has to be described for consistency with an octave eg R0.

The optional F or S following that indicates if the note is Flat or

Sharp. Note, not all notes have flat and sharp variants.

The mandatory octave parameter gives the note octave. It takes values between 0 – 9.

A note is describes as G4 or AS7 for example.

Each note must have a length parameter associated with it and following immediately after:

G4 L 1

Tied Note

Length

TN

L

Table 14: TONE parameter detailed description

Ties note to next one. This means that the pitch of the note appears to change (as opposed to a new note starting), and the volume continues to decay from the previous note. An appropriate decay must be set for this to work.

Tied Notes are described in the same manner as Notes.

Ringtone duration.

Please look at Table 10 for details.

Table 15: Timbre value and description

Length Values UK Notation

1 Semibreve

2 Minim

4 Crotchet

8 Quaver

16 Semiquaver

32 Demisemiquaver

American Notation

Whole note

Half note

Quarter note

Eighth note

Sixteenth note

Thirty-second note

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 50 of 80

Melody 6.0.31

64 Hemidemisemiquaver

3 Minim triplet

6 Crotchet triplet

12 Quaver triplet

24 Semiquaver triplet

48 Demisemiquaver triplet

96 Hemidemisemiquaver triplet

Table 16: Note length values and description

Sixty-forth note

Half note triplet

Quarter note triplet

Eighth note triplet

Sixteenth note triplet

Thirty-second note triplet

Sixty-forth note triplet

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 51 of 80

Melody 6.0.31

Appendix C: Examples

These are some typical use case example.

In every one of them we assume that the pairing list is empty and the configuration is the default one.

> UNPAIR

>OK

> RESTORE

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 52 of 80

Melody 6.0.31

Melody 6.0.31

1. Pairing and connection with Melody

Discovering Melody from a phone and initiating paring:

Use the STATUS command to make sure that Melody is discoverable, if it is not the case you can use the

DISCOVERABLE command:

> DISCOVERABLE ON

>OK

> STATUS

>STATE CONNECTABLE DISCOVERABLE

Now look for devices from your mobile phone. Your device should appear with the configured name (see

NAME parameter). Select and initiate pairing with Melody. This should automatically connect the phone to

Melody with all available profiles.

Melody will respond with a status OPEN_OK/OPEN_ERROR for each opened profiles.

Discovering a phone from Melody and connect to it:

Make sure Bluetooth is ON and your phone is discoverable if you want to it to be visible to Melody.

Use the INQUIRY command to look for discoverable devices. Melody will return a list of discoverable device:

When you find the correct device, take note of its Bluetooth address and use the OPEN command to connect to the device. Melody will respond with a status OPEN_OK/OPEN_ERROR for each opened profiles.

> INQUIRY 10

>INQUIRY {BT ADDRESS}{NAME}{DEVICE CLASS}{RSSI}

> OPEN {BT ADDRESS} {PROFILE}

>PAIR_PENDING

>PAIR_OK {BT ADDRESS}

>OPEN_OK 10 A2DP

Please note that if you want to connect Melody to a new device, Melody will go automatically in discoverable mode to be able to pair with the new device. Once paired, the device will be added to paired device list (use

LIST command to see it) and Melody will be able to connect directly to it.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 53 of 80

Melody 6.0.31

Melody 6.0.31

2. SPP

The following section describes a typical use case for an SPP connection. In this example, we create a SPP connection between two Melody devices to show some of the capabilities of the SPP profile from the transmitter and receiver side.

First you must assure that the SPP profile is enabled on both devices:

Melody SPP Device One

// Enable SPP

> SET PROFILES=X X X X X X 1 X X X X X

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

Melody SPP Device Two

// Enable SPP

> SET PROFILES=X X X X X X 1 X X X X X

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

The next step is to create an SPP connection, in this example, the OPEN command is used:

Melody SPP Device One

//Start connection

> OPEN {BT ADDRESS} SPP

>OPEN_OK 15SPP

Melody SPP Device Two

//Accepts connection

>OPEN_OK 15 SPP

We can type status on both devices to see the details of the SPP connection:

Melody SPP Device One Melody SPP Device Two

//Get connection details

> STATUS

>LINK 15 CONNECTED SPP {BT ADDRESS}

COMMAND

//Get connection details

> STATUS

>LINK 15 CONNECTED SPP {BT ADDRESS}

COMMAND

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 54 of 80

Melody 6.0.31

Melody 6.0.31

So, in both devices, we are in command mode. In this mode, we can use the SEND command as follows to send a string from device one to device two:

Melody SPP Device One

//Sends a string to device two.

> SEND 15 Hi, I’m device one.

>OK

Melody SPP Device Two

//Device two prints a notification with the SPP link, the length of the received data and the data.

>RECV 15 19 Hi, I’m device one. or we can use the SEND_RAW command to transfer a specified number of bytes:

Melody SPP Device One Melody SPP Device Two

// Use the SEND command to send 20 bytes of data through the SPP connection.

> SEND_RAW 15 20

>OK

// The next 20 bytes we send through the UART interface, will be sent through the SPP connection to device two.

>012345678901234567890

// Device one has already received 20 characters, so send to the data to device two.

// Do nothing in device two.

// Do nothing in device two.

// Device two receives the 20 bytes.

>RECV 15 20 01234567890123456789

If device two is in command mode, we can also execute commands in device two from device one, by sending the command we want to execute through the SPP connection. This is currently not supported for all commands.

Melody SPP Device One Melody SPP Device Two

// Execute the status command in device two and obtain the results.

> SEND_RAW 15 7

>OK

// Send the status command, <CR> is the carriage return character.

// Do nothing in device two.

//Device two, which is in command mode, receives the status command and

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 55 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

>STATUS<CR>

// Device one prints the results from executing the status command in device two.

>RECV 15 15 STATE CONNECTED

>RECV 15 4 OFF

>RECV 15 54 LINK 15 CONNECTED

{BT_ADDRESS} COMMAND STRING

executes it, then it sends the results through the SPP connection.

// Do nothing in device two.

Now we will use data mode in device one, but first the user must assure that hardware flow control in the

UART interface is enabled.

Melody SPP Device One Melody SPP Device Two

// Get the UART configuration, which shows that HW flow control is enabled.

> GET UART_CONFIG

>UART_CONFIG=9600 ON 0

// Do nothing in device two.

When data mode is enabled, data received from the UART interface is sent through the SPP interface with no additional parsing, and, similarly, data received from the SPP connection is sent through the UART interface.

Melody SPP Device One Melody SPP Device Two

// Enable data mode.

> ENTER_DATA_MODE 15

>OK

//Data received from the UART interface is immediately sent through the SPP connection.

> Hi I’m device one.

// Data received from the SPP connection is immediately sent through the UART.

>

Hi, I’m device two.

// Do nothing in device two.

// Device two receives the data sent from device one.

>RECV 15 1 H

>RECV 15 18 I, I’m device one.

// Send something from device two to device one.

> SEND 15 Hi, I’m device two.

>OK

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 56 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

To exit from data mode, you can use the escape sequence:

Melody SPP Device One Melody SPP Device Two

// Follow the procedure to exit from data mode using the escape sequence.

> $$$$

>OK

// Device two is no longer in data mode.

// Do nothing in device two.

// Do nothing in device two.

Finally, you can use the CLOSE command to terminate an SPP connection, in this example, we will use the close command in device one:

Melody SPP Device One Melody SPP Device Two

// Follow the procedure to exit from data mode using the escape sequence.

> CLOSE 15

>CLOSE_OK 15 SPP

//Device two confirms that the SPP has closed successfully.

>CLOSE_OK 15 SPP

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 57 of 80

Melody 6.0.31

Melody 6.0.31

3. AGHFP & HFP

In this section we will connect two Melody devices to show some of the capabilities of the HFP profile.The examples in this section assume that wideband and in-band ringing is enabled, although they are also applicable for other scenarios.

First, we enable AGHFP in the device acting as an Audio Gateway and HFP in the device acting as a handsfree device, using the profiles configuration.

Melody AG Melody HF

// Enable HFP

> SET PROFILES=0 1 X X X X X X X X X X

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

// Enable AGHFP

>

>

>

SET PROFILES=1 0 X X X X X X X X X X

>OK

WRITE

>OK

RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.10

>Build: 1443202002

>Ready

The next step is to create an HFP connection between the two devices, we can achieve this in two different ways, either from the device with the HFP profile enabled opening a HFP connection or from the device with the AGHFP enabled opening an AGHFP connection. In this example, we create a connection from the AGHFP device: TODO: HFP codec variable only updates after an audio connection .

Melody AG Melody HF

//Open a connection from the AGHFP.

> OPEN {BT ADDRESS} AGHFP

>PENDING

successful // AGHFP connection. confirms

>OPEN_OK 12 AGHFP

//Status shows the connection.

> STATUS

>LINK 12 CONNECTED AGHFP {BT ADDRESS}

WB

//HFP is receiving a connection request.

// HFP confirms successful connection.

>OPEN_OK 12 HFP

//Status shows the connection.

> STATUS

>LINK 12 CONNECTED HFP {BT ADDRESS} NB

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 58 of 80

Melody 6.0.31

Melody 6.0.31

From the HFP side, we can notify the AGHFP that we want to establish an outgoing call using the CALL command as follows:

Melody AG Melody HF

// The AG receives notification.

>CALL_REDIAL AGHFP 12

the redial

// The AG receives the call notification along with the memory string.

>CALL_MEMORY AGHFP 12 {MEMORY STRING}

// The AG receives the call notification along with the number.

>CALL_DIAL AGHFP 12 {NUMBER}

// Notify the AG that we want to establish an outgoing call with the last number dialed.

> CALL 13 REDIAL

>OK

// Notify the AG that the HF wants to establish an outgoing call using the following memory string.

> CALL 13 MEMORY {MEMORY STRING}

>OK

// Notify the AG that the HF wants to establish an outgoing call to the following number.

> CALL 13 OUTGOING {NUMBER}

>OK

To initiate an incoming call procedure, we use the CALL command in the AG side:

Melody AG Melody HF

// Start an incoming call procedure.

> CALL 12 INCOMING {NUMBER}

>OK

// We receive the notification that an incoming call is in process.

>CALL_INCOMING AGHFP 12

// Since we have in-band ringing enabled and this is an incoming call, we get periodic in-band ringing notifications.

>INBAND_RING AGHFP 12

//Do nothing in the HF device.

// Receive the notification in the HF side indicating that an incoming call is in progress.

>CALL_INCOMING HFP 13

At this point, we can answer or reject the incoming call. From the HF, we can answer the call using CALL 13

ANSWER or reject the call using CALL 13 REJECT. From the AG we can answer the call using CALL 12

ANSWER or terminate the call using CALL 12 END. In our example, we will answer the call from the HF:

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 59 of 80

Melody 6.0.31

Melody 6.0.31

Melody AG Melody HF

// Do nothing in the AG.

// Receive the notification in the AG side indicating that there is an active call.

>CALL_ACTIVE AGHFP 12

// Answer the incoming call from the

HF.

> CALL 13 ANSWER

>OK

// Receive the notification in the HF side indicating that there is an active call.

>CALL_ACTIVE HFP 13

Since we answered the call from the HF, the audio is transferred through the eSCO/SCO connection. We can modify this behaviour at any time using the transfer command in the AG side:

Melody AG Melody HF

// Perform an audio transfer.

> CALL 12 TRANSFER

>OK

// The audio is now in the AG.

// Perform an audio transfer.

// Do nothing in the HF.

// There is no audio in the HF now.

// Do nothing in the HF.

> CALL 12 TRANSFER

>OK

// There is no audio in the AG now. // The audio is back in the HF.

You can also use the transfer command with the ON_AG or ON_HF parameters. Volume can also be modified while in a call, by default, AG and HF volumes are synchronized, so if you change the volume on one side, the other will synchronize.

Melody AG Melody HF

// Get the volume.

> VOLUME

>12 AGHFP A

>OK

// Modify the volume from the AG.

> VOLUME 12 DOWN

>OK

// Get the volume.

> VOLUME

>13 HFP A

>OK

// Do nothing in the HF.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 60 of 80

Melody 6.0.31

Melody 6.0.31

// Get the volume.

> VOLUME

>12 AGHFP 9

>OK

// Do nothing in the AG.

// Get the volume.

> VOLUME

>12 AGHFP A

>OK

// Get the volume.

> VOLUME

>13 HFP 9

>OK

// Modify the volume from the HF.

> VOLUME 13 UP

>OK

// Get the volume.

> VOLUME

>13 HFP A

>OK

You can end the call using the CALL command in the HF or in the AG. For the HF side, you could use CALL

13 END. In our example we terminate the call from the AG side:

Melody AG Melody HF

// End the call from the AG.

> CALL 12 END

>OK

// The AG side receives a notification

// Do nothing in the HF side.

// The HF receives a notification indicating that the call has been terminated.

>CALL_END AGHFP 12

indicating that there is no call in this link anymore.

>CALL_IDLE HFP 13

Similarly, if we want to initiate an outgoing call procedure, we use the call command as follows:

Melody AG Melody HF

// Initiate an outgoing call procedure.

> CALL 12 OUTGOING {NUMBER}

>OK

// AG gets a notification indicating that an outgoing call is in progress.

>CALL_OUTGOING AGHFP 12

// Do nothing in the HF side.

// The HF receives a notification indicating that there is an outgoing call procedure.

>CALL_OUTGOING HFP 13

At this stage, we can either terminate the call from the HF using CALL 13 END, terminate the call from the AG using CALL 12 END or notify the AG that the remote side has answered the call using CALL 13 ANSWER. In our example, we notify the AG that the remote side has answered the call:

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 61 of 80

Melody 6.0.31

Melody 6.0.31

Melody AG Melody HF

// Notify the AG that the remote side has answered the call.

> CALL 12 ANSWER

>OK

// The AG receives a notification indicating that an active call is in progress.

>CALL_ACTIVE AGHFP 12

// Do nothing in the HF side.

// The HF receives a notification indicating that an active call is in progress.

>CALL_ACTIVE HFP 13

Now that there is an active call, we can use the rest of the commands like in the previous example with the incoming call procedure. In our example, we end the call from the HF:

Melody AG Melody HF

// Do nothing in the AG.

// The AG receives a notification indicating that a call has been terminated.

>CALL_END AGHFP 12

// End the call from the HF.

> CALL 13 END

>OK

// The HF receives a notification indicating that there is no call in the specified link.

>CALL_IDLE HFP 13

Finally, we can close the connection with the CLOSE command from the AG or the HF side.

Melody AG Melody HF

// Close the connection from the AG.

> CLOSE 12

>OK

// Confirm successful disconnection.

>CLOSE_OK 12 AGHFP

// Do nothing in the HF side.

// Confirm successful disconnection.

>CLOSE_OK 13 HFP

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 62 of 80

Melody 6.0.31

Melody 6.0.31

4. PBAP

// Enable PBAP in the profiles

>SET PROFILES=X X X X X X X 1 X X X X

// Open PBAP connection (make sure PBAP is enabled in the PROFILES parameter)

> OPEN {BT ADDRESS} PBAP

>PENDING

>OPEN_OK 16 PBAP

// Download phonebook

> PB_PULL 16

>PENDING

>PB_PULL_START 16

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:My Number

>N;CHARSET=UTF-8:My Number

>TEL;TYPE=CELL:+447446110144

>END:VCARD

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:Acavbsxns

>N;CHAPB_PULL_END 16

>PB_PULL_START 16

>RSET=UTF-8:;Acavbsxns

>TEL;TYPE=CELL:1234 567890

>END:VCARD

>PB_PULL_OK 16

// Download last 10 numbers dialled

> PB_PULL 16 0 3 10 0 85

>PENDING

>PB_PULL_START 16

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:My Number

>N;CHARSET=UTF-8:My Number

>TEL;TYPE=CELL:+447446110144

>X-IRMC-CALL-DATETIME;DIALED:20151110T133324

>END:VCARD

>...

>PB_PULL_OK 16

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 63 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

5. MAP

// Enable MAP in the profiles

>SET PROFILES=X X X X X X X X X X 1 X

// Open MAP connection (make sure MAP is enabled in the PROFILES parameter)

> OPEN {BT ADDRESS} MAP

>PENDING

>OPEN_OK 18 MAP

// Receive a notification and message

>MAP_NEW_SMS 18

>MAP_MSG_BEGIN 18

>BEGIN:BMSG

>VERSION:1.0

>STATUS:UNREAD

>TYPE:SMS_GSM

>FOLDER:telecom/msg/inbox

>NOTIFICATION:1

>BEGIN:VCARD

>VERSION:2.1

>FN;CHARSET=UTF-8:BlueCreation Test

>N;CHARSET=UTF-8:BlueCreation Test

>TEL:

>END:VCARD

>BEGIN:BENV

>BEGIN:BBODY

>CHARSET:UTF-8

>LANGUAGE:UNKNOWN

>LENGTH:45

>BEGIN:MSG

>Hello from bluecreation

>END:MSG

>END:BBODY

>END:BENV

>END:BMSG

>MAP_MSG_END 18

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 64 of 80

Melody 6.0.31

Melody 6.0.31

6. Music source (A2DP & AVRCP)

To be able to stream music from Melody to a speaker or headset you have to enable A2DP Source.

This can be done by setting up the PROFILES parameter as in the following example:

// Enable A2DP Source and AVRCP (A2DP Sink is disabled)

> SET PROFILES=X X 0 1 1 X X X X X X X

>OK

> WRITE

>OK

> RESET

Melody is now ready to stream some music. Once connected to a device you can use the MUSIC and

VOLUME commands:

> STATE CONNECTABLE DISCOVERABLE OFF

>LINK 10 CONNECTED A2DP {BD ADDRESS} SBC SRC 44100

>LINK 11 CONNECTED AVRCP {BD ADDRESS} STOPPED

> MUSIC 11 PLAY

>OK

>A2DP_STREAM_START 10

>AVRCP_PLAY 11

> VOLUME 11 UP

>OK ABS_VOL 11 87

It is possible send meta data using the AVRCP_META_DATA command:

//notify a track changed and store the meta data

> AVRCP_META_DATA 11 2 BlueCreation

//ARTIST: BlueCreation

>PENDING

//wait for the remote device to send a request to get the new meta data

...

//Melody respond to the remote device with the data previously stored in memory

>OK

16

16

If the remote device is Melody, don't forget to enable meta data to receive the track information

(MUSIC_META_DATA).

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 65 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

7. HID

HID Host: note that all HID data is in HEX.

// Enable HID host profile

>SET PROFILES=X X X X X X X X 0 1 X X

>OK

> WRITE

>OK

> RESET

// Read remote device descriptor

>HID_READ CCC50A107086

>PENDING

>HID_READ 0x014F

>{09}{02}{06}{36}{01}{49}{36}{01}{46}{08}{22}{26}{01}{41}{05}{01}{09}{06}{A1}{01}

{85}{01}{75}{01}{95}{08}{05}{07}{19}{E0}{29}{E7}{15}{00}{25}{01}{81}{02}{95}{01}{

75}{08}{81}{03}{95}{05}{75}{01}{05}{08}{19}{01}{29}{05}{91}{02}{95}{01}{75}{03}{9

1}{03}{95}{06}{75}{08}{15}{00}{26}{FF}{00}{05}{07}{19}{00}{29}{FF}{81}{00}{C0}{05

}{0C}{09}{01}{A1}{01}{85}{02}{15}{00}{25}{01}{75}{01}{95}{12}{0A}{23}{02}{0A}{AE}

{01}{0A}{B1}{01}{0A}{94}{01}{0A}{8A}{01}{0A}{82}{01}{0A}{21}{02}{09}{B6}{09}{CD}{

09}{B5}{09}{E2}{09}{EA}{09}{E9}{09}{30}{09}{40}{0A}{96}{01}{0A}{9D}{01}{0A}{C1}{0

1}{81}{02}{95}{01}{75}{06}{81}{03}{C0}{05}{0C}{09}{01}{A1}{01}{85}{03}{05}{01}{09

}{06}{A1}{02}{05}{06}{09}{20}{15}{00}{26}{FF}{00}{75}{08}{95}{01}{81}{02}{C0}{C0}

{05}{01}{09}{80}{A1}{01}{85}{04}{15}{00}{25}{01}{75}{01}{95}{01}{09}{82}{81}{02}{

95}{01}{75}{07}{81}{03}{C0}{05}{0C}{09}{01}{A1}{01}{85}{05}{05}{01}{09}{06}{A1}{0

2}{06}{00}{FF}{25}{01}{75}{01}{95}{02}{0A}{03}{FE}{0A}{04}{FE}{81}{02}{95}{06}{81

}{03}{C0}{C0}{05}{01}{09}{02}{A1}{01}{85}{08}{09}{01}{A1}{00}{05}{09}{19}{01}{29}

{05}{15}{00}{25}{01}{75}{01}{95}{05}{81}{02}{75}{03}{95}{01}{81}{01}{05}{01}{09}{

30}{09}{31}{15}{81}{25}{7F}{75}{08}{95}{02}{81}{06}{09}{38}{15}{81}{25}{7F}{75}{0

8}{95}{01}{81}{06}{C0}{C0}{05}{0C}{09}{01}{A1}{01}{85}{FF}{05}{06}{95}{01}{75}{02

}{19}{24}{29}{26}{81}{02}{75}{06}{81}{01}{C0}{4F}{4B}{0A}

// Initiate a connect to a HID device

>OPEN {BD ADDRESS} HID

>PENDING

>OPEN_OK 17 HID

// Keyboard

>RECV 17 9 {01}{00}{00}{04}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{00}{00}{00}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{02}{00}{00}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{02}{00}{04}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{02}{00}{00}{00}{00}{00}{00}{00}{0A}

>RECV 17 9 {01}{00}{00}{00}{00}{00}{00}{00}{00}{0A}

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 66 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

// Mouse

>RECV 17 5 {08}{00}{02}{FF}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

>RECV 17 5 {08}{00}{00}{00}{00}{0A}

HID device.

// Enable HID device profile and use default keyboard descriptor

>SET PROFILES=X X X X X X X X 1 0 X X

>SET COD=000540

>OK

> WRITE

>OK

> RESET

// Initiate a connect to a HID host

>OPEN {BD ADDRESS} HID

>PENDING

>OPEN_OK 17 HID

// Press ‘a’

>SEND_RAW 17 8

>OK

>{ 00}{00}{04}{00}{00}{00}{00}{00}

// Release ‘a’

>SEND_RAW 17 8

>OK

>{ 00}{00}{00}{00}{00}{00}{00}{00}

// Enable HID device profile

>SET PROFILES=X X X X X X X X 1 0 X X

>SET COD=000580

>OK

> WRITE

>OK

> RESET

// Update HID descriptor to be a mouse

// descriptor:

05010902A1010901A10005091901290815002501950875018102950081030501093009311601F826F

F07750C9502810609381581257F750895018106050C0A380295018106C0C0

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 67 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

>HID_DESC 71

>{05}{01}{09}{02}{A1}{01}{09}{01}{A1}{00}{05}{09}{19}{01}{29}{08}{15}{00}{25}{01}

{95}{08}{75}{01}{81}{02}{95}{00}{81}{03}{05}{01}{09}{30}{09}{31}{16}{01}{F8}{26}{

FF}{07}{75}{0C}{95}{02}{81}{06}{09}{38}{15}{81}{25}{7F}{75}{08}{95}{01}{81}{06}{0

5}{0C}{0A}{38}{02}{95}{01}{81}{06}{C0}{C0}

// Initiate a connect to a HID host

>OPEN {BD ADDRESS} HID

>PENDING

>OPEN_OK 17 HID

// Move the mouse vertically

>SEND_RAW 17 6

>OK

>{ 00}{00}{30}{00}{00}{00}{00}{00}

// Press left button

>SEND_RAW 17 6

>OK

>{ 01}{00}{00}{00}{00}{00}{00}{00}

// Release left button

>SEND_RAW 17 6

>OK

>{ 00}{00}{00}{00}{00}{00}{00}{00}

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 68 of 80

Melody 6.0.31

Melody 6.0.31

8. Multi-connection and audio routing

To be able to connect to multiple devices to Melody you have to set the maximum number of connection per profile.

This can be done by setting up the PROFILES parameter as in the following example:

// Enable 3 A2DP Sink and 3 AVRCP connections

> SET PROFILES=X X 3 0 3 X X X X X X X

>OK

> WRITE

>OK

> RESET

In the following, three devices are connected with the A2DP and AVRCP profiles.

The MUSIC command is used to start streaming music and the ROUTE command allows you to select which stream to listen to:

> STATE CONNECTABLE DISCOVERABLE OFF

>LINK 10 CONNECTED A2DP {BT ADDRESS} SBC SRC 44100

>LINK 11 CONNECTED AVRCP {BTADDRESS} STOPPED

>LINK 20 CONNECTED A2DP {BTADDRESS} SBC SRC 44100

>LINK 21 CONNECTED AVRCP {BTADDRESS} STOPPED

>LINK 30 CONNECTED A2DP {BT ADDRESS} SBC SRC 44100

>LINK 31 CONNECTED AVRCP {BT ADDRESS} STOPPED

> MUSIC 11 PLAY

>OK

>A2DP_STREAM_START 10

>AVRCP_PLAY 11

> MUSIC 21 PLAY

>OK

>A2DP_STREAM_START 20

>AVRCP_PLAY 21

> MUSIC 31 PLAY

>OK

>A2DP_STREAM_START 30

>AVRCP_PLAY 31

// Force audio routing to select device 3

> ROUTE 30

>OK

// Revert to automatic routing (if more than one device is streaming, select to the one that starts playing first, device 1 in this case)

> ROUTE 0

>OK

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 69 of 80

Melody 6.0.31

Melody 6.0.31

9. True Wireless Stereo (TWS)

Here is an example that shows how to stream music from a phone to two Melody devices connected together with TWS.

Melody board 1 Melody board 2

//initial state

> STATUS

>STATE CONNECTABLE DISCOVERABLE OFF

>OK

//search and connect to the TWS device

(melody board 2)

> INQUIRY 10 TWS

>PENDING

>INQUIRY {BT ADDRESS}" melody board 2"

240418 -75db

...

>OK

> OPEN {BT ADDRESS}TWS

>PENDING

>PAIR_PENDING

>PAIR_OK {BT ADDRESS}

>OPEN_OK 1A TWS

>OPEN_OK 11 AVRCP

//device discoverable, phone pairs and connects

> DISCOVERABLE ON

>OK

>PAIR_PENDING

>PAIR_OK {BT ADDRESS 2}

>OPEN_OK 23 HFP

>OPEN_OK 20 A2DP

>OPEN_OK 21 AVRCP

//Phone start streaming music

>AVRCP_PLAY 11

>A2DP_STREAM_START 10

>AVRCP_PLAY 21

//initial state

> STATUS

>STATE CONNECTABLE DISCOVERABLE OFF

>OK

//TWS connection

>PAIR_PENDING

>PAIR_OK {BT ADDRESS}

>OPEN_OK 1A TWS

>OPEN_OK 11 AVRCP

//Phone start streaming music

>AVRCP_PLAY 11

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 70 of 80

Melody 6.0.31

Melody 6.0.31

10. BLE (BC Smart Service)

Melody (Central mode) Melody(Peripheral mode)

// configure device in Central mode

> SET BLE_CONFIG=1

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.8

>Build: 1442512334

>Ready

// scan for peripheral devices

> SCAN 5

>SCAN {BT ADDRESS}1 <BC00187> 12 -84db

......

>OK

// central connects to peripheral

> OPEN {BT ADDRESS} BLE 1

17

>PENDING

>OPEN_OK 14 BLE

// write message

> SEND 14 Hello

18

>OK

// enable notification (BC_SMART Data characteristic)

> BC_SMART_NOTIF 14 ON OFF

>OK

// receive notification

>RECV 14 Hi!!

// send command

>

>OK

BC_SMART_COMMAND 14 STATUS

// configure device in Peripheral mode

> SET BLE_CONFIG=0

>OK

> WRITE

>OK

> RESET

>BlueCreation Copyright 2015

>Melody Audio V6.0.8

>Build: 1442512334

>Ready

// start advertising

> ADVERTISING ON

>OK

// accept connection

>OPEN_OK 14 BLE

// receive message

>RECV 14 Hello

// send notification

> SEND 14 Hi!!

>OK

// handle command

>STATE CONNECTABLE

CONNECTED

>LINK 14 CONNECTED BLE

>OK

17

By default Melody uses random address as we can see in the scan result (type = 1)

18

To send data over BLE, it is possible to enter in Data mode.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

DISCOVERABLE

Page 71 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

11. BLE central (Generic commands)

In this example, Melody is connected to another board with Melody configured in Peripheral mode (link 14).

Melody (Central mode)

// Get list of services

> BLE_GET_SERV 14

>OK

>BLE 14 U16 1801 [0001 - 0004]

>BLE 14 U16 1800 [0005 - 0009]

>BLE 14 U16 180A [000A - 001C]

>BLE 14 U16 1804 [001D - 001F]

>BLE 14 U16 1802 [0020 - 0022]

>BLE 14 U16 1803 [0023 - 0025]

>BLE 14 U128 BC2F4CC6-AAEF-4351-9034-D66268E328F0 [0026 - 002C]

>BLE 14 U128 67D13B00-89B8-11E3-9DE5-0002A5D5C51B [002D - FFFF]

>OK

// Get list of characteristics (Device Information service)

> BLE_GET_CHAR 14 000A 001C

>BLE 14 U16 2A29 [000C]

>BLE 14 U16 2A24 [000E]

>...

OK

// Get list of characteristics (BC Smart service)

> BLE_GET_CHAR 14 0026 002C

>BLE 14 U128 06D1E5E7-79AD-4A71-8FAA-373789F7D93C [0028]

//BC Smart Data

>BLE 14 U128 818AE306-9C5B-448D-B51A-7ADD6A5D314D [002B]

//BC Smart Command

>OK

// Read characteristic - Manufacturer Name (Device Information service)

> BLE_READ 14 000C

>BLE 14 [000C] 12 42 6C 75 65 43 72 65 61 74 69 6F 6E

//BlueCreation

>OK

// Listen notifications - BC Smart Data (BC Smart service)

19

> BLE_NOTIF 14 0028 ON

>OK

// Write characteristic - BC Smart Data (BC Smart service)

19

> BLE_WRITE 14 0028 5 48 45 4C 4C 4F

//HELLO

>OK

19

Note that with BC Smart Service, it is simpler to use the SEND or the BC_SMART commands

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 72 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31

Melody 6.0.31

12. Beacons

This example shows you how to set your beacons parameters. Make sure that BLE is enabled in PROFILES.

To advertise, you can use the ADVERTISING command or enable the auto-advertising feature in

BLE_CONFIG.

> SET BLE_CONFIG=2

>OK

// iBeacon

UUID: 0x00112233-4455-6677-8899-AABBCCDDEEFF

Major: 0x04D2 (1234)

Minor: 0x162E (5678)

Tx Power: -12dBm (0xEE)

> SET BEACON_DATA=0 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 04 D2 16 2E EE

>OK

// Eddystone UID

Namespace: 0x00112233445566778899

Instance: 0xAABBCCDDEEFF

Tx Power: 0xEE

(the last 4 bytes are not used)

> SET BEACON_DATA=1 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF EE 00 00 00 00

>OK

// Eddystone URL

Tx Power: 0xEE

Prefix: 0x02 (http://)

Encoded URL: 0x676F6F2E676C2F495A304F5141 (goo.gl/IZ0OQA)

20

(the last 6 bytes are not used)

> SET BEACON_DATA=2 EE 02 67 6F 6F 2E 67 6C 2F 49 5A 30 4F 51 41 00 00 00 00 00 00

>OK

> WRITE

>OK

> RESET

20

BlueCreation URL encoded with Google URL shortener at https://goo.gl

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 73 of 80

Melody 6.0.31

Melody 6.0.31

13. Tones

The TONE command is used to play back tones on the Melody audio output. Tones are mixed with any ongoing audio playback. See appendix A for more details about the tone parameters.

Here are some examples that demonstrate the TONE command capabilities:

A sample tone:

> TONE TE 400 V 64 TI 0 N C5 L 8 N R0 L 32 N E5 L 8 N R0 L 32 N G5 L 8 N R0 L 32 N

B5 L 4 N R0 L 1 N C6 L 2 TN C6 L 8

>OK

Variable volume single note:

> TONE V 64 N C6 L 4 V 128 N C6 L 4 V 255 N C6 L 4 V 128 N C6 L 4 V 64 N C6 L 4

>OK

Musical scale starting from C4 and omitting any flat and sharp tones:

> TONE V 128 TI 0 N C4 L 8 N D4 L 8 N E4 L 8 N F4 L 8 N G4 L 8 N A4 L 8 N B4 L 8 N

C5 L 8

>OK

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 74 of 80

Melody 6.0.31

Appendix D: Error codes

Error code Description

0x0003

Unknown error

0x0011

Command not allowed with the current configuration

0x0012

Command not found

0x0013

Wrong parameter

0x0014

Wrong number of parameters

0x0015

Command not allowed in the current state

0x0016

Device already connected

0x0017

Device not connected

0x0018

Command is too long

0x0100

Fail to read battery voltage

0x1001

Fail to initiate IAP due to a wrong configuration

0x1002

Fail to communicate with the Apple MFI Co-processor

0x1003

Fail to configure cap sense

0xFF01

License key is missing

0xFF02

License key is invalid

0xF00X

Critical error

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 75 of 80

cVc

BLE

HFP

HID iAP

MAP

Melody 6.0.31

Terms and definitions

A2DP Advanced Audio Distribution Profile

AG Audio Gate

AVRCP Audio/Video Remote Control Profile

Clear Voice Capture

Bluetooth Low Energy

Hand-Free Profile

Human Interface Device Profile iPod Accessory Protocol

Message Access Profile

Multipoint When more than one device is connected

PDL

PBAP

Paired Device List

Phone Book Access Profile

SPP

TWS

WBS

Serial Port Profile

True Wireless Speaker

Wide Band Speech

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 76 of 80

Melody 6.0.31

Melody 6.0.31

General Notes

- Text - Features that have not been tested yet and will be integrated in the next releases.

- Text - Features that are meant to be improved in the next releases are in orange.

BlueCreation'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. BlueCreation will not warrant the use of its devices in such applications.

While every care has been taken to ensure the accuracy of the contents of this document,

BlueCreation cannot accept responsibility for any errors. BlueCreation reserves the right to make modifications, corrections and any other changes to its products at any time. Customers should obtain the latest information before placing orders.

BlueCreation, 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 license is granted under any patent or other rights owned by BlueCreation.

Refer to http://www.bluecreation.com/ for more information. BlueCreation® is a trading name for

Cambridge Executive Limited.

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 77 of 80

Melody 6.0.31

Melody 6.0.31

Change Log

Melody 6.0.31 o Exit automatically Data mode when SPP/BLE/iAP connection is closed o Disable all notifications in Data mode (ROLE...) o Fix in I2S configuration (Unused values)

Melody 6.0.30 o Fix volume issue with HFP Narrow band

Melody 6.0.29 o Add support for Melody Audio Proximity o Fix HFP with Narrow band (Stereo output, I2S)

Melody 6.0.28 o Fix digital interface with HFP (no CVC / no WBS) o Small fix (Flow control check, parser issue)

Melody 6.0.27 o Add new filter to INQUIRY command o Add BLE to SEND_RAW command o Bug fixes (MUSIC_OLD_AVRCP, WBS with Siri, HID descriptor, BLE data mode)

Melody 6.0.26 o Bug fixes (AAC codec, TONES command with I2S, HFP volume, AGHFP terminate call) o Update VOLUME command to be able to change the volumes anytime (even if audio is not streaming for an A2DP link, or if there is no active call for an HFP/AGHGP link...)

Melody 6.0.25 o Fix MM_CFG command o Add support for TWS with analog input (ROUTE 1)

Melody 6.0.24 o Update battery configuration, fix battery charging o Update TWS and Music Manager: allow slave to update audio enhancements/EQ o Add command IAP_APP_REQ (launch iOS app) o Fix minor bugs (BLE auto-advertising) o Update I2S configuration

Melody 6.0.23 o Add Eddystone support o Add Cap Sense support o Fix small bugs (PIO 0 high when connected, ROUTE command, Music Manager) o Update TWS routing (no need to reset anymore) o Update PAIR command o Change mic bias (2.6V) o Change CVC plugin (handsfree)

Melody 6.0.22 o Add AVRCP_META_DATA command

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 78 of 80

Melody 6.0.31

Melody 6.0.31 o Add SPP_HIGH_SPEED feature o Add Beacon role (BLE_CONFIG) and BEACON_DATA configuration (only iBeacon for now) o Small fixes (ROUTE command, exit iAp data mode, number of PBAP connections) o Update BLE notifications o Fix TWS audio drop-outs o Update AVRCP playback status notifications

Melody 6.0.21 o Fix Tones o Fix AUDIO_ANALOG input gain o Update I2S re-sampling (with A2DP source only)

Melody 6.0.20 o Fix several BLE issues o Update BLE generic commands o Update SCAN notifications o Update LICENSE command o Update CODEC selection o Fix other minor issues

Melody 6.0.19 o Change EOF character ( \r instead of \n ) o Fix small issues (volume, SPP disconnection, notifications in data mode...) o Memory optimizations

Melody 6.0.18 o Auto connect AVRCP after A2DP o Add new event notifications o Fix Audio Enable PIO on non-MFI build o Add possibility to get the raw data with SCAN command (full advertising packet) o Add mic bias feature with A2DP o Use Analog default volume when using the ROUTE command o Melody becomes discoverable automatically when connecting to an unpaired device

Melody 6.0.17 o Fix several IAP/BLE/HFP bugs o Fix USB host o Modify default config (PROFILES and VREG_ROLE) o Auto reset after RESTORE

Melody 6.0.16 o Add IAP profile Enable mic bias by default (AUDIO_ANALOG) o Fix SSRD command o Fix AT command o Fix Name issue o Fix audio interface bugs

Melody 6.0.15 o Fix Enable Audio PIO (PIO_3) o Enable mic bias by default (AUDIO_ANALOG) o Update CLOSE command (possibility to use a device number as parameter)

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom

Page 79 of 80 t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Melody 6.0.31 o Update the battery configuration (see BATT_CONFIG)

Melody 6.0.31

Blue Creation

.

St John’s Innovation Centre, Cowley Road, Cambridge, CB4 0WS, United Kingdom t .

+44 (0)1223 420 252 e .

[email protected] www.bluecreation.com

Page 80 of 80

Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement

Table of contents