Roving Networks RN-BT-AUDIO-UG User’s Guide

RN-BT-AUDIO-UG
Bluetooth Audio Module Command Reference User’s Guide
MODULES SUPPORTED: RN52-I/RM
© 2013 Roving Networks. All rights reserved. RN-BT-AUDIO-UG Version 2.0r 3/20/13
Copyright © 2013 Roving Networks. All rights reserved. Roving Networks is a registered trademark of Roving Networks. Apple Inc., iPhone, iPad, iTunes, Made for iPhone are registered trademarks of Apple Computer.
Roving Networks reserves the right to make corrections, modifications, and other changes to its products, documentation and services at any time. Customers should obtain the latest relevant information before plac­ing orders and should verify that such information is current and com­plete.
Roving Networks assumes no liability for applications assistance or cus­tomer’s product design. Customers are responsible for their products and applications that use Roving Networks components. To minimize cus­tomer product risks, customers should provide adequate design and oper­ating safeguards.
Roving Networks, Inc. 102 Cooper Court Los Gatos, CA 95032 +1 (408) 395-5300 www.rovingnetworks.com
www.rovingnetworks.com Version 2.0r 3/20/13 page 2
Roving Networks products are not authorized for use in safety-critical applications (such as life support) where a failure of the Roving Networks product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifi­cally governing such use.
Advanced Information
Table of Contents
Chapter 1. Introduction
1.1 Overview ........................................................................................................5
1.2 Audio & Data Bluetooth Profiles .....................................................................5
1.3 Audio Settings ................................................................................................6
1.4 Making a Bluetooth Connection .....................................................................7
1.5 Command Mode vs. Data Mode .....................................................................9
1.6 GPIO Pins ....................................................................................................13
1.7 Connecting with a Microcontroller ................................................................ 15
1.8 Device Firmware Updates ............................................................................15
1.9 Status LEDs .................................................................................................16
1.10 Evaluation Boards & Reference Designs ................................................... 16
Chapter 2. Command Reference
2.1 Command Syntax .........................................................................................19
2.2 Set Commands .............................................................................................20
2.3 Get Commands ............................................................................................23
2.4 Action Commands ........................................................................................ 24
RN-BT-AUDIO-UG
Appendix A. Command Quick Reference Guide Appendix B. Firmware Revision History
B.1 Version 1.05 .................................................................................................31
Appendix C. Document Information
www.rovingnetworks.com Version 2.0r 3/20/13 page 3
Advanced Information
RN-BT-AUDIO-UG

Chapter 1. Introduction

r

1.1 OVERVIEW

This document contains the software comm and reference and advan ced configuration settings for Roving Networks Bluetooth audio modules. Commands and settings that are specific to a single product or product family are identified as such in the document.
NOTICE TO CUSTOMERS
The commands and applications described in this document apply to Roving Networks Bluetooth audio modules, e.g., the RN52 . They do not apply to Roving Networks Bluetooth data modules such as the RN41, or RN42. For data module configuration information, refer to the Bluetooth Data Module Command Reference & Advanced Information User’s Guide.
Roving Networks Bluetooth audio modules, such as the RN52, allow you to stream audio over the Bluetooth link from a source (such as a smartphone) to speakers, a PC, or other Bluetooth-enabled hardware. In it’s simplest configuration, e.g., controlling remote speakers, the module only requires five signals to stream audio (left/right speaker, two grounds, and power). See Figure 1-1.
RN-BT-AUDIO-UG
FIGURE 1-1: BLUETOOTH AUDIO MODULE CONNECTED TO WIRELESS
SPEAKERS
Bluetooth
RN52
Ground
3.3 VDC
This document assumes that you have a working knowledge of Bluetooth operation and communications. To configure Roving Networks modules you need a Bluetooth­enabled smartphone or PC (either built-in or using a USB Bluetooth dongle). You can only configure one device at a time. Once configured, device settings are saved (inde­pendent of power down) until they are explicitly changed or the factory defaults are restored.

1.2 AUDIO & DATA BLUETOOTH PROFILES

The audio module supports severa l Bluetooth profiles, as described in Table 1-1. Upon power-up, the module is configured as a slave and is ready to pair and connect. The A2DP/AVRCP profile is enabled and connected to the SBC CODEC and analog I/O.
Left Right
Ground
Speake
www.rovingnetworks.com Version 2.0r 3/20/13 page 5
Advanced Information
RN-BT-AUDIO-UG
A
Bluetooth master devices can discover and use the profiles listed in Table 1-1. Y ou con- figure each profile to be discoverable by using ASCII commands in command mode over the data interface. The module can enable multiple profile connections simult ane­ously, and broadcasts the profiles it has available. When you pair the module with a smartphone, the smartphone decides which profile connection(s) to use.

TABLE 1-1: SUPPORTED BLUETOOTH PROFILES

Profile Type Comments
A2DP Audio The advanced audio distribution profile (A2DP) defines how high quality audio (stereo or mono)
can be streamed from one device to another over a Bluetooth connection.
AVRCP Audio The audio-video remote control profile provides a standard interface to control audio/video equip-
ment such as TVs and hi-fidelity equipment. This profile is dependent on and used with the A2DP profile.
HFP Audio The hands free profile (HFP) is commonly used in car hands-free kits to communicate with mobile
phones in the vehicle.
HSP Audio The headset profile provides support for using Bluetooth headsets with mobile phones. This pro-
file is dependent on and used with the HFP profile.
SPP Data SPP defines a virtual serial port between two Bluetooth-enabled devices. SPP emulates a bidirec-
tional serial link.
iAP Data The module natively supports iPod Accessory Protocol (iAP) data connections and directly man-
ages authentication with the MFI authentication chip (not inclu ded).
Figure 1-2 shows a block diagram of the RN52 with Bluetooth audio and dat a profiles,
and GPIO pins.

FIGURE 1-2: RN52 PROFILE CONNECTION BLOCK DIAGRAM

1.3 AUDIO SETTINGS

You control the module’s settings through the UART interface using a simple ASCII command language. For example, you can change the audio r outing and/or profile. Set commands configure the module and get commands echo the current configuration. Because the module reads the configuration into RAM once at boot time, configuration
udio
Data
A2DP
AVRCP
HSP HFP
SPP
iAP
I2S Analog I/O S/PDIF
RN52
Bluetooth
Module
UART
GPIO Pins
(Control & Status)
www.rovingnetworks.com Version 2.0r 3/20/13 page 6
Advanced Information
settings modified with the set command do not take effect until the module has been rebooted (unless otherwise noted), even though the get command may show other­wise. Some example commands are:
SK,08 // Set the connection profile to HFP GA // Display the authentication mode GP // Display the pin code + // Turn on local echo V // Display the firmware version D // Display the current settings Q // Show the connection status

1.4 MAKING A BLUETOOTH CONNECTION

By default, the Bluetooth module acts as a slave and the PC or smar tphone is the mas­ter. You connect to the Bluetooth module using the Bluetooth device manager, which varies depending on your smartphone or compu ter’s operating system. In all cases, the process is the same:
Discovery—In the discovery phase, the Bluetooth module broadcasts its name, profile support, and MAC address. It is ready for other devices to pair with it. Dis­covery is only availoable in slave mode.
Pairing—During pairing, the Bluetooth module and the Bluetooth master validate the pin code. If the pin code validates successfully, they exch an ge sec ur ity keys and a channel hopping pseudo-random sequence. Successful pairing results in the module and master establishing link keys.
Connecting—Before connecting, the Bluetooth devices must have paired suc­cessfully . The m aster initiates a connectio n, the master and slave validate the link keys, and a Bluetooth link is established.
The following sections describe these processes in detail.
RN-BT-AUDIO-UG

1.4.1 Discovery

Upon power up, the module is discoverable. See Figure 1-3 for Bluetooth device scan­ning examples. Bluetooth devices, such as smartphones and PCs, can discover the module.
Discovery using a smartphone—Touch the Settings icon. For iOS devices, touch Bluetooth; for Android devices, touch Wireless & networks and then Bluetooth. The device discovers the module and displays it as RN52-XXXX, where XXXX is the last 4 digits of the module’s MAC address. The module displays in the avail­able devices list as Not Paired.
Discovery using a PC—Open your PC’s Bluetooth device manager and choose to add a new device. The Bluetooth device manager’s icon is located in the bottom right corner of your screen in the taskbar for Windows and in the upper right cor­ner for Mac OS-X. The Bluetooth device manager displays a list of discoverable Bluetooth devices. The module displays as RN52-XXXX, where XXXX is the last 4 digits of the module’s MAC address. The module’s label also shows the MAC address.
www.rovingnetworks.com Version 2.0r 3/20/13 page 7
Advanced Information
RN-BT-AUDIO-UG

1.4.2 Pairing

T o pair with the module, double-click its name in the Blu etooth device list. The module’s firmware automatically stores up to 8 pairings from remote hosts in a first in, first out fashion. The default authentication mode is keyboard I/O (no pin code required).
If the remote Bluetooth device does not require authenticatio n, a connection can occur without the pairing process. However the Bluetooth specification requires that if either device involved in the pairing process requires authentication, the other device must participate to ensure a secure link. Roving Networks modules default to SPP open or keyboard I/O mode and do NOT require authentication.
Most PCs do not support keyboard I/O mode and, therefor e, require authen tication. In this case, use the module’s default pin code , 1234, as the pass key. After you enter the pin code, the Bluetooth devices compare them. If they match, a link key is generated and stored. Usually, but not always, the remote device stores the link key. For subse­quent connections, the devices comp are link keys. If they are corr ect, you do not need to re-enter the pin code.
To remove the stored link key on the remote device, you typically “unpair” or remove the device from the Bluetooth manager. You can change the pin code to remove the link key on the Bluetooth adapter, forcing a new pin code exchange to occur upon sub­sequent connection attempts.
The module may use simple secure pairing (SPP) when it attempts to pair with devices that support the Bluetooth specification version 2.1 + EDR. SSP does not require the user to remember the pin code, but it asks to confirm a 6-digit number if the device has a display capability.
Note: Keyboard I/O mode prompts the host to acknowledge a 6-digit number.
Because there is no way to display this number on an embedded device, the module always replies with Yes, thereby creating a successful pairing. This mode is useful for Android devices with operating system 2.3 and higher.
When you connect to a PC using SPP to exchange data, after the Bluetooth device manager completes pairing, it issues a message that the Bluetooth device is installed on COMX where COMX is unique to your computer. This connection is bidirectional. In some cases, the Bluetooth device manager creates two COM ports. In this situation, use the incoming port to wait for the module to initiate a connection. Open the outgoing port to establish a connection to the module.
Figure 1-3 shows some pairing/connecting examples on several platform s.
www.rovingnetworks.com Version 2.0r 3/20/13 page 8
Advanced Information
RN-BT-AUDIO-UG
FIGURE 1-3: PAIRING/CONNECTING WITH THE BLUETOOTH MODULE

1.4.3 Connecting

To establish a Bluetooth connection on a PC, open the module’s COM port from your application or a terminal emulator. The module remains connected until you close the COM port or remove power from it.
Once connected, the module is in audio mode, allowing audio ( A2DP) to flow from the source to the sink.
While sending and receiving audio, the module can transfer and receive data over its UART. Additionally, you configure the module over the UART by placing the module into command mode and sending ASCII commands. Command mo de is independent of the audio function; e.g., the module can play audio as it is going in and out of com­mand mode.
Note: Only one master can connect to a slave device at a time. As a master, the
device can make multiple connections, but only in a point-to-point, serial­ized manner. Roving Networks modules do not currently support multi-point master mode.

1.5 COMMAND MODE VS. DATA MODE

The RN52 UART has two modes: data mode (default) and command mode. While in data mode and connected over Bluetooth (SPP or iAP), the module is essentially a data pipe. When the module receives data over the wireless Bluetooth connection, it strips the Bluetooth headers and trailers and passes the user data to the UART. When data is written to the UART, the module constructs the Bluetooth packet protocol and sends it out over the Bluetooth connection. Thus, the entire process of sending/receiving dat a to the host is transparent to the end microprocessor. See Figure 1-4.
Note: The audio stream is unaffected when the module enters/leaves command
mode.
www.rovingnetworks.com Version 2.0r 3/20/13 page 9
Advanced Information

FIGURE 1-4: DATA & COMMAND MODES

Data
RN52
Bluetooth
Module
A
B
Audio
Data
CMD
GPIO9
Bluetooth Protocol
Bluetooth
Host
A
B
RN-BT-AUDIO-UG
NOTICE
You can only configure the Bluetooth audio module locally using your computer’s serial port. You cannot configure the module remotely over the Bluetooth link.

1.5.1 Default Configuration & Serial Port Settings

Table 1-2 shows the default configuration for the Bluetooth mod ule :
TABLE 1-2: DEFAULT CONFIGURATION & SERIAL PORT SETTINGS
Option Setting
Bluetooth mode Slave Bluetooth pin code (for legacy pairing modes) 1234 Baud rate 1 15,200 Kbps Bits 8 Parity None Stop bits 1 Flow control Disabled

1.5.2 Configuring the Module over the UART

Connect the module to your computer. For example, if you are using the RN-52-EK evaluation board, connect it to your computer using a USB cable. With the Bluetooth module connected and powered on, run a terminal em ulator and open the COM port to which the cable is connected. The terminal emulator’s communication settings should match the Bluetooth module’s default serial port settings .
Note: You can use local configuration at any time when the device does NOT
have a Bluetooth connection, as well as under certain conditions. If the device is in configuration mode and a connection occurs, the device exits configuration mode and data passe s back and forth from the remote device.
www.rovingnetworks.com Version 2.0r 3/20/13 page 10
Advanced Information
RN-BT-AUDIO-UG
UART
DATA
CMD
GPIO9
When you are finished configuring, reset the device, which causes the device to exit configuration mode and allows data to pass normally.

1.5.3 Command Mode & GPIO9

Launch a terminal emulator and specify the module’ s default settings (s ee Table 1-2). The module monitors GPIO9 as an input to determine whether data traversing the
UART should be routed to the active Bluetooth SPP connection or to the command console. When you hold GPIO9 low , the UART enters command mode. The module returns the string mode. Figure 1-5 shows a logical diagram of the GPIO9 function.
FIGURE 1-5: GPIO9 CONTROLLING COMMAND MODE
In command mode, the module routes all dat a entering the UAR T to the command con­sole. In the command console, you configure the module and query its status using ASCII commands. See Figure 1-6.
CMD to the UART console to indicate that the module is in command
FIGURE 1-6: PULLING GPIO9 LOW ROUTES UART TRAFFIC TO THE
COMMAND CONSOLE
GPIO9
RN52 UART RX
Data Mode Data ModeCommand Mode
CMD\r\n
END\r\n
High
Low
For applications in which a microcontroller controls GPIO9 and sends command s over the UART , the microcontroller should monitor the UART RX line for the following strings immediately after driving GPIO9:
• CMD\r\n
• END\r\n
Use the state diagram shown in Figure 1-7 as a guideline when designing code to mon­itor GPIO9 and command states.
www.rovingnetworks.com Version 2.0r 3/20/13 page 11
Advanced Information
Loading...
+ 23 hidden pages