BEE
iWRAP 5.5.0 AND iWRAP 6.0.0
USER GUIDE
Monday, 04 August 2014
Version 2.5
Bluegiga Technologies Oy
Copyright © 2000-2014 Bluegiga Technologies
All rights reserved.
Bluegiga Technologies assumes no responsibility for any errors which may appear in this manual.
Furthermore, Bluegiga Technologies reserves the right to alter the hardware, software, and/or specifications
detailed here at any time without notice and does not make any commitment to update the information
contained here. Bluegiga’s products are not authorized for use as critical components in life support devices
or systems.
The WRAP, Bluegiga Access Server, Access Point and iWRAP are registered trademarks of Bluegiga
Technologies.
The Bluetooth trademark is owned by the Bluetooth SIG Inc., USA and is licensed to Bluegiga Technologies.
All other trademarks listed herein are owned by their respective owners.
Bluegiga Technologies Oy
VERSION HISTORY
Version
Comment
1.0
First version.
1.1
Added LOOPBACK command documentation.
1.2
Improved LOOPBACK documentation.
1.3
Updated chapters 1, 2 and 3.1 to comply with iWRAP6 and WT32i.
1.4
Replaced WT32 and WT11 references with WT32i and WT11i. Examples in
6.27.2 refreshed.
1.5
Added SDP MTU to SET BT MTU.
1.6
Updated SET CONTROL CODEC, SET CONTROL AUDIO and SET
CONTROL EXTCODEC.
1.7
Updated SET BT SNIFF, SET BT MTU, SET CONTROL PIO and SLEEP.
1.8
Added information about MAP profile.
1.9
Added information about DI profile. Described SET CONTROL EXTCODEC
states. Updated Known Issues. Fixed SET BT MTU.
2.0
Updated contact information, Known Issues and Change Log for iWRAP6.
2.1
Renamed to reflect iWRAP5.5 as well. Chapter 7.2 removed as obsolete.
2.2
Changed SET C GAIN to be consistent with the other commands.
Added &{pskey}? command.
Documented CHAN and FLOW optional parameters in CALL command.
Documented SSP DEBUG ON.
2.3
Added notes about usage of the I2S interface with SET CONTROL AUDIO.
Added BER threshold according to Bluetooth Specification.
2.4
Added APTX, CVC and SET PROFILE MNS commands
Added description about iWRAP, aptX and CVC licenses
2.5
Added I2C string descripntion and example for SET CONTROL EXTCODEC
4.8.2014
Bluegiga Technologies Oy
TABLE OF CONTENTS
1 Introduction ................................................................................................................................................. 10
2 Migrating from previous iWRAP versions ................................................................................................... 12
3 Getting started ............................................................................................................................................ 13
3.1 iWRAP License Key ............................................................................................................................ 14
3.2 aptX License Key ................................................................................................................................ 14
3.3 CVC License Key ................................................................................................................................ 15
3.4 First course to iWRAP ......................................................................................................................... 16
4 iWRAP modes ............................................................................................................................................ 18
4.1 The escape sequence ......................................................................................................................... 19
4.2 Command mode .................................................................................................................................. 20
4.3 Data mode ........................................................................................................................................... 20
4.4 Multiplexing mode ............................................................................................................................... 21
4.5 HFP and HSP modes .......................................................................................................................... 21
4.6 OBEX mode ........................................................................................................................................ 21
4.7 A2DP mode ......................................................................................................................................... 21
4.8 AVRCP mode ...................................................................................................................................... 21
4.9 PBAP mode ......................................................................................................................................... 21
5 Technical details ......................................................................................................................................... 22
6 iWRAP command reference ....................................................................................................................... 24
6.1 Command listings ................................................................................................................................ 25
6.2 Typographical conventions ................................................................................................................. 34
6.3 @ ......................................................................................................................................................... 35
6.4 &{pskey}? ............................................................................................................................................ 37
6.5 AIO ...................................................................................................................................................... 38
6.6 AT ........................................................................................................................................................ 39
6.7 APTX ................................................................................................................................................... 40
6.8 AUTH ................................................................................................................................................... 41
6.9 AVRCP PDU ....................................................................................................................................... 42
6.10 BATTERY ..................................................................................................................................... 45
6.11 BCSP_ENABLE ........................................................................................................................... 46
6.12 BER .............................................................................................................................................. 47
6.13 BLINK ........................................................................................................................................... 48
6.14 BOOT ........................................................................................................................................... 49
6.15 CALL ............................................................................................................................................ 50
6.16 CLOCK ......................................................................................................................................... 56
6.17 CLOSE ......................................................................................................................................... 57
6.18 CONNAUTH ................................................................................................................................. 58
4.8.2014
Bluegiga Technologies Oy
6.19 CONNECT ................................................................................................................................... 60
6.20 CVC .............................................................................................................................................. 62
6.21 ECHO ........................................................................................................................................... 63
6.22 DEFRAG ...................................................................................................................................... 64
6.23 DELAY ......................................................................................................................................... 65
6.24 HID GET ....................................................................................................................................... 67
6.25 HID SET ....................................................................................................................................... 68
6.26 INQUIRY ...................................................................................................................................... 69
6.27 IC .................................................................................................................................................. 72
6.28 IDENT .......................................................................................................................................... 74
6.29 INFO ............................................................................................................................................. 75
6.30 KILL .............................................................................................................................................. 78
6.31 L2CAP .......................................................................................................................................... 79
6.32 LICENSE ...................................................................................................................................... 80
6.33 LIST .............................................................................................................................................. 81
6.34 LOOPBACK ................................................................................................................................. 84
6.35 NAME ........................................................................................................................................... 87
6.36 PAIR ............................................................................................................................................. 89
6.37 PIO ............................................................................................................................................... 93
6.38 PLAY ............................................................................................................................................ 95
6.39 RFCOMM ..................................................................................................................................... 97
6.40 RESET ......................................................................................................................................... 98
6.41 RSSI ............................................................................................................................................. 99
6.42 SCO ENABLE ............................................................................................................................ 100
6.43 SCO OPEN ................................................................................................................................ 101
6.44 SDP ............................................................................................................................................ 103
6.45 SDP ADD ................................................................................................................................... 106
6.46 SELECT ..................................................................................................................................... 108
6.47 SET ............................................................................................................................................ 109
6.48 SET BT AUTH ............................................................................................................................ 111
6.49 SET BT BDADDR ...................................................................................................................... 112
6.50 SET BT CLASS .......................................................................................................................... 113
6.51 SET BT FILTER ......................................................................................................................... 114
6.52 SET BT IDENT ........................................................................................................................... 116
6.53 SET BT LAP ............................................................................................................................... 118
6.54 SET BT MTU .............................................................................................................................. 120
6.55 SET BT NAME ........................................................................................................................... 121
6.56 SET BT PAIRCOUNT ................................................................................................................ 122
4.8.2014
Bluegiga Technologies Oy
6.57 SET BT PAGEMODE ................................................................................................................. 123
6.58 SET BT PAIR ............................................................................................................................. 125
6.59 SET BT POWER ........................................................................................................................ 126
6.60 SET BT ROLE ............................................................................................................................ 128
6.61 SET BT SCO .............................................................................................................................. 130
6.62 SET BT SNIFF ........................................................................................................................... 132
6.63 SET BT SSP .............................................................................................................................. 134
6.64 SET CONTROL AUDIO ............................................................................................................. 136
6.65 SET CONTROL AUTOCALL ..................................................................................................... 138
6.66 SET CONTROL AUTOPAIR ...................................................................................................... 141
6.67 SET CONTROL BATTERY ........................................................................................................ 143
6.68 SET CONTROL BAUD .............................................................................................................. 145
6.69 SET CONTROL BIND ................................................................................................................ 147
6.70 SET CONTROL CD ................................................................................................................... 149
6.71 SET CONTROL CODEC ........................................................................................................... 151
6.72 SET CONTROL CONFIG .......................................................................................................... 153
6.73 SET CONTROL ECHO .............................................................................................................. 158
6.74 SET CONTROL ESCAPE .......................................................................................................... 159
6.75 SET CONTROL EXTCODEC .................................................................................................... 161
6.76 SET CONTROL GAIN ................................................................................................................ 163
6.77 SET CONTROL INIT .................................................................................................................. 165
6.78 SET CONTROL MICBIAS .......................................................................................................... 166
6.79 SET CONTROL MUX ................................................................................................................ 168
6.80 SET CONTROL MSC ................................................................................................................ 172
6.81 SET CONTROL PIO .................................................................................................................. 174
6.82 SET CONTROL PREAMP ......................................................................................................... 175
6.83 SET CONTROL RINGTONE ..................................................................................................... 176
6.84 SET CONTROL READY ............................................................................................................ 177
6.85 SET CONTROL VOLSCALE ..................................................................................................... 178
6.86 SET CONTROL VREGEN ......................................................................................................... 179
6.87 SET {link_id} ACTIVE ................................................................................................................ 181
6.88 SET {link_id} MASTER .............................................................................................................. 182
6.89 SET {link_id} MSC ..................................................................................................................... 183
6.90 SET {link_id} SLAVE .................................................................................................................. 185
6.91 SET {link_id} SNIFF ................................................................................................................... 186
6.92 SET {link_id} SUBRATE ............................................................................................................ 188
6.93 SET {link_id} SELECT ............................................................................................................... 189
6.94 SET PROFILE ............................................................................................................................ 190
4.8.2014
Bluegiga Technologies Oy
6.95 SET RESET ............................................................................................................................... 194
6.96 SLEEP ........................................................................................................................................ 195
6.97 SSPAUTH .................................................................................................................................. 196
6.98 SSP CONFIRM .......................................................................................................................... 197
6.99 SSP PASSKEY .......................................................................................................................... 198
6.100 SSP GETOOB............................................................................................................................ 199
6.101 SSP SETOOB ............................................................................................................................ 200
6.102 SSP DEBUG ON ........................................................................................................................ 201
6.103 TEMP ......................................................................................................................................... 202
6.104 TEST .......................................................................................................................................... 203
6.105 TESTMODE ............................................................................................................................... 207
6.106 TXPOWER ................................................................................................................................. 208
6.107 PBAP .......................................................................................................................................... 209
6.108 VOLUME .................................................................................................................................... 215
7 iWRAP Events .......................................................................................................................................... 216
7.1 AUTH ................................................................................................................................................. 217
7.2 BATTERY .......................................................................................................................................... 218
7.3 CONNECT ......................................................................................................................................... 219
7.4 CONNAUTH ...................................................................................................................................... 220
7.5 CLOCK .............................................................................................................................................. 221
7.6 HID .................................................................................................................................................... 222
7.7 IDENT ................................................................................................................................................ 223
7.8 IDENT ERROR .................................................................................................................................. 224
7.9 INQUIRY_PARTIAL .......................................................................................................................... 225
7.10 NO CARRIER............................................................................................................................. 226
7.11 NAME ......................................................................................................................................... 227
7.12 NAME ERROR ........................................................................................................................... 228
7.13 PAIR ........................................................................................................................................... 229
7.14 READY ....................................................................................................................................... 230
7.15 RING .......................................................................................................................................... 231
7.16 SSPAUTH .................................................................................................................................. 232
7.17 SSP COMPLETE ....................................................................................................................... 233
7.18 SSP CONFIRM .......................................................................................................................... 234
7.19 SSP PASSKEY .......................................................................................................................... 235
8 iWRAP Error Messages ........................................................................................................................... 236
8.1 HCI Errors ......................................................................................................................................... 236
8.2 SDP Errors ........................................................................................................................................ 238
8.3 RFCOMM Errors ............................................................................................................................... 240
4.8.2014
Bluegiga Technologies Oy
8.4 L2CAP Errors .................................................................................................................................... 241
9 Supported Bluetooth Profiles .................................................................................................................... 242
9.1 RFCOMM with TS07.10 .................................................................................................................... 242
9.2 Service Discovery Protocol (SDP) .................................................................................................... 242
9.3 Serial Port Profile (SPP) .................................................................................................................... 242
9.4 Headset Profile (HSP) ....................................................................................................................... 243
9.5 Hands-Free Profile (HFP) ................................................................................................................. 243
9.6 Dial-up Networking Profile (DUN) ..................................................................................................... 244
9.7 OBEX Object Push Profile (OPP) ..................................................................................................... 244
9.8 OBEX File Transfer Profile (FTP) ...................................................................................................... 244
9.9 Advanced Audio Distribution Profile (A2DP) ..................................................................................... 245
9.10 Audio Video Remote Control Profile (AVRCP) .......................................................................... 245
9.11 Human Interface Device Profile (HID) ....................................................................................... 245
9.12 Phone Book Access Profile (PBAP) .......................................................................................... 246
9.13 Message Access Profile (MAP) ................................................................................................. 246
9.14 Health Device Profile (HDP) ...................................................................................................... 247
9.15 Device Identification Profile (DI)................................................................................................. 247
9.16 Bluegiga Proprietary Profiles ..................................................................................................... 248
9.17 UUIDs of Bluetooth profiles ........................................................................................................ 249
10 Useful Information ................................................................................................................................. 253
10.1 PS-keys and how to change them ............................................................................................. 253
10.2 BlueTest radio test utility ............................................................................................................ 254
10.3 Switching between iWRAP and HCI firmware ........................................................................... 255
10.4 Firmware updates ...................................................................................................................... 256
10.5 UART hardware flow control ...................................................................................................... 257
10.6 RS232 connections diagram ...................................................................................................... 258
11 General Bluetooth Information .............................................................................................................. 259
11.1 Secure Simple Pairing (SSP) Overview ..................................................................................... 259
11.2 Sniff power saving mode ............................................................................................................ 262
12 Known Issues ........................................................................................................................................ 264
13 iWRAP Usage Examples ...................................................................................................................... 267
13.1 Serial Port Profile ....................................................................................................................... 267
13.2 Dial-up Networking ..................................................................................................................... 267
13.3 Hands-Free Audio Gateway Connection to a Headset Device .................................................. 268
13.4 Hands-Free connection to a Mobile Phone ............................................................................... 268
13.5 Human Interface Device profile example ................................................................................... 268
13.6 Wireless IO Replacement .......................................................................................................... 269
13.7 A2DP Sink .................................................................................................................................. 271
4.8.2014
Bluegiga Technologies Oy
13.8 A2DP Source ............................................................................................................................. 271
13.9 AVRCP Connection ................................................................................................................... 271
13.10 Over-the-Air Configuration ......................................................................................................... 272
14 Technical support.................................................................................................................................. 273
14.1 Sending email to technical support ............................................................................................ 273
15 Contact information ............................................................................................................................... 274
4.8.2014
Bluegiga Technologies Oy
Page 10 of 274
1 Introduction
iWRAP is an embedded firmware running entirely on the RISC processor of WT11i, WT12, WT32i and WT41
modules. It implements the full Bluetooth protocol stack and many Bluetooth profiles as well. All software
layers, including application software, run on the internal RISC processor in a protected user software
execution environment known as a Virtual Machine (VM).
The host system can interface to iWRAP firmware through one or more physical interfaces, which are also
shown in the figure below. The most common interfacing is done through the UART interface by using the
ASCII commands that iWRAP firmware supports. With these ASCII commands, the host can access Bluetooth
functionality without paying any attention to the complexity, which lies in the Bluetooth protocol stack. GPIO
interface can be used for event monitoring and command execution. PCM, SPDIF, I2S or analog interfaces
are available for audio. The available interfaces depend on the used hardware.
The user can write application code to the host processor to control iWRAP firmware using ASCII commands
or GPIO events. In this way, it is easy to develop Bluetooth enabled applications.
On WT32i, there is an extra DSP processor available for data/audio processing.
Bluetooth BR/EDR Radio
Bluetooth Module
Bluetooth Module
Bluegiga iWRAPTM
L2CAP
RFCOMM
Security
Manager (SM)
iWRAPTM Parser
Application
Host
Host
UART
Generic
Access Profile
(GAP)
HCI
SPP, iAP etc.
profiles
A2DP, HDP etc.
profiles
Figure 1: iWRAP Bluetooth stack
4.8.2014
Bluegiga Technologies Oy
Page 11 of 274
In the figure above, a Bluetooth module with iWRAP firmware could be connected to a host system for
example through the UART interface. The options are:
If the host system has a processor, software can be used to control iWRAP by using ASCII based
commands or GPIO events.
If there is no need to control iWRAP, or the host system does not need a processor, iWRAP can be
configured to be totally transparent and autonomous, in which case it only accepts connections or
automatically opens them.
GPIO lines that Bluegiga’s Bluetooth modules offer can also be used together with iWRAP to achieve
additional functionality, such as Carrier Detect or DTR signaling.
Audio interfaces can be used to transmit audio over a Bluetooth link.
www.b\uegiga.com/suggort www.b|uegiga.com/suggon.
4.8.2014
Bluegiga Technologies Oy
Page 12 of 274
2 Migrating from previous iWRAP versions
This section only applies when upgrading from a previous version; users of iWRAP5 and newer
modules can ignore this.
For users upgrading to iWRAP6 from iWRAP4 or older versions, the first consideration is that iWRAP is no
longer locked to Bluegiga’s address range of 00:07:80:xx:xx:xx, but instead uses a per-module license key.
The module will boot without the license key, and function normally, but with the radio interface completely
disabled. The following error message will be displayed:
WRAP THOR AI (6.0.0 build 826)
Copyright (c) 2003-2014 Bluegiga Technologies Inc.
Built-in self-test error 826.10 - please contact <support@bluegiga.com>
No license key found or license key is wrong!
For new modules coming from the factory, the license key will be written at the factory, and will be preserved
in the “factory settings” section of the Persistent Store.
To enter a license key obtained from www.bluegiga.com/support, you can either use PSTool to write the
license to the key “Module security code” (0x025c PSKEY_MODULE_SECURITY_CODE), or use the built-in
command LICENSE, followed by a RESET command.
LICENSE 00112233445566778899aabbccddeeff
RESET
WRAP THOR AI (6.0.0 build 826)
Copyright (c) 2003-2014 Bluegiga Technologies Inc.
For writing license files in batches while upgrading stocked modules to iWRAP6, please contact
www.bluegiga.com/support.
{at 5am: 05m: LII-int use: Lu: - THOR n1 (4.0.0 build 317) yriqht (c) 200372010 Bluegiga Temnalugies Inc.
4.8.2014
Bluegiga Technologies Oy
Page 13 of 274
3 Getting started
To start using iWRAP firmware, you can use, for example, terminal software such as HyperTerminal. When
using the terminal software, make sure that the Bluetooth module is connected to your PC’s serial port. By
default, iWRAP uses the following UART settings:
Baud rate: 115200bps
Data bits: 8
Stop bits: 1
Parity bit: No parity
HW Flow Control: Enabled
When you power up your Bluetooth module or evaluation kit, you can see the boot prompt appear on the
screen of the terminal software. After the “READY.” event iWRAP firmware is ready to be used.
Figure 2: iWRAP boot prompt
If no READY event is received, the possible reasons are:
The Bluetooth module is not equipped with iWRAP firmware, but HCI firmware
The UART logic levels are incorrect
Boot prompt is disabled with “SET CONTROL ECHO 0 setting
‘-P THOR AI (6.0.0 bufld 894) op¥r1 m (c) 2003-2014 ““9183 Yachmflogies Inc. 'ui t-In se1f»test error 894.1 - phase Contact WW 0 1icense key found ar license key is wrong! 'EADV‘ 5! [sh Sal? w Elli” LW RAP THOR AI (64040 bu11d 892) opyright (c) 2003—2014 B1ueg1‘ga Technologies Inc. EADY. aptx PTX LICENSE KEY IS MISSING OR INVALID!
4.8.2014
Bluegiga Technologies Oy
Page 14 of 274
3.1 iWRAP License Key
iWRAP5 and newer require a license key to be installed in the Bluetooth module. This license key is unique to
every device and has to match to the Bluetooth address of the module. If the license key is not installed
iWRAP will work, but the Bluetooth radio cannot be used.
In case the license key is missing an error is printed in the iWRAP boot event.
Figure 3: Missing iWRAP license key
You can request a new license key from Bluegiga’s Technical support and it can be written to the module with
the LICENSE command.
3.2 aptX License Key
Also the aptX codec requires a license key that needs to be written to the Bluetooth module and it needs to
match the Bluetooth address of the device. If you have a version of the iWRAP firmware with the aptX audio
codec installed you can check if you have a valid aptX license with the APTX command.
Figure 4: Missing iWRAP license key
commzoom Ta- Tam— E El! gal sax-p Cgmml gm Lap mp mm AI (6.0.0 bufld 89A) (up ig ht (() 2003- 2014 a1ueg1‘ga Tezhno'lagies In(. t 1n se1f test error 394 a — please Contact W IEADV.
4.8.2014
Bluegiga Technologies Oy
Page 15 of 274
3.3 CVC License Key
Also the CVC echo cancellation and noise reduction software requires a license key that needs to be written
to the Bluetooth module and it needs to match the Bluetooth address of the device. If you have a version of
the iWRAP firmware which includes the CVC software installed you can check if you have a valid license with
the CVC command. Also an error is printed in the iWRAP boot event, if the CVC license is missing.
Figure 5: Missing CVC license key
You can request an evaluation license key for CVC from Bluegiga’s technical support.
4.8.2014
Bluegiga Technologies Oy
Page 16 of 274
3.4 First course to iWRAP
A few very basic iWRAP usage examples are presented below. Just a few very basic use cases are shown
and more detailed examples will be presented later in this user guide.
AT command can be sent to iWRAP to test that the firmware is operational. An OK response tells that iWRAP
is functional.
AT
OK
SET command displays the settings of the local Bluetooth device.
SET
SET BT BDADDR 00:07:80:ff:ff:f1
SET BT NAME WT32i-A
SET BT CLASS 240428
SET BT IDENT BT:47 f000 6.0.0 Bluegiga iWRAP
SET BT LAP 9e8b33
SET BT PAGEMODE 4 2000 1
SET BT POWER 6 6 6
SET BT ROLE 0 f 7d00
SET BT SNIFF 0 20 1 8
SET BT MTU 667
SET CONTROL BAUD 115200,8n1
SET CONTROL CD 00 0
SET CONTROL ECHO 7
SET CONTROL ESCAPE 43 00 1
SET CONTROL GAIN 8 8
SET CONTROL MSC DTE 00 00 00 00 00 00
SET CONTROL READY 00
SET PROFILE SPP Bluetooth Serial Port
SET
INQUIRY PARTIAL CALL CONNECT
4.8.2014
Bluegiga Technologies Oy
Page 17 of 274
INQUIRY command can be used to discover other visible Bluetooth devices in the range. An
INQUIRY_PARTIAL event is generated as soon as a device is discovered and finally is summary is displayed.
INQUIRY 5
INQUIRY_PARTIAL 00:21:86:35:c9:c8 02010c
INQUIRY_PARTIAL 00:07:80:93:d7:66 240408
INQUIRY_PARTIAL a8:7b:39:c3:ca:99 5a020c
INQUIRY 3
INQUIRY 00:21:86:35:c9:c8 02010c
INQUIRY 00:07:80:93:d7:66 240408
INQUIRY a8:7b:39:c3:ca:99 5a020c
SET commands can be used to modify the settings of the local Bluetooth device. In the example below
Bluetooth PIN code required for pairing is set to “0000” and also the Secure Simple Pairing (SSP) “just works”
mode is enabled. The settings are stored on a local non-volatile memory so they need to be configured only
once. In iWRAP5 and newer versions, SSP is always enabled to fulfil Bluetooth 2.1 and later
specifications.
SET BT AUTH * 0000
SET BT SSP 3 0
A Bluetooth connection is opened with a CALL command. A CALL event indicates that a connection
establishment is in progress and a CONNECT event indicates a successful connection.
CALL 00:07:80:93:d7:66 1101 RFCOMM
CALL 0
CONNECT 0 RFCOMM 1
A SET RESET command can be used to return the factory level settings. iWRAP is reset as indicated by the
boot prompt.
SET RESET
WRAP THOR AI (6.0.0 build 826)
Copyright (c) 2003-2014 Bluegiga Technologies Inc.
READY.
4.8.2014
Bluegiga Technologies Oy
Page 18 of 274
4 iWRAP modes
iWRAP has two basic operational modes, command mode and data mode. In command mode, ASCII
commands can be given to iWRAP firmware to perform various actions or to change configuration settings.
Command mode is the default mode when there are no Bluetooth connections. Data mode, on the other hand,
is used to transmit and receive data over a Bluetooth link. Data mode is only available if there is a Bluetooth
connection. It is possible to switch between modes at any time assuming the conditions for data mode are
fulfilled. The mode transitions are illustrated below.
- CONNECT event
- RING event
- Escape sequence
- SELECT command
Command
Mode
Data Mode
- NO CARRIER event
- Escape sequence
- DTR switch
Figure 6: Mode transitions
CONNECT RING CARRIER READY.
4.8.2014
Bluegiga Technologies Oy
Page 19 of 274
Initial mode
Target mode
Requirements for state transition
Command Mode
(no Bluetooth connections)
In this mode, ASCII commands
can be given to iWRAP.
Data Mode
A connection is successfully created by
using the CALL command and
CONNECT event indicating that a
successful connection is received.
A remote device opens a Bluetooth
connection to iWRAP. A RING event
indicating that a connection is received.
If iWRAP events are disabled the carrier
detect (CD) pin can also be used to
indicate data or command mode.
Data Mode
In this mode, all data is sent
transparently from UART
interface to Bluetooth connection.
Command Mode
The user switches mode by sending an
escape sequence to iWRAP firmware or
by toggling the DTR pin.
A link is terminated (closed by the remote
device or by link loss) and NO
CARRIER event is received.
Command Mode
(active connection)
In this mode, ASCII commands
can be given to iWRAP.
Data Mode
User switches the mode either by sending
an escape sequence to iWRAP firmware
or by using the SELECT command.
Table 1: iWRAP mode transitions explained
4.1 The escape sequence
The escape sequence causes the iWRAP firmware to toggle between command mode and data mode. The
escape sequence consists of three (3) escape characters that are defined by the SET CONTROL ESCAPE
command. By default, the escape character is ‘+.
Do not enter any character before and/or after the escape sequence for a guard time, which is 1 second.
Furthermore, send the escape characters individually, not as a string.
With default settings, the escape sequence is:
< 1 second sleep> +++ < 1 second sleep>
When a successful state transition from data mode to command mode is made, iWRAP sends a READY.
event to indicate that it is ready to receive commands.
The same escape sequence or the SELECT command can be used to return to data mode.
4.8.2014
Bluegiga Technologies Oy
Page 20 of 274
4.2 Command mode
The command mode is the default mode when iWRAP is powered up. In command mode, ASCII commands
can be entered to iWRAP to perform various functions.
Notes:
In command mode, if there are active Bluetooth connections, the data from remote devices is buffered
into iWRAP buffers.
Because of the embedded nature of iWRAP, buffering capabilities are low and only small amounts of
data can be received to buffers. The amount of data which can be buffered depends on the firmware
version and the state of iWRAP. Usually, it is around 1000 bytes, but may vary radically.
The LIST command shows active connections and the amount of buffered data.
4.3 Data mode
Data mode is the default mode when there are one or more Bluetooth connections. In data mode, all data is
sent transparently from UART interface to the Bluetooth link and vice versa.
Notes:
When iWRAP enters command mode from data mode, a READY event occurs, unless events are
masked away by using the SET CONTROL ECHO command.
The DTR pin can be used instead of the escape sequence to switch from data mode to command
mode. This allows much faster mode switching and no guard time is needed. The DTR pin can be
enabled by using the SET CONTROL ESCAPE command.
When enabled, the DTR line can be configured also for closing the active connection or for a reset.
The Carrier Detect (CD) pin can be used to indicate either a Bluetooth connection or data mode. The
CD pin can be enabled and configured by using the SET CONTROL CD” command.
The SET CONTROL BIND command can be used in conjunction with the SET CONTROL
ESCAPE command to allow data-command-data mode switches with the same GPIO line; consider
in fact the following commands together: “SET CONTROL ESCAPE - 20 1” and “SET CONTROL
BIND 0 20 F SELECT 0”
4.8.2014
Bluegiga Technologies Oy
Page 21 of 274
4.4 Multiplexing mode
In iWRAP version 2.1.0 and newer, there is a special mode called multiplexing mode. In this mode, iWRAP
does not have separate commands or data modes, but data, commands and events are all handled in one
single mode. There is, however, a special protocol to separate commands and events from the actual data.
This protocol must be used between the host system and iWRAP firmware.
The advantage of multiplexing mode is that several Bluetooth connections can be handled simultaneously and
there is no need to do time consuming data-command-data mode switching. However, the downside is that
the performance of iWRAP is reduced, since the firmware needs to handle the multiplexing protocol and it
causes overhead.
To learn more about multiplexing mode, see the description of the “SET CONTROL MUX” command.
4.5 HFP and HSP modes
iWRAP 2.2.0 and newer support Bluetooth Hands-Free (v.1.6) profile. This profile includes a lot of control
messaging and events, which are handled in command mode. In other words, when a HFP connection is
opened or received no state transition occurs, but iWRAP stays in command mode, where all HFP messaging
is done. Refer to HFP profile usage for more information.
4.6 OBEX mode
IWRAP4 and newer versions support Bluetooth Object Push Profile (OPP) or File Transfer Protocol (FTP)
modes. The operation in this mode is quite similar to HFP mode. For example, there are no separate
command and data modes, but iWRAP always stays in command mode. Refer to OPP and FTP profile usage
for more information.
4.7 A2DP mode
As of iWRAP3, Bluetooth Advanced Audio Distribution Profile (A2DP) is supported. This profile also includes
control messaging and events, which are handled in command mode. In other words, when an A2DP
connection is opened or received no state transition occurs, but iWRAP stays in command mode, where all
A2DP messaging is done.
4.8 AVRCP mode
As of IWRAP3, Bluetooth Audio/Video Remote Control Profile (AVRCP) is supported. This profile also
includes control messaging and events, which are handled in command mode. In other words, when an
AVRCP connection is opened or received no state transition occurs, but iWRAP stays in command mode,
where all AVRCP messaging is done.
4.9 PBAP mode
As of IWRAP4, Bluetooth Phone Book Access Profile (PBAP) is supported. This profile also includes control
messaging and events, which are handled in command mode. In other words, when a PBAP connection is
opened or received no state transition occurs, but iWRAP stays in command mode, where all PBAP
messaging is done.
4.8.2014
Bluegiga Technologies Oy
Page 22 of 274
5 Technical details
Feature
Value
MAX simultaneous ACL connections
7 (6 with WT32i)
MAX simultaneous SCO connections
1
MAX data rate
550 kbps (WTxx to BT2.0 USB dongle)
500 kbps (WTxx to WTxx)
450 kbps (WTxx to BT1.1-BT1.2 device)
N/A (MUX data rate)
50 kbps (OBEX transfer)
MAX UART baud rate
1800000 bps
Typical data transmission delay
10-15ms
Minimum data transmission delay
5-10ms
Typical SCO delay
30-40ms
Typical A2DP delay (*
150-200ms
A2DP coding/encoding methods
SBC, aptX® and AAC
PIN code length
Configurable from 0 to 16 characters.
Encryption length
From 0 to 128** bits
MAX simultaneous pairings
16
MAX Friendly name length
Configurable up to 248 characters
RFCOMM Packet size
Configurable from 21 to 1009
Supported Bluetooth profiles
GAP, SPP, HFP (v.1.6 with wideband speech), HSP (v.1.2)
A2DP, AVRCP (v.1.5 CT, v.1.3 TG), HID, DUN, DI, OPP, FTP,
HDP, PBAP and MAP.
Apple iAP support
iAP1 and iAP2 profiles
Supported power saving modes
Sniff and deep sleep
Bluetooth QD ID
iWRAP 6.0: 56758
iWRAP 5.0: B019486
www uegiga.com/suggort
4.8.2014
Bluegiga Technologies Oy
Page 23 of 274
iWRAP 4.0: B016540
iWRAP 3.0: B014328
Secure Simple Pairing modes
Just works mode
Man-in-the-middle protection (MITM)
Out-of-Band (OOB) pairing
Echo canceling and noise reduction
Clear Voice Capture (cVc) algorithm. A licensable 3rd party
product.
Table 2: Technical details
*) Alternative coding methods (aptX, FastStream) exist to reduce the delay to 40-90ms or to improve audio
quality.
**) Custom firmware needs to be request from www.bluegiga.com/support.
4.8.2014
Bluegiga Technologies Oy
Page 24 of 274
6 iWRAP command reference
iWRAP can be used and controlled from the host system by sending ASCII commands through the
UART interface to iWRAP.
This section explains the iWRAP commands and their syntax. Some simple usage examples and tips
are also given.
NOTES:
The parser is not case sensitive!
iWRAP commands must end with a line feed \n” character.
By default iWRAP does not print OK to indicate that the command has been executed, but this
feature can be separately enabled with SET CONTROL CONFIG command.
4.8.2014
Bluegiga Technologies Oy
Page 25 of 274
6.1 Command listings
All the available iWRAP commands are listed and briefly described in the tables below. The detailed
description of each command can be found later.
Command:
iWRAP version:
HW version:
Short description
APTX
iWRAP 6.0.0
WT32i
APTX license check
AUTH
iWRAP 2.2.0
ALL
Authenticates Bluetooth pairing
BER
iWRAP 2.2.0
ALL
Reads Bit Error Rate
CALL
iWRAP 2.1.0
ALL
Opens Bluetooth connections
CLOCK
iWRAP 3.0
ALL
Reads Piconet clock
CLOSE
iWRAP 2.1.0
ALL
Closes Bluetooth connections
CONNAUTH
iWRAP 4.0.0
ALL
Authenticate incoming connections
CONNECT
iWRAP 3.0
ALL
Connects Bluetooth links
CVC
iWRAP 6.0.0
WT32i
CVC license check
ECHO
iWRAP 2.2.0
ALL
Echoes data to Bluetooth connection
IC
iWRAP 2.2.0
ALL
Inquiry cancel
IDENT
iWRAP 3.0
ALL
Identifies a Bluetooth device
INQUIRY
iWRAP 2.1.0
ALL
Searches other Bluetooth devices
KILL
iWRAP 3.0
ALL
Kills Bluetooth connections
L2CAP
iWRAP 3.0
ALL
Sets up L2CAP psm
LIST
iWRAP 2.1.0
ALL
Lists Bluetooth connections
LOOPBACK
iWRAP 6.0.0
WT32i
Route audio through DSP
NAME
iWRAP 2.2.0
ALL
Does friendly name discovery
PAIR
iWRAP 3.0
ALL
Pairs with a Bluetooth device
4.8.2014
Bluegiga Technologies Oy
Page 26 of 274
PING
iWRAP 2.2.0
ALL
Pings a Bluetooth connection
RFCOMM
iWRAP 3.0
ALL
Sets up RFCOMM channels
RSSI
iWRAP 2.2.0
ALL
Reads RSSI of a connection
SCO ENABLE
iWRAP 2.2.0
ALL
Enables SCO connections
SCO OPEN
iWRAP 2.2.0
ALL
Opens SCO connection
SDP
iWRAP 2.2.0
ALL
Browse SDP records
SDP ADD
iWRAP 2.2.0
ALL
Create SDP entries
SELECT
iWRAP 2.1.0
ALL
Selects a Bluetooth connection
TEST
iWRAP 2.2.0
ALL
Enables self test modes
TESTMODE
iWRAP 2.2.0
ALL
Enables Bluetooth test mode
TXPOWER
iWRAP 2.2.0
ALL
Reads TX power level
Table 3: Commands related to Bluetooth actions
4.8.2014
Bluegiga Technologies Oy
Page 27 of 274
Command:
iWRAP version:
HW version:
Short description
@
iWRAP 4.0.0
ALL
Shortcut for “SET {link_id} SELECT”
AIO
iWRAP 4.0.0
ALL
Read AIO values
A2DP
iWRAP3.0
WT32i
A2DP streaming control
AT
iWRAP 2.1.0
ALL
Attention
BATTERY
iWRAP 3.0
WT32i
Reads battery level
BCSP_ENABLE
iWRAP 3.0
ALL
Enables BCSP mode
BLINK
iWRAP 5.0.0
ALL
Configures LED blinking
BOOT
iWRAP 2.2.0
ALL
Boots module into different modes
BYPASSUART
iWRAP 3.0
ALL
Enables UART bypass
DEFRAG
iWRAP 3.0
ALL
Defrags PS key storage
DELAY
iWRAP 5.0.0
ALL
Delay before executing a command
HELP
iWRAP 2.2.0
ALL
Prints help
HID GET
iWRAP 5.0.0
ALL
HID descriptor reading
HID SET
iWRAP 5.0.0
ALL
HID descriptor writing
INFO
iWRAP 2.2.0
ALL
Prints firmware information
PIO
iWRAP 3.0
ALL
Reads & Writes PIO statuses
RESET
iWRAP 2.1.0
ALL
Does a software reset
SET
iWRAP 2.1.0
ALL
Lists iWRAP configuration
SET DEVKIT
iWRAP 6.0.0
WT32i
Configures WT32i as A2DP speaker
SET RESET
iWRAP 3.0.0
ALL
Restores factory settings
SLEEP
iWRAP 2.2.0
ALL
Enables deep sleep
4.8.2014
Bluegiga Technologies Oy
Page 28 of 274
TEMP
iWRAP 3.0
ALL
Reads internal temperature sensor
VOLUME
iWRAP 3.0
ALL
Changes volume level
Table 4: Generic commands
4.8.2014
Bluegiga Technologies Oy
Page 29 of 274
Command:
iWRAP version:
HW version:
Short description
SET BT OPP
iWRAP 2.2.0
ALL
Enable OPP profile
SET BT AUTH
iWRAP 2.1.0
ALL
Set PIN code
SET BT BDADDR
iWRAP 2.1.0
ALL
Read BD_ADDR
SET BT CLASS
iWRAP 2.1.0
ALL
Set Class-of-Device
SET BT FILTER
iWRAP 5.0.0
ALL
Inquiry result filter
SET BT IDENT
iWRAP 3.0
ALL
Set DI profile data
SET BT LAP
iWRAP 2.2.0
ALL
Set inquiry access code
SET BT MTU
iWRAP 4.0.0
ALL
Configure Bluetooth connection
MTU
SET BT NAME
iWRAP 2.1.0
ALL
Change friendly name
SET BT PAGEMODE
iWRAP 2.1.0
ALL
Set page mode and timeout
SET BT PAIR
iWRAP 2.1.0
ALL
Manage pairings
SET BT PAIRCOUNT
iWRAP 4.0.0
ALL
Limit the number of stored pairings
SET BT POWER
iWRAP 2.2.0
ALL
Set TX power levels
SET BT ROLE
iWRAP 2.1.0
ALL
Set role and supervision timeout
SET BT SCO
iWRAP 5.0.0
ALL
Configure SCO audio parameters
SET BT SNIFF
iWRAP 2.2.0
ALL
Manage automatic sniff mode
SET BT SSP
iWRAP 4.0.0
ALL
Configure SSP capabilities
Table 5: Bluetooth settings related SET commands
4.8.2014
Bluegiga Technologies Oy
Page 30 of 274
Command:
iWRAP version:
HW version:
Short description
SET CONTROL AUDIO
iWRAP 4.0.0
WT32i
Configure hardware audio interfaces
SET CONTROL AUTOCALL
iWRAP 2.1.0
ALL
Manage automatic connection
control
SET CONTROL AUTOPAIR
iWRAP 5.0.0
ALL
Manage automatic pairing
SET CONTROL BATTERY
iWRAP 4.0.0.
WT32i
Change battery configuration
SET CONTROL BAUD
iWRAP 2.1.0
ALL
Change UART baud rate
SET CONTROL BIND
iWRAP 2.2.0
ALL
Manage GPIO bindings
SET CONTROL CD
iWRAP 2.1.0
ALL
Manage Carrier Detect (CD) signal
SET CONTROL CODEC
iWRAP 4.0.0
WT32i
Configures the internal audio codec
SET CONTROL CONFIG
iWRAP 2.1.0
ALL
Manage configuration bits
SET CONTROL ECHO
iWRAP 2.1.0
ALL
Manage echo mode
SET CONTROL GAIN
iWRAP 3.0
WT32i
Manage ADC and DAC gains
SET CONTROL INIT
iWRAP 2.1.0
ALL
Manage start-up command
SET CONTROL MICBIAS
iWRAP 3,0
WT32i
Control MIC bias settings
SET CONTROL MSC
iWRAP 2.2.0
ALL
Manage MSC functionality
SET CONTROL MUX
iWRAP 2.2.0
ALL
Manage MUX mode
SET CONTROL PCM
iWRAP 3.0-4.0
ALL
Manage PCM settings. Removed in
iWRAP5.
SET CONTROL PIO
iWRAP 5.0.0
ALL
Sets the initial direction of the PIOs
SET CONTROL PREAMP
iWRAP 4.0
WT32i
Enable/disable 20dB preamplifier
SET CONTROL RINGTONE
iWRAP 4.0
All
Set HFP/HSP ringtone
SET CONTROL READY
iWRAP 4.0
All
Tells when iWRAP firmware is ready
SET CONTROL VOLSCALE
iWRAP 5.0.0
WT32i
Scale the volume levels
4.8.2014
Bluegiga Technologies Oy
Page 31 of 274
SET CONTROL VREGEN
iWRAP 3.0
WT32i
Manage VREG_EN functionality
Table 6: Module configuration related SET commands
4.8.2014
Bluegiga Technologies Oy
Page 32 of 274
Command:
iWRAP version:
HW version:
Short description
SET {link_id} ACTIVE
iWRAP 2.1.0
ALL
Disable Bluetooth link power saving
SET {link_id} MASTER
iWRAP 2.1.0
ALL
Set Bluetooth link to master
SET {link_id} MSC
iWRAP 2.2.0
ALL
Set Bluetooth link MSC status
SET {link_id} PARK
Only iWRAP 2.2.0
ALL
Enable Park state on a Bluetooth link
SET {link_id} SELECT
iWRAP 3.0
ALL
Set Bluetooth link to active status
SET {link_id} SLAVE
iWRAP 2.1.0
ALL
Set Bluetooth link to slave
SET {link_id} SNIFF
iWRAP 2.1.0
ALL
Enable Sniff mode on a Bluetooth link
Table 7: Bluetooth connection related SET commands
4.8.2014
Bluegiga Technologies Oy
Page 33 of 274
Command:
iWRAP version:
HW version:
Short description
SET PROFILE A2DP
iWRAP 3.0.0
WT32i
Enable / disable A2DP profile
SET PROFILE BGIO
iWRAP 4.0.0
ALL
Enable / disable BGIO profile
SET PROFILE HDP
iWRAP 4.0.0
All but WT32i
Enable / disable HDP profile*
SET PROFILE HFP
iWRAP 2.1.0
ALL
Enable / disable HFP profile
SET PROFILE HFP-
AG
iWRAP 2.1.0
ALL
Enable / disable HFP profile (AG)
SET PROFILE HID
iWRAP 3.0
ALL
Enable / disable HID profile
SET PROFILE HSP
iWRAP 4.0.0
ALL
Enable / disable HSP profile
SET PROFILE OPP
iWRAP 3.0.0
ALL
Enable / disable OPP profile
SET PROFILE OTA
iWRAP 3.0.0
ALL
Enable / disable OTA profile
SET PROFILE PBAP
iWRAP 4.0.0
ALL
Enable / disable PBAP profile
SET PROFILE SPP
iWRAP 2.1.0
ALL
Enable / disable SPP profile
SET PROFILE MNS
iWRAP 6.0.0
WT32i
Enable / disable MAP notifications
profile
Table 8: Supported Bluetooth profile commands
*) HDP capable firmware only
4.8.2014
Bluegiga Technologies Oy
Page 34 of 274
6.2 Typographical conventions
The ASCII commands and their usage are further described in this chapter.
Commands and their output synopsis are presented as follows:
Synopsis
COMMAND {required parameter} [optional parameter] STATIC TEXT
[2ND OPTIONAL PARAMETER]
Command parameters, on the other hand, are described like this:
Description
parameter
Description
Responses to the command are described as shown in the table below:
Response
RESPONSE {parameters}
parameter
Description
Events generated by commands or actions are described as follows:
Event
EVENT
Description
The list format shows how the current command configuration appears after the SET command is
issued:
List format
COMMAND {required parameter} [optional parameter]
Finally, examples shown are described like this:
iWRAP COMMAND
iWRAP COMMAND RESPONSE(S)
4.8.2014
Bluegiga Technologies Oy
Page 35 of 274
6.3 @
Command @ can be used to read send commands to a dedicated profile parser like Hands-Free
Profile’s AT-command parser.
6.3.1 Syntax
Synopsis:
@ {link_id} {command}
Description:
link_id
Numeric connection identifier
{command}
Command to send to the parser
Response:
None.
6.3.2 Examples
CALL a8:7b:39:c3:ca:99 111F HFP (HFP connection establishment)
CALL 0
CONNECT 0 HFP 3
HFP 0 BSRF 491
HFP 0 STATUS "battchg" 5
HFP 0 STATUS "signal" 5
HFP 0 STATUS "service" 1
HFP 0 STATUS "call" 0
HFP 0 STATUS "callsetup" 0
HFP 0 STATUS "callheld" 0
HFP 0 STATUS "roam" 0
HFP 0 READY
4.8.2014
Bluegiga Technologies Oy
Page 36 of 274
RING 1 a8:7b:39:c3:ca:99 SCO
HFP 0 VOLUME 5
HFP 0 VOLUME 5
HFP 0 VOLUME 5
HFP 0 VOLUME 5
HFP 0 VOLUME 5
HFP 0 NETWORK "elisa"
NO CARRIER 1 ERROR 113 HCI_ERROR_OETC_USER
@0 ATD777; (“ATD777;” sent to link ID 0)
HFP 0 OK
HFP 0 STATUS "callsetup" 2
RING 1 a8:7b:39:c3:ca:99 SCO
HFP 0 VOLUME 6
HFP 0 VOLUME 5
HFP 0 STATUS "callsetup" 3
The above example shows how @ command can be used to send an AT command to the HFP profile
parser. @ command replaces SET {link_id} SELECT” command and simplifies the software
implementation in multi-profile use cases.
4.8.2014
Bluegiga Technologies Oy
Page 37 of 274
6.4 &{pskey}?
Command &{pskey}? can be used to read the value of any PSKEY stored in the module persistent
store.
6.4.1 Syntax
Synopsis:
&{pskey}?
Description:
pskey
PSKEY to read.
Response:
&{pskey} = {value}
pskey
PSKEY to read
value
Value of the PSKEY
6.4.2 Examples
Read the bluetooth address of the module:
&0001?
&0001 = 00ff f907 0080 0007
4.8.2014
Bluegiga Technologies Oy
Page 38 of 274
6.5 AIO
Command AIO can be used to read the value of ADC converters. WT12 does not have any AIO pins,
WT32i has AIO0 and AIO1, all other modules have AIO1.
6.5.1 Syntax
Synopsis:
AIO {source}
Description:
source
Source AIO to read.
Valid values: 0 = AIO0 on WT32i
1 = AIO1 on all except WT12
4 = Internal voltage reference
Response:
AIO {source} {value}
source
Source AIO to read
value
Value of the AIO
6.5.2 Examples
AIO 0
AIO 0 0015
4.8.2014
Bluegiga Technologies Oy
Page 39 of 274
6.6 AT
Command AT, "attention", can be used to check that iWRAP is functional and in command mode.
6.6.1 Syntax
Synopsis
AT
Response
OK
6.6.2 Examples
AT
OK
Tip:
In iWRAP3 or older version iWRAP commands do not produce replies telling that command
was successful or execution has finished. AT command can be used to provide this
functionality, but appending AT into the end of other iWRAP commands.
Appending AT after “SET BT AUTH” command:
SET BT AUTH * 4564\r\nAT\r\n
OK
4.8.2014
Bluegiga Technologies Oy
Page 40 of 274
6.7 APTX
APTX command can be used to check if an aptX license key is installed or not. This command works
only in iWRAP 6.0.0 and newer firmware builds which have the aptX codec installed.
6.7.1 Syntax
Synopsis:
APTX
Response:
APTX LICENSE KEY IS MISSING OR INVALID!
aptX license key is missing or invalid
APTX LICENSE OK
aptX license key is installed
6.7.2 Examples
aptX license key is missing
APTX
APTX LICENSE KEY IS MISSING OR INVALID!
aptX license key is installed
APTX
APTX LICENSE OK
Note:
in iWRAP4 and iWRAP5 aptX works without a license key for 5 minutes at a time so for
evaluation purposes the license key is not necessarily needed. However in iWRAP6 the license
key is always needed and without a proper license key it does not work at all.
In iWRAP4 and iWRAP5 aptX license key is stored in PS-key: PSKEY_DSP28.
In iWRAP6 aptX license key is stored in PS-key: PSKEY_DSP20.
AUTH AUTH PAIR {b 1 PAIR PAIR
4.8.2014
Bluegiga Technologies Oy
Page 41 of 274
6.8 AUTH
AUTH command can be used to reply to AUTH event to perform interactive pairing. AUTH event is only
displayed if SET CONTROL CONFIG bit 11 is set.
6.8.1 Syntax
Synopsis:
AUTH {bd_addr} [pin_code]
Description:
bd_addr
Bluetooth device address of the remote device
pin_code
Bluetooth pin code
Response:
No response
Events:
PAIR {bd_addr}
{link_key}
This event occurs if PAIR event is enabled with SET CONTROL CONFIG and
pairing is successful.
6.8.2 Examples
Interactive pairing with AUTH command, initiated from remote device.
AUTH 00:07:80:81:66:8c?
AUTH 00:07:80:81:66:8c 6666
Declining pairing with AUTH command.
AUTH 00:07:80:81:66:8c?
AUTH 00:07:80:81:66:8c
Pairing with AUTH command and with PAIR event enabled.
AUTH 00:07:80:81:66:8c?
AUTH 00:07:80:81:66:8c 6666
PAIR 00:07:80:81:66:8c 0 16b9515e878c39ed785ba4499322079e
4.8.2014
Bluegiga Technologies Oy
Page 42 of 274
6.9 AVRCP PDU
AVRCP PDU command is used by the AVRCP Controller to send metadata request Protocol Data Units
to the Target.
6.9.1 Syntax
Synopsis
AVRCP PDU {PDU_ID} [parameters]
Description
10
Get capabilities command. Query for events or Company_ID’s the Target
supports.
Parameters:
2
Query supported Company_ID’s.
3
Query supported events.
11
List player application settings. No parameters.
12
List possible values for a player application setting.
Parameters:
{setting_id}
See list at the end of this command’s description.
13
Get current values of player application settings.
Parameters:
{number of settings}
Number of following parameters.
Followed by:
{setting_id}
See list at the end of this command’s description.
14
Set current values of player application settings.
Parameters:
{number of settings}
Number of setting_id-value-pairs that follow.
4.8.2014
Bluegiga Technologies Oy
Page 43 of 274
Followed by:
{setting_id} {value}
See list at the end of this command’s description.
20
Get attributes of the currently playing track.
Parameters:
{number of attributes}
Number of attributes that follow. If zero, list all available
information.
Followed by (unless number of attributes is zero):
[attribute_id]
See list at the end of this command’s description.
30
Get the playing status, length and position of the current track. No parameters.
31
Register notification of events. This will request the Target to notify us when a
track is changed for instance.
Parameters:
{event_id}
See list at the end of this command’s description.
Events
AVRCP {PDU_ID name}_RSP [parsed data]
AVRCP RSP PDU_ID {PDU_ID}, data: [unparsed data]
AVRCP {PDU_ID name}_RSP REJ
4.8.2014
Bluegiga Technologies Oy
Page 44 of 274
6.9.2 Examples
Ask the Target which events it supports.
AVRCP PDU 10 3
AVRCP GET_CAPABILITIES_RSP EVENT COUNT 3 PLAYBACK_STATUS_CHANGED
TRACK_CHANG
ED PLAYBACK_POSITION_CHANGED
Ask the Target about its player application settings, their possible values and change a value.
AVRCP PDU 11
AVRCP LIST_APPLICATION_SETTING_ATTRIBUTES_RSP COUNT 2 REPEAT SHUFFLE
AVRCP PDU 12 2
AVRCP LIST_APPLICATION_SETTING_VALUES_RSP COUNT 3 1 2 3
AVRCP PDU 13 1 2
AVRCP GET_APPLICATION_SETTING_VALUE_RSP COUNT 1 REPEAT OFF
AVRCP PDU 14 1 2 2
AVRCP SET_APPLICATION_SETTING_VALUE_RSP
AVRCP PDU 13 1 2
AVRCP GET_APPLICATION_SETTING_VALUE_RSP COUNT 1 REPEAT SINGLE_TRACK
Ask the Target about the title and artist of the song that is currently playing and ask it to notify us if the
playback status changes.
AVRCP PDU 20 2 1 2
AVRCP GET_ELEMENT_ATTRIBUTES_RSP COUNT 2 TITLE Cold Women and Warm Beer”
ARTIST “The Black League”
AVRCP PDU 31 1 1
AVRCP REGISTER_NOTIFICATION_RSP INTERIM PLAYBACK_STATUS_CHANGED PLAYING
(the interim response is received right after the request to confirm we were registered for notification)
AVRCP REGISTER_NOTIFICATION_RSP CHANGED PLAYBACK_STATUS_CHANGED PAUSED
(the changed response is received when the playing status changes)
BATTERY jm 1
4.8.2014
Bluegiga Technologies Oy
Page 45 of 274
6.10 BATTERY
Command BATTERY is used to read the current voltage of the module battery. The command works
only with WT32i.
6.10.1 Syntax
Synopsis:
BATTERY
Description:
None
Response:
None
Events:
BATTERY {mv}
Current battery voltage in millivolts.
6.10.2 Examples
Reading battery voltage.
BATTERY
BATTERY 3673
4.8.2014
Bluegiga Technologies Oy
Page 46 of 274
6.11 BCSP_ENABLE
Command BCSP_ENABLE is used to boot the device and enter BCSP mode; it is an alias for BOOT 1.
See the documentation of BOOT command for a detailed explanation of iWRAP boot modes.
6.11.1 Syntax
Synopsis:
BCSP_ENABLE
Description:
None
Response:
No response
Events:
None
6.11.2 Examples
Switching iWRAP into BCSP mode. BCSP link establishment packets are sent after command has been
executed.
BCSP_ENABLE
À
?¯WWUo`À
?¯WWUo`À
WWUo`À
?¯WWUo`À
4.8.2014
Bluegiga Technologies Oy
Page 47 of 274
6.12 BER
The BER command returns the Bit Error Rate of the given link ID.
6.12.1 Syntax
Synopsis:
BER {link_id}
Description:
link_id
Numeric connection identifier
Response:
BER {bd_addr} {ber}
bd_addr
Bluetooth address of the remote device
ber
Average Bit Error Rate on the link (as percentage). Possible values are from
0.0000 to 100.0000
Bluetooth specification allows a BER up to 0.1%
Events:
None
6.12.2 Examples
Checking the Bit Error Rate of an active connection.
LIST
LIST 1
LIST 0 CONNECTED RFCOMM 320 0 0 3 8d 8d 00:60:57:a6:56:49 1 OUTGOING ACTIVE MASTER
PLAIN
BER 0
BER 00:60:57:a6:56:49 0.0103 (Bit Error Rate is 0.0103 per cent)
Note:
Works only for BDR links.
4.8.2014
Bluegiga Technologies Oy
Page 48 of 274
6.13 BLINK
Blink command allow generation of periodic square wave which can be used for example for driving a
LED. The timings are not complitely accurate an some jitter may occur.
6.13.1 Syntax
Synopsis:
BLINK [{pio_mask} {off_time} {on_time}]
Description:
pio_mask
Pio mask for IOs that BLINK command should control.
off_time
Defines how long time the IO stays low per period. Hex value, unit is ms.
100 (hex) = 256(dec) ms
on_time
Defines how long time the IO stays high per period. Hex value, unit is ms.
100 (hex) = 256(dec) ms
Response:
No response
Disable:
BLINK
Events:
None
6.13.2 Examples
Sets the PIO7 to stay low for 256ms and then high for 256ms. The process continues until BLINK
command is issued without parameters.
BLINK 80 100 100
4.8.2014
Bluegiga Technologies Oy
Page 49 of 274
6.14 BOOT
The BOOT command is used to temporarily restart the module so that it will operate in one of the HCI
modes.
After issuing this command, the module will immediately enter the selected HCI mode. After a reset, the
module will boot in iWRAP mode again.
The boot mode change can be made permanent by writing the boot mode to PS-key: “Initial device
bootmode”. See chapter “Switching between iWRAP and HCI firmware
6.14.1 Syntax
Synopsis:
BOOT {boot_mode}
Description:
boot_mode
0000
iWRAP
0001
HCI, BCSP, 115200,8E1
0003
HCI, USB
0004
HCI, H4, 115200,8N1
Response:
No response
6.14.2 Examples
Boot to BCSP mode. Same as issuing BCSP_ENABLE command.
BOOT 1
•Ò•¯WWUo`À
•Ò•¯WWUo`À
•Ò•¯WWUo`À
•Ò•¯WWUo`À
4.8.2014
Bluegiga Technologies Oy
Page 50 of 274
6.15 CALL
The CALL command is used to initiate Bluetooth connections to the remote devices. Connections are
closed by using command CLOSE. Currently open connections can be viewed by using command
LIST.
6.15.1 Syntax
Synopsis
CALL {address} {target} {connect_mode} [MTU {payload size}] [CHAN {channel}] [FLOW
{flow_mode} {tx_win} {max_retx} {retx_timeout} {mon_timeout} {max_pdu}]
Description
address
Bluetooth address of the remote device
target
RFCOMM, HFP or HFP-AG, HID or A2DP target for the connection. The target
can be one of the following:
channel
RFCOMM channel number
HFP channel number
HFP-AG channel number
Format: xx (hex)
uuid16
16-bit UUID for searching channel
Format: xxxx (hex)
uuid32
32-bit UUID for searching channel
Format: xxxxxxxx (hex)
uuid128
128-bit UUID for searching channel
Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (hex)
L2CAP psm
16-bit L2CAP psm. Must be an odd value.
Format: xxxx (hex)
connect_mode
Defines the connection mode to be established.
Possible modes are:
4.8.2014
Bluegiga Technologies Oy
Page 51 of 274
RFCOMM
Normal RFCOMM connection
HFP
Opens a connection in the Hands Free device mode.
HFP-AG
Opens a connection in the Hands Free Audio Gateway mode.
A2DP
Opens a connection in the Advanced Audio Distribution Profile (A2DP)
mode. L2CAP psm for A2DP is 19.
AVRCP
Opens a connection in the Audio Video Remote Control Profile (AVRCP)
mode. L2CAP psm for AVRCP is 17.
HID
Opens a connection in the HID keyboard mode or HID mouse mode.
L2CAP psm for HID is 11.
L2CAP
Opens a generic L2CAP connection.
PBAP
Opens a Phone Book Access Profile connection.
OPP
Opens an OBEX Object Push Profile connection.
FTP
Opens an OBEX File Transfer Profile connection.
HSP
Opens a Bluetooth Headset Profile connection
HSP-AG
Opens a Bluetooth Headset Profile Audio Gateway connection
HDP
Opens a Bluetooth Health Device Profile connection
MTU
Indicates that the default MTU value will be overridden.
payload size
Payload size to use in bytes. Range: 21 to 1009.
CHAN
Specify local RFCOMM channel directly. Should only be used in special cases.
channel
Local RFCOMM channel.
4.8.2014
Bluegiga Technologies Oy
Page 52 of 274
FLOW
Specify L2CAP flow control parameters. See Bluetooth 3.0 specification Volume
3, Part A (L2CAP), chapter 5.4 for detailed description of the parameters.
flow_mode
Flow control mode.
tx_win
Size of transmit window.
max_retx
Maximum number of retransmissions.
retx_timeout
Retransmission timeout, in ms.
mon_timeout
Monitor timeout, in ms.
max_pdu
Maximum PDU size.
CONNECT NO CARRIER PAIR M CLOCK AUTH A—UT"
4.8.2014
Bluegiga Technologies Oy
Page 53 of 274
Response
CALL {link_id}
link_id
Numeric connection identifier
Events
CONNECT
Delivered if the CALL command is successful.
NO CARRIER
Delivered if the CALL command fails.
PAIR
If the PAIR event is enabled by using SET CONTROL CONFIG”, it will be
displayed during the call if paring has to be done.
CLOCK
If piconet clock event is enabled, CLOCK event will be displayed.
AUTH
If interactive pairing mode is enabled and no paring exists, AUTH event will be
displayed.
6.15.2 Examples
Creating a successful connection to 00:07:80:80:52:27 using Serial Port Profile.
(UUID16 SPP = 1101)
CALL 00:07:80:80:52:27 1101 RFCOMM
CALL 0
CONNECT 0 RFCOMM 1
Creating a successful connection to 00:07:80:80:52:27 using RFCOMM channel 1.
CALL 00:07:80:80:52:27 1 RFCOMM
CALL 0
CONNECT 0 RFCOMM 1
Unsuccessful SPP connection attempt to 00:07:80:80:52:26.
CALL 00:07:80:80:52:26 1101 RFCOMM
CALL 0
NO CARRIER 0 ERROR 406 RFC_CONNECTION_FAILED
4.8.2014
Bluegiga Technologies Oy
Page 54 of 274
Creating a successful connection to 00:07:80:80:52:27 with MTU 600.
CALL 00:07:80:80:52:27 1 RFCOMM MTU 600
CALL 0
CONNECT 0 RFCOMM 1
Creating a successful A2DP connection
CALL 00:07:80:80:52:27 19 A2DP
CALL 0
CONNECT 0 A2DP 19
CONNECT 1 A2DP 19
Creating a successful AVRCP connection
CALL 00:07:80:80:52:27 17 AVRCP
CALL 0
CONNECT 0 AVRCP 17
Creating a successful HID connection
CALL 00:07:80:80:52:27 11 HID
CALL 0
CONNECT 0 HID 11
CONNECT 1 HID 13
Creating a successful PBAP connection
CALL 00:07:80:80:52:27 112F PBAP
CALL 0
CONNECT 0 PBAP 5
Creating a successful OBEX OPP connection
CALL 00:07:80:80:52:27 1105 OPP
CALL 0
CONNECT 0 OPP 2
4.8.2014
Bluegiga Technologies Oy
Page 55 of 274
Creating a successful Health Device Profile MCAP Communications Link (MCL)
CALL 00:07:80:80:52:27 1001 HDP
CALL 0
CONNECT 0 HDP 4097
Opening a HSP connection from iWRAP to Headset Audio Gateway (phone).
CALL 00:07:80:80:52:27 1008 HSP
CALL 0
CONNECT 0 HSP 5
Opening a HSP connection from iWRAP (HSP-AG) to Headset.
CALL 00:07:80:80:52:26 1008 HSP-AG
CALL 0
CONNECT 0 HSP-AG 5
Note:
If CALL is used with CHANNEL instead of UUID, it will be on average around 300ms faster,
since there is no need to do service discovery. However when calling directly with RFCOMM
channel you need to be sure that the profile you want to connect to is always in that RFCOMM
channel. RFCOMM channel assignments are manufacturer specific and vary between different
Bluetooth devices.
CLOCK bd addr {clock} SYNTAX ERROR
4.8.2014
Bluegiga Technologies Oy
Page 56 of 274
6.16 CLOCK
CLOCK command can be used to read the Bluetooth Piconet clock value. This is useful if time
synchronization between different Piconet devices needs to be achieved.
6.16.1 Syntax
Synopsis:
CLOCK {link_id}
Description:
link_id
Numeric connection identifier
Response:
No response
Events:
CLOCK {bd_addr}
{clock}
CLOCK event occurs, if valid link_id is used.
SYNTAX ERROR
If incorrect parameters are given.
6.16.2 Examples
Reading Piconet clock value:
CLOCK 0
CLOCK 00:07:80:12:34:56 3bb630
Note:
Piconet clock is extremely useful when time needs to be synchronized between Piconet slaves.
All the slaves in the Piconet are synchronized to master’s clock and they share the same clock
value.
Accuracy is 625us, but it also takes some time for the iWRAP to perform the CLOCK command
and display the result. This time can not be unambiguously defined as it depends on the state of
iWRAP.
4.8.2014
Bluegiga Technologies Oy
Page 57 of 274
6.17 CLOSE
Command CLOSE is used to terminate a Bluetooth connection.
6.17.1 Syntax
Synopsis:
CLOSE {link_id}
Description:
link_id
Numeric connection identifier from a previously used command CALL or from event
RING.
Response:
No response
Events:
NO CARRIER
This event is delivered after the link has been closed.
6.17.2 Examples
Closing an active connection:
CALL 00:60:57:a6:56:49 1103 RFCOMM
CALL 0
CONNECT 0 RFCOMM 1
[+++] (data mode -> command mode transition)
READY.
CLOSE 0
NO CARRIER 0 ERROR 0
4.8.2014
Bluegiga Technologies Oy
Page 58 of 274
6.18 CONNAUTH
CONNAUTH command can be used to authorize incoming Bluetooth connections. It is used to reply to
CONNAUTH events which are activated by setting the bit 4 of the optional_block_1 of the SET
CONTROL CONFIG configuration command.
6.18.1 Syntax
Synopsis:
CONNAUTH {bd_addr} {protocol_id } {channel_id} [OK]
Description:
bd_addr
Bluetooth device address of the remote device trying to connect.
protocol_id
Protocol ID of the incoming connection
1
Security manager - Bonding
2
L2CAP
3
RFCOMM
channel_id
Channel number of the incoming connection. Either PSM in the case of L2CAP or
channel number in the case of RFCOMM
OK
Optional flag, which decides if the connection is accepted or not. If the flag is used
the connection is accepted and if it is not used the connection is declined.
Response:
None
Events:
None
CONNAUTH
4.8.2014
Bluegiga Technologies Oy
Page 59 of 274
6.18.2 Examples
Accepting incoming SPP connection requires accepting first the lower level L2CAP connection and then
the actual RFCOMM channel in which the SPP data flows.
CONNAUTH 00:07:80:90:f5:47 2 3? #do you accept L2CAP connection to PSM 3?
CONNAUTH 00:07:80:90:f5:47 2 3 OK
CONNAUTH 00:07:80:90:f5:47 3 1? #do you accept RFCOMM connection to channel 1?
CONNAUTH 00:07:80:90:f5:47 3 1 OK
RING 0 00:07:80:90:f5:47 1 RFCOMM #Incoming RFCOMM connection to channel 1 opened
Note:
CONNAUTH events will not be generated for connections using an authenticated (MITM-
enabled) SSP link key, because the CSR baseband controller will treat such links authenticated
by definition.
4.8.2014
Bluegiga Technologies Oy
Page 60 of 274
6.19 CONNECT
iWRAP can act as a repeater / range extender for RFCOMM connections by using the CONNECT
command which will transparently link two ongoing connections together as a connection between the
two remote devices.
6.19.1 Syntax
Synopsis:
CONNECT {link_id1} {link_id2}
Description:
link_id_1
Numeric connection identifier as displayed by the LIST command.
link_id_2
Numeric connection identifier as displayed by the LIST command.
Response:
None
Events:
None
4.8.2014
Bluegiga Technologies Oy
Page 61 of 274
6.19.2 Examples
Piping two RFCOMM connections.
SET BT PAGEMODE 3
RING 0 00:07:80:87:69:2f 1 RFCOMM
RING 1 00:07:80:87:68:ec 1 RFCOMM
+++ (Data to command mode transition)
READY.
LIST (List active connections)
LIST 2
LIST 0 CONNECTED RFCOMM 320 0 0 33 8d 1 00:07:80:87:69:2f 1 INCOMING ACTIVE SLAVE
PLAIN 0
LIST 1 CONNECTED RFCOMM 320 0 0 31 8d 8d 00:07:80:87:68:ec 1 INCOMING ACTIVE MASTER
PLAIN 0
CONNECT 0 1
First the page mode is set to 3 so that iWRAP is able to receive 2 connections. Second LIST command
is issued to show that two connections exist. Finally the connections are piped with CONNECT
command. After this has been done iWRAP transparently sends all data from 1st connection to the 2nd
one and vice versa.
4.8.2014
Bluegiga Technologies Oy
Page 62 of 274
6.20 CVC
CVC command can be used to check if a CVC license key is installed or not. This command works only
in iWRAP 6.0.0 and newer firmware builds which have the CVC software installed.
6.20.1 Syntax
Synopsis:
CVC
Response:
CVC LICENSE INVALID
CVC license key is missing or invalid
CVC LICENSE OK
CVC license key is installed
6.20.2 Examples
CVC license key is missing
CVC
CVC LICENSE INVALID
CVC license key is installed
CVC
CVC LICENSE OK
Note:
CVC license key is stored in PS-key: PSKEY_DSP48.
4.8.2014
Bluegiga Technologies Oy
Page 63 of 274
6.21 ECHO
The ECHO command sends a specified string of characters to the active link specified by the link_id
parameter. This command can be used, for example, with command SET CONTROL BIND to send an
indication of activity over a Bluetooth link.
6.21.1 Syntax
Synopsis:
ECHO {link_id} [string]
Description:
link_id
Numeric connection identifier
string
User-determined string of characters. Use \xx for escaping hex data. By default \r\n
is appended at the end of the string. This can be avoided by enabling SET
CONTROL CONFIG bit 12 from the optional Block 2.
Response:
No response
Events:
None
6.21.2 Examples
ECHO 0 DATA (Sends “DATA\r\n” to link with ID 0)
ECHO 0 DATA\00\01 (Sends “DATA\x00\x01\r\n” to link with ID 0)
4.8.2014
Bluegiga Technologies Oy
Page 64 of 274
6.22 DEFRAG
This command defragments persistent store memory. The command will reset iWRAP. iWRAP will run
DEFRAG during normal power up procedure if it needed. DEFRAG command forces the iWRAP to
perform defragmentation procedure even if it would not be needed.
6.22.1 Syntax
Synopsis:
DEFRAG
Description:
None
Response:
No response
Events:
None
4.8.2014
Bluegiga Technologies Oy
Page 65 of 274
6.23 DELAY
With DELAY, it is possible to delay execution of iWRAP commands.
6.23.1 Syntax
Synopsis:
DELAY {id} [delay] [command]
Description:
Id
Delay timer ID. Multiple paraller DELAYs can be launched using different ids.
id range is 0-7
delay
Decimal value in ms. Delay after the command is launched.
command
Standard iWRAP command or string to be sent to the active Bluetooth link.
The maximum length for command is 31 characters.
Disable:
DELAY {id}
To disable DELAY before it is executed. Use id parameter to define the DELAY timer
that you want to cancel.
Response:
No response
List format:
DELAY {id} [delay] [command]
If no binding exists, “SET CONTROL
DELAY will not be displayed
6.23.2 Examples
Set module to pagemode 0 (Not connectable and not visible in inquiry) after 60s from DELAY command
execution.
DELAY 0 60000 SET BT PAGEMODE 0
4.8.2014
Bluegiga Technologies Oy
Page 66 of 274
Set module to pagemode 0 (Not connectable and not visible in inquiry) after 60s from module boot.
Could be used to allow pairing during first 60s of device operation.
SET CONTROL INIT DELAY 0 60000 SET BT PAGEMODE 0
4.8.2014
Bluegiga Technologies Oy
Page 67 of 274
6.24 HID GET
Is used for reading HID descriptors which are visible in the HID profile SDP record. For more
information how to set up the HID profile please read the HID application note.
6.24.1 Syntax
Synopsis:
HID GET
Response:
HID GET {length} {descriptor}
Length
Length of the descriptor. Format is a uint16 in hexadecimal format.
Descriptor
Descriptor printed as hex numbers in ASCII format. The descriptor is entire USB HID
report descriptor in hexadecimal format.
4.8.2014
Bluegiga Technologies Oy
Page 68 of 274
6.25 HID SET
Is used to set HID descriptors which are visible in the HID profile SDP record. For more information how
to set up the HID profile please read the HID application note.
6.25.1 Syntax
Synopsis:
HID SET {length} {descriptor}
Description:
Length
Length of the descriptor. Format is a uint16 in hexadecimal format.
Descriptor
Descriptor printed as hex numbers in ASCII format. The descriptor is entire USB HID
report descriptor in hexadecimal format.
Response:
4.8.2014
Bluegiga Technologies Oy
Page 69 of 274
6.26 INQUIRY
Command INQUIRY is used to find other Bluetooth devices in the area i.e. to make a device discovery.
6.26.1 Syntax
Synopsis:
INQUIRY {timeout} [NAME] [LAP {lap}]
Description:
timeout
The maximum amount of time (in units of 1.28 seconds) before the inquiry process is
halted.
Range: 1-48
NAME
Optional flag to automatically request the friendly name for found devices. See
command NAME for more information about the remote name request.
LAP
Optional flag for specifying that inquiry access code will be used.
lap
Value for inquiry access code. The following values are possible:
9E8B33
General/Unlimited Inquiry Access Code (GIAC). This is the default value
unless “SET BT LAP” is used.
9E8B00
Limited Dedicated Inquiry Access Code (LIAC).
9E8B01-9E8B32 and 9E8B34-9E8B3F
Reserved for future use.
INQUIRY PARTIAL INQUIRY EXTENDED NAME NAME ERROR
4.8.2014
Bluegiga Technologies Oy
Page 70 of 274
Response:
INQUIRY {num_of_devices}
and
INQUIRY {addr} {class_of_device}
num_of_devices
The number of found devices
addr
Bluetooth device address
class_of_device
Bluetooth Class of Device
Events:
INQUIRY_PARTIAL
These events are delivered as devices are found.
INQUIRY_EXTENDED
These events are delivered when Bluetooth 2.1 + EDR devices are found that
support Extended Inquiry Response (EIR)
NAME
These events are delivered after INQUIRY if the NAME flag is present.
NAME_ERROR
These events are delivered after INQUIRY if the NAME flag is present and the
name discover fails.
6.26.2 Examples
Basic INQUIRY command example
INQUIRY 1
INQUIRY_PARTIAL 00:14:a4:8b:76:9e 72010c
INQUIRY_PARTIAL 00:10:c6:62:bb:9b 1e010c
INQUIRY 2
INQUIRY 00:14:a4:8b:76:9e 72010c
INQUIRY 00:10:c6:62:bb:9b 1e010c
4.8.2014
Bluegiga Technologies Oy
Page 71 of 274
An INQUIRY with NAME resolution
INQUIRY 1 NAME
INQUIRY_PARTIAL 00:14:a4:8b:76:9e 72010c
INQUIRY 1
INQUIRY 00:14:a4:8b:76:9e 72010c
NAME 00:14:a4:8b:76:9e "SWLTMIKKO_3"
An INQUIRY command with LIAC in use
INQUIRY 1 LAP 9E8B00
INQUIRY_PARTIAL 00:07:80:80:52:15 111111
INQUIRY_PARTIAL 00:07:80:80:52:27 111111
INQUIRY 2
INQUIRY 00:07:80:80:52:15 111111
INQUIRY 00:07:80:80:52:27 111111
An INQUIRY command with RSSI enabled
INQUIRY 1
INQUIRY_PARTIAL 00:14:a4:8b:76:9e 72010c “” -71
INQUIRY_PARTIAL 00:10:c6:62:bb:9b 1e010c “” -73
INQUIRY 2
INQUIRY 00:14:a4:8b:76:9e 72010c
INQUIRY 00:10:c6:62:bb:9b 1e010c
An INQUIRY command with EIR responses
INQUIRY 2
INQUIRY_PARTIAL 00:18:42:f1:a5:be 5a020c "" -92
INQUIRY_PARTIAL 00:17:e4:ef:f9:01 50020c "" -92
INQUIRY_EXTENDED 00:07:80:87:68:ec RAW 0909575433322d53616d020a0800
INQUIRY_PARTIAL 00:07:80:87:68:ec 200428 "WT32i-Sam" -73
INQUIRY 3
INQUIRY 00:18:42:f1:a5:be 5a020c
INQUIRY 00:17:e4:ef:f9:01 50020c
INQUIRY 00:07:80:87:68:ec 200428
4.8.2014
Bluegiga Technologies Oy
Page 72 of 274
6.27 IC
The IC (inquiry cancel) command can be used to stop an on-going inquiry.
6.27.1 Syntax
Synopsis:
IC
Description:
No Description
Response:
INQUIRY {num_of_devices}
INQUIRY {addr} {class_of_device}
num_of_devices
The number of found devices
addr
Bluetooth address of a found device
class_of_device
Bluetooth Class of Device of a found device
Events:
None
6.27.2 Examples
INQUIRY 5
INQUIRY_PARTIAL 00:14:a4:8b:76:9e 72010c “” -71
INQUIRY_PARTIAL 00:10:c6:62:bb:9b 1e010c “” -73
IC
INQUIRY 2
INQUIRY 00:14:a4:8b:76:9e 72010c
INQUIRY 00:10:c6:62:bb:9b 1e010c
4.8.2014
Bluegiga Technologies Oy
Page 73 of 274
Note:
IC command cancels the inquiry only if issued before the INQUIRY {num_of_devices}
message. The name resolution process can not be cancelled with IC.
IDENT IDENT IDENT ERROR —'DENT ERROR
4.8.2014
Bluegiga Technologies Oy
Page 74 of 274
6.28 IDENT
IDENT command can be used to identify a remote Bluetooth device with the Bluetooth Device ID profile.
6.28.1 Syntax
Synopsis:
IDENT {bd_addr}
Description:
bd_addr
Bluetooth device address of the remote device
Response:
No response
Events:
IDENT
IDENT event is raised if a successful response is received
IDENT ERROR
IDENT ERROR event is raised if identification fails
6.28.2 Examples
Successful IDENT of a remote Bluetooth device.
IDENT 00:07:80:00:a5:a5
IDENT 00:07:80:00:a5:a5 BT:47 f000 3.0.0 “Bluegiga iWRAP”
IDENT 00:07:80:82:42:d8
IDENT 00:07:80:82:42:d8 BT:47 b00b 3.2.0 “Bluegiga Access Server”
Using IDENT to try to identify a remote Bluetooth device without success.
IDENT 00:07:80:00:48:84
IDENT ERROR 2 00:07:80:00:48:84 NOT_SUPPORTED_BY_REMOTE
4.8.2014
Bluegiga Technologies Oy
Page 75 of 274
6.29 INFO
INFO displays information about iWRAP version and features.
6.29.1 Syntax
Synopsis:
INFO [CONFIG | BOOTMODE]
Description:
CONFIG
Optional flag that displays more detailed information about the firmware for
example changed parameters.
BOOTMODE
Displays bootmode parameters
Response:
Information about iWRAP version and features.
Events:
None.
4.8.2014
Bluegiga Technologies Oy
Page 76 of 274
6.29.2 Examples
INFO
WRAP THOR AI (6.0.0 build 826)
Copyright (c) 2003-2014 Bluegiga Technologies Inc.
Compiled on Feb 21 2014 11:23:45, running on WT32i-A module, psr v255
A2DP APTX AVRCP BATTERY BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP
MICBIAS OTA PBAP PIO=0x07ff SSP SUBRATE TEST VOLUME WBS
- BOCK4 version 826 (Feb 21 2014 11:23:38) (max acl/sco 6/1)
- Bluetooth version 3.0, Power class 1
- Loader 8617, firmware 8827 (56-bit encryption), native execution mode
- up 0 days, 01:12, 0 connections (pool 1)
READY.
Detailed information display:
INFO CONFIG
WRAP THOR AI (6.0.0 build 826)
Copyright (c) 2003-2014 Bluegiga Technologies Inc.
Compiled on Feb 21 2014 11:23:45, running on WT32i-A module, psr v255
A2DP APTX AVRCP BATTERY BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP
MICBIAS OTA PBAP PIO=0x07ff SSP SUBRATE TEST VOLUME WBS
- BOCK4 version 826 (Feb 21 2014 11:23:38) (max acl/sco 6/1)
- Bluetooth version 3.0, Power class 1
- Loader 8617, firmware 8827 (56-bit encryption), native execution mode
- up 0 days, 01:12, 0 connections (pool 1)
- User configuration:
&028b = 0000 1388
&0290 = 0146 0008 6f76 756c 656d 6420 776f 006e 0145 0010 6f76 756c 656d 7520 0070
&0295 = 0008 0008 0008 0002 0003 0000 0000 0000 0000 0000 0000
&0299 = 0550 0000 0000 0000 0000 0021 0001 0021 0002 0000 0000 0000 0000 0000 0000 0000 0000
4.8.2014
Bluegiga Technologies Oy
Page 77 of 274
&02a3 = 0030 0030 0030 0030
&02a7 = 0020 0428
&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
&02ac = 0400 0000 002b 0002 0000 0000 0000 0000 0000 0000 0082 0000 0000 0000 0010 0000 0000
0000 0000 029b 0000 0000 0000 0000
&02ad = 534d 5f4f 6574 7473
&02b1 = 0006 0006 0006
&02b3 = 0004 0004 0000 0004 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0002
0003 0004 0005 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0005
&02b6 = 0000 0002
&02b9 = 0000
READY.
Note:
When requesting a custom firmware configuration from Bluegiga, it is useful to attach output of
INFO CONFIG to the request.
NO CARRIER
4.8.2014
Bluegiga Technologies Oy
Page 78 of 274
6.30 KILL
Command KILL is used to explicitly terminate all ACL connections between two devices.
6.30.1 Syntax
Synopsis:
KILL {bd_addr} [reason]
Description:
bd_addr
Bluetooth address of the connected remote device.
reason
Reason for disconnecting the ACL link; see Chapter 9 for a listing of possible error
codes. The default value is 0x115: HCI_ERROR_OETC_POWERING_OFF, device
is about to power off.
All existing RFCOMM connections will disconnect with reason
RFC_ABNORMAL_DISCONNECT.
Response:
None
Events:
NO CARRIER
This event is delivered after the link is closed.
4.8.2014
Bluegiga Technologies Oy
Page 79 of 274
6.31 L2CAP
Command L2CAP is used to create a L2CAP psm for L2CAP connections to the local device.
6.31.1 Syntax
Synopsis:
L2CAP {psm}
Description:
psm
L2CAP psm; must be an two digit odd number in hex.
Response:
No response
Events:
SYNTAX ERROR
If an invalid UUID is given.
6.31.2 Examples
Making an L2CAP call between two iWRAPs:
L2CAP 37 (Creates L2CAP psm 37 on the local device)
CALL 00:07:80:12:34:56 37 L2CAP (Opening L2CAP connection to a remote device)
CALL 0
CONNECT 0 L2CAP 37
SYNTAX ERROR
4.8.2014
Bluegiga Technologies Oy
Page 80 of 274
6.32 LICENSE
The LICENSE command can be used to write an iWRAP license key when directly interfacing to the
Persistent Store is not possible. A reset is required to take the key into use. SET RESET does not
overwrite the license key even though the license key would have been set using the LICENSE
command.
6.32.1 Syntax
Synopsis:
LICENSE {key}
Description:
key
128-bit (32 character) hexadecimal formatted license key
Response:
No response
Events:
SYNTAX ERROR
If an invalid key is given.
6.32.2 Examples
LICENSE 00112233445566778899aabbccddeeff
RESET
4.8.2014
Bluegiga Technologies Oy
Page 81 of 274
6.33 LIST
Command LIST shows the count of active connection and detailed information about each connection.
6.33.1 Syntax
Synopsis:
LIST
Description:
No description
Response:
LIST {num_of_connections}
LIST {link_id} CONNECTED {mode} {blocksize} 0 0 {elapsed_time} {local_msc} {remote_msc} {addr}
{channel} {direction} {powermode} {role} {crypt} {buffer}
num_of_connections
Number of active connections. Possible values range from 0 to 7.
link_id
Numeric connection identifier
mode
RFCOMM
Connection type is RFCOMM
L2CAP
Connection type is L2CAP
SCO
Connection type is SCO
blocksize
RFCOMM, L2CAP or SCO data packet size, that is, how many bytes of data can
be sent in one packet
elapse_time
Link life time in seconds
local_msc
Local serial port modem status control (MSC) bits.
remote_msc
Remote serial port modem status control (MSC) bits.
addr
Bluetooth device address of the remote device
4.8.2014
Bluegiga Technologies Oy
Page 82 of 274
channel
RFCOMM channel or L2CAP psm number at remote device
direction
Direction of the link. The possible values are:
OUTGOING
The connection has been initiated by the local device.
INCOMING
The connection has been initiated by the remote device
powermode
Power mode for the link. The possible values are:
ACTIVE
Connection is in active mode, no power saving in use
SNIFF
Connection is in sniff mode
HOLD
Connection is in hold mode
PARK
Connection is in park mode
role
Role of the link. The possible values are:
MASTER
iWRAP is the master device of this connection
SLAVE
iWRAP is the slave device of this connection
crypt
Encryption state of the connection. The possible values are:
PLAIN
Connection is not encrypted
ENCRYPTED
Connection is encrypted
buffer
Tells the amount of data (in bytes) that is stored in the incoming data buffer.
Events:
No events raised
4.8.2014
Bluegiga Technologies Oy
Page 83 of 274
6.33.2 Examples
Listing active connections:
LIST
LIST 1
LIST 0 CONNECTED RFCOMM 320 0 0 3 8d 8d 00:60:57:a6:56:49 1 OUTGOING ACTIVE MASTER
PLAIN 0
4.8.2014
Bluegiga Technologies Oy
Page 84 of 274
6.34 LOOPBACK
This command can be used to route audio from the analogue/digital audio interfaces, through the DSP
processor to analogue/digital interfaces.
The user of this command must make sure the command is not issued when SCO or A2DP audio is
being used as they utilize the DSP processor.
6.34.1 Syntax
Synopsis
LOOPBACK {input_route/OFF} {output_route} {freq}
Description
input_route
Configures the audio input interface.
INTERNAL
Data input is ADC
I2S
Data input is I2S master
I2S_SLAVE
Data input is I2S slave
OFF
Audio routing is turned off
output_route
Configures the audio output interface
INTERNAL
Data output is DAC
I2S
Data output is I2S master
I2S_SLAVE
Data output is I2S slave
SPDIF
Data output is SPDIF
freq
Configures the sample rate
48000
4.8.2014
Bluegiga Technologies Oy
Page 85 of 274
48kHz sample rate (The ADC only supports up to 44.1kHz)
44100
44.1kHz sample rate
32000
32kHz sample rate
16000
16kHz sample rate
Response
None
Events
None
List format
None
4.8.2014
Bluegiga Technologies Oy
Page 86 of 274
6.34.2 Examples
Route audio from ADC to SPDIF using 44.1kHz sample rate.
LOOPBACK INTERNAL SPDIF 44100
Route audio from ADC to I2S master using 44.1kHz sample rate.
LOOPBACK INTERNAL I2S 44100
Route audio from ADC to DAC using 44.1kHz sample rate.
LOOPBACK INTERNAL INTERNAL 44100
Turning OFF loopback.
LOOPBACK OFF
Note:
With analogue input/output the SET CONTROL GAIN and SET CONTROL PREAMP commands can
still be used to control theinput and output gains.
4.8.2014
Bluegiga Technologies Oy
Page 87 of 274
6.35 NAME
Command NAME can be used to perform a friendly name discovery.
6.35.1 Syntax
Synopsis:
NAME {bd_addr}
Description:
bd_addr
Bluetooth address of the connected remote device.
Response:
NAME {bd_addr} “{name}”
or
NAME ERROR {error_code} {bd_addr} {reason}
bd_addr
Bluetooth address of the connected remote device.
name
Friendly name of the remote device
error_code
Error code
reason
ASCII description of the reason
Events:
None.
4.8.2014
Bluegiga Technologies Oy
Page 88 of 274
6.35.2 Examples
Making a successful name discovery
NAME 00:07:80:FF:FF:F1
NAME 00:07:80:FF:FF:F1 "WT32i-A"
Name discovery error because of page timeout
NAME 00:07:80:FF:FF:F2
NAME ERROR 0x104 00:07:80:FF:FF:F2 HCI_ERROR_PAGE_TIMEOUT
PAIR 1b 1 lstatusl SYNTAXERROR AUTH
4.8.2014
Bluegiga Technologies Oy
Page 89 of 274
6.36 PAIR
Command PAIR can be used to pair with other Bluetooth devices. Pairing mode can be traditional or
Secure Simple Pairing.
6.36.1 Syntax
Synopsis
PAIR {bd_addr}
Description
bd_addr
Bluetooth device address of the device remote device
Response
PAIR {bd_addr} {result}
bd_addr
Bluetooth device address of the device remote device
result
OK
Pairing successful
FAIL
Pairing failed
Events
PAIR {bd_addr}
{status}
This event occurs if PAIR event is enabled with SET CONTROL CONFIG
and pairing is successful.
SYNTAX ERROR
This event occurs if incorrect parameters are given.
AUTH
This event occurs if interactive pairing is enabled with SET CONTROL
CONFIG”.
Note:
In iWRAP5 if pin codes are not set PAIR will return PAIR {bd_addr} FAIL since the link keys
can not be generated.
In iWRAP3 and older version and similar situation iWRAP returned “PAIR {bd_addr} OK”.
4.8.2014
Bluegiga Technologies Oy
Page 90 of 274
Bluetooth 2.1 + EDR specification mandates:
When the authentication attempt fails, a waiting interval shall pass before the verifier will initiate a new
authentication attempt to the same claimant, or before it will respond to an authentication attempt
initiated by a device claiming the same identity as the failed device. For each subsequent authentication
failure, the waiting interval shall be increased exponentially. That is, after each failure, the waiting
interval before a new attempt can be made, could be for example, twice as long as the waiting interval
prior to the previous attempt1. The waiting interval shall be limited to a maximum.
The maximum waiting interval depends on the implementation. The waiting time shall exponentially
decrease to a minimum when no new failed attempts are made during a certain time period. This
procedure prevents an intruder from repeating the authentication procedure with a large number of
different keys.
6.36.2 Conventional pairing examples
Successful pairing with a remote device when pin code is enabled with SET BT AUTH (no SSP).
PAIR 00:07:80:12:34:56
PAIR 00:07:80:12:34:56 OK
Unsuccessful pairing with a remote device when pin code is enabled with SET BT AUTH (no SSP).
PAIR 00:07:80:12:34:56
PAIR 00:07:80:12:34:56 FAIL
SSP PASSKEY SSP PASSKEY
4.8.2014
Bluegiga Technologies Oy
Page 91 of 274
6.36.3 Secure Simple Pairing examples
Successful Secure Simple Pairing with Just Works” mode (SET BT SSP 3 0). With the “just works”
mode users do not need to use any PIN code, but it is automatically generated and exchanged by the
Bluetooth devices.
PAIR 00:07:80:12:34:56
PAIR 00:07:80:12:34:56 OK
Secure Simple Pairing with Man-in-the-Middle (MITM) protection enabled.
Device 1:
BD_ADDR: 00:07:80:81:66:8c
SSP mode: “SET BT SSP 0 1” (display only, MITM enabled)
Device 2:
BD_ADDR 00:07:80:89:a4:85
SSP mode: “SET BT SSP 2 1” (keyboard only, MITM enabled)
Device 1:
PAIR 00:07:80:93:d7:66
SSP PASSKEY 00:07:80:93:d7:66 633237
PAIR 00:07:80:89:a4:85 OK
Device 2:
SSP PASSKEY 00:07:80:ff:ff:f1 ?
SSP PASSKEY 00:07:80:81:66:8c 633237
1. First PAIR command is issued on device 1.
2. Then SSP PASSKEY event is displayed on device 1 and a 6 digit number is displayed for
numeric comparison.
3. A SSP PASSKEY event is displayed on device 2 to indicate that numeric comparison needs to
be made.
4. The numeric comparison is responded with SSP PASSKEY command on device 2 and the 6
digit number is given as a parameter.
5. If the number is correct paring is successful and this is indicated on the device that initiated
pairing.
SSP CONFIRM SSP CONFIRM
4.8.2014
Bluegiga Technologies Oy
Page 92 of 274
Successful SSP pairing with Man-in-the-Middle (MITM) protection enabled.
Device 1:
BD_ADDR: 00:07:80:81:66:8c
SSP mode: “SET BT SSP 1 1” (display + yes/no button, MITM enabled)
Device 2:
BD_ADDR 00:07:80:89:a4:85
SSP mode: “SET BT SSP 1 1” (display + yes/no button, MITM enabled)
Device 1:
PAIR 00:07:80:89:a4:85
SSP CONFIRM 00:07:80:89:a4:85 951521 ?
SSP CONFIRM 00:07:80:89:a4:85 OK
PAIR 00:07:80:89:a4:85 OK
Device 2:
SSP CONFIRM 00:07:80:81:66:8c 951521 ?
SSP CONFIRM 00:07:80:81:66:8c OK
1. First PAIR command is issued on device 1.
2. Then SSP CONFIRM event is displayed on device 1 and a number is displayed for numeric
comparison.
3. A SSP CONFIRM event is displayed on device 2 to indicate that numeric comparison needs to
be made.
4. Both devices need to acknowledge that the number displayed on both devices is the same. This
is done with SSP CONFIRM command.
5. If the number is correct paring is successful and this is indicated on the device that initiated
pairing.
4.8.2014
Bluegiga Technologies Oy
Page 93 of 274
6.37 PIO
The command PIO is used to get and set PIO states and directions.
6.37.1 Syntax
Synopsis
PIO {command} [mask] [states]
Description
command
GET
Read the contents of the PIO register. Bits that are set denote
pins that are pulled up.
GETDIR
Read the contents of the PIO direction register. Bits that are set
denote output pins; others are input pins.
GETBIAS
Read the contents of the PIO bias register. Bits that are set
denote pins that are pulled up/down strongly, others are pulled
up/down weakly.
SET {mask} {states}
Set the contents of the PIO register; the first parameter is the bit
mask for deciding which PIOs are affected, the second parameter
is the bits to set/unset.
SETDIR {mask} {states}
Set the contents of the PIO direction register. By default, only bit 8
(PIO7) is set, thus only it can be controlled locally with PIO SET,
and all others are input pins.
SETBIAS {mask} {states}
Set the contents of the PIO bias register. By default, all pins are
pulled up/down weakly.
RESET
Set the registers to iWRAP defaults.
mask
The hexadecimal bitmask that defines which PIOs are affected.
states
The hexadecimal bitmask that defines the states of the PIOs specified by mask.
4.8.2014
Bluegiga Technologies Oy
Page 94 of 274
Response
None for set commands.
PIO GET {state}
Response for PIO GET; displays PIO register value.
PIO GETDIR {state}
Response for PIO GETDIR.
PIO GETBIAS {state}
Response for PIO GETBIAS.
Events
None
6.37.2 Examples
Playing with PIO7
PIO GET (Read PIO statues)
PIO GET 0
PIO SETDIR 80 80 (Sets PIO7 to output)
PIO SET 80 80 (Sets PIO7 high)
PIO GETDIR (Reads PIO directions)
PIO GETDIR 80
PIO GET (Reads PIO statuses)
PIO GET 80
PIO RESET (Reset PIOs)
PIO GETDIR
PIO GETDIR 0
PIO GET
PIO GET 0
Note:
There are 6 usable IO pins (PIO2-PIO7) on the WT11i/12/41 modules and 11 GPIO lines (PIO0-
PIO10) on the WT32i. Therefore the range for the mask and state parameters for the WT11i/12
is 4-FF and for the WT32i it is 0-07FF.
The default values for the PIO registers are all zero; except for the WT11i-A/E the direction
register is set so that PIO0 and PIO1 are outputs.
Switches on the evaluation kits can also affect PIO values. For instance, if on the WT32i
evaluation kit PIO8 is routed to USB and the USB charger is in place, PIO8 will be high.
4.8.2014
Bluegiga Technologies Oy
Page 95 of 274
6.38 PLAY
Command PLAY is used to generate tones or beeps.
6.38.1 Syntax
Synopsis:
PLAY {string}
Description:
string
String of tones to play
If empty string is given iWRAP stops playing the previous ringtone.
*
WHOLENOTE
+
HALFNOTE
-
QUARTERNOTE
;
EIGHTHNOTE
:
SIXTEENTHNOTE
,
THIRTYSECONDNOTE
.
SIXTYFOURTHNOTE
a-g
notes
0-9
selects octave for the following notes, 4 by default
_
rest
!
4.8.2014
Bluegiga Technologies Oy
Page 96 of 274
timbre sine(default)
"
timbre square
#
timbre saw
%
timbre triangle
&
timbre triangle2
/
timbre clipped sine
(
timbre plucked
Response:
PLAY OK
Returned when play command has finished
PLAY BUSY
Returned if previous play command is still being executed
Events:
None.
Modern desk phone ring:
PLAY 6,gfgfgf__gfgfgf______gfgfgf__gfgfgf
PLAY OK
Movie theme ring tone:
PLAY &-5aaa;f:_6c-5a;f:_6c-5a_-6eee;f:_6c-5a;f:_6c-5a
PLAY OK
4.8.2014
Bluegiga Technologies Oy
Page 97 of 274
6.39 RFCOMM
Command RFCOMM is used to create a RFCOMM channel for general RFCOMM connections.
6.39.1 Syntax
Synopsis:
RFCOMM {action}
Description:
action
CREATE
Creates a generic RFCOMM channel.
Response:
RFCOMM {channel}
channel
RFCOMM channel number
Events:
None
6.39.2 Examples
Creating a generic RFCOMM channel.
RFCOMM CREATE
RFCOMM 2
4.8.2014
Bluegiga Technologies Oy
Page 98 of 274
6.40 RESET
Command RESET is used to perform a software reset.
6.40.1 Syntax
Synopsis:
RESET
Description:
No description
Response:
No response
4.8.2014
Bluegiga Technologies Oy
Page 99 of 274
6.41 RSSI
The RSSI command returns the Receiver Signal Strength Indication of the link given as a parameter.
6.41.1 Syntax
Synopsis:
RSSI {link_id}
Description:
link_id
Numeric connection identifier
Response:
RSSI {bd_addr} {rssi}
bd_addr
Bluetooth address of the remote device
rssi
Receiver Signal Strength Indication. Possible values are from +20 to
-128.
20 = Good link
-128 = Poor link
Events:
None
6.41.2 Examples
Checking the RSSI of an active connection:
LIST
LIST 1
LIST 0 CONNECTED RFCOMM 320 0 0 3 8d 8d 00:60:57:a6:56:49 1 OUTGOING ACTIVE MASTER
PLAIN
RSSI 0
RSSI 00:60:57:a6:56:49 -10 (RSSI is -10)
4.8.2014
Bluegiga Technologies Oy
Page 100 of 274
6.42 SCO ENABLE
The SCO ENABLE command enables support for SCO (audio) connections. This command is needed if
SCO connections are used none of the audio profiles (HFP or HSP) are enabled.
6.42.1 Syntax
Synopsis:
SCO ENABLE
Description:
None
Response:
None
Events:
None
Note:
The SCO ENABLE command must be given every time after reset; it is not stored on flash
memory.
“SET CONTROL INIT” can be used to automatically issue one “SCO ENABLE” command.
IF HFP or HSP profiles are enabled SCO ENBLED command is not needed.
4.8.2014
Bluegiga Technologies Oy
Page 101 of 274
6.43 SCO OPEN
The SCO OPEN command is used to open a SCO connection on top of an existing RFCOMM link.
6.43.1 Syntax
Synopsis:
SCO OPEN {link_id}
Description:
link_id
Numeric connection identifier
Response:
None
Response:
None
Events:
CONNECT
If SCO connection was opened successfully
NO_CARRIER
If connection opening failed
Note:
The SCO ENABLE command must be given before the SCO OPEN command can be used.
6.43.2 Examples
Creating an SCO connection to another iWRAP device:
SCO ENABLE
CALL 00:07:80:80:52:27 1 RFCOMM
CALL 0
CONNECT 0 RFCOMM 1
[+++] (Command to data mode transition)
4.8.2014
Bluegiga Technologies Oy
Page 102 of 274
SCO OPEN 0 (SCO is opened on top of the existing RFCOMM link with ID 0)
CONNECT 1 SCO
4.8.2014
Bluegiga Technologies Oy
Page 103 of 274
6.44 SDP
The SDP command can be used to browse the available services on other Bluetooth devices.
6.44.1 Syntax
Synopsis:
SDP {bd_addr} {uuid} [ALL]
Description:
bd_addr
Bluetooth address of the remote device
uuid
Service to look for
UUID “1002” stands for root and returns all the services the remote device
supports.
ALL
Optional flag to read all the SDP information from the remote device.
Response:
SDP {bd_addr} < I SERVICENAME S service_name >
< I PROTOCOLDESCRIPTORLIST < < U L2CAP psm> < U RFCOMM I channel > > >
SDP
bd_addr
Bluetooth address of the remote device
service name
Name of the service. For example “Serial Port Profile”
psm
L2CAP psm of the profile (if L2CAP based profile)
channel
RFCOMM channel of the profile (if RFCOMM based profile)
Events:
SYNTAX ERROR
This event occurs if an invalid uuid is given
4.8.2014
Bluegiga Technologies Oy
Page 104 of 274
6.44.2 Examples
Browsing the SDP root record to retrieve all SDP entries
SDP 00:07:80:89:a4:85 1002
SDP 00:07:80:89:a4:85 < I SERVICENAME S "Bluetooth Serial Port" > < I
PROTOCOLDESCRIPTORLIST < < U L2CAP > < U RFCOMM I 01 > > >
SDP 00:07:80:89:a4:85 < I SERVICENAME S "Stereo headset" > < I PROTOCOLDESCRIPTORLIST
< < U L2CAP I 19 > < U 0019 I 100 > > >
SDP
Searching for SPP profile
SDP 00:07:80:93:d7:66 1101
SDP 00:07:80:93:d7:66 < I SERVICENAME S "Bluetooth Serial Port" > < I
PROTOCOLDESCRIPTORLIST < < U L2CAP > < U RFCOMM I 01 > > >
SDP
Searching for SPP profile using the ALL flag.
SDP 00:07:80:93:d7:66 1101 ALL
SDP 00:07:80:93:d7:66 < I 0 I 10000 > < I 1 < U 00001101-0000-1000-8000-00805f9b34fb > > < I
PROTOCOLDESCRIPTORLIST < < U L2CAP > < U RFCOMM I 01 > > > < I 5 < U BROWSE > > < I 6
< I 656e I 6a I 100 > > < I SERVICENAME S "Bluetooth Serial Port" >
SDP
Some devices return the protocol descriptions using 128-bit format and older iWRAP version could not
parse them correctly. The response might therefore look like this. iWRAP5 and newer can parse 128-bit
protocol description lists and display them correctly.
SDP 00:17:4b:67:a8:c3 1101
SDP 00:17:4b:67:a8:c3 < I SERVICENAME S "Bluetooth SPP" > < I PROTOCOLDESCRIPTORLIST <
< U 00000100-0000-1000-8000-00805f9b34fb > < U 00000003-0000-1000-8000-00805f9b34fb I 19 >
> >
According to the Bluetooth specification:
00000100-0000-1000-8000-00805f9b34fb =L2CAP
00000003-0000-1000-8000-00805f9b34fb =RFCOMM
6.44.3 Known issues
Symptom: Launching a new SDP query immediately after receiving a failing SDP query, can cause the
SDP engine to stop working. Typically takes multiple failing SDP queries in row before occurring.
4.8.2014
Bluegiga Technologies Oy
Page 105 of 274
Resolution: After receiving “SDC_OPEN_SEARCH_FAILED_PAGE_TIMEOUT” as reason for error,
one should wait at least 50ms before issuing new SDP query.
4.8.2014
Bluegiga Technologies Oy
Page 106 of 274
6.45 SDP ADD
The SDP ADD command can be used to modify a local service record to add new RFCOMM based
services. This is useful if one wants to implement a Bluetooth profile iWRAP itself does not support.
6.45.1 Syntax
Synopsis:
SDP ADD {uuid} {name}
Description:
uuid
Identifier of the service
uuid16
16-bit UUID
Format: xxxx (hex)
uuid32
32-bit UUID
Format: xxxxxxxx (hex)
uuid128
128-bit UUID
Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (hex)
name
Name of the service
Response:
SDP {channel}
channel
RFCOMM channel where the service is bound to
Events:
SYNTAX ERROR
This event occurs if an invalid uuid is given
4.8.2014
Bluegiga Technologies Oy
Page 107 of 274
6.45.2 Examples
Adding a Dial-Up Networking profile
SDP ADD 1103 Dial-Up Networking
SDP 2
Note:
The service record will be cleared when a reset is made, so SDP ADD command(s) must be
given every time after a reset.
SET CONTROL INIT” can be used to automatically run SDP ADD” command after a reset.
4.8.2014
Bluegiga Technologies Oy
Page 108 of 274
6.46 SELECT
Command SELECT can be used to switch from command mode to data mode.
6.46.1 Syntax
Synopsis:
SELECT {link_id}
Description:
link_id
Numeric connection identifier
Response:
No response if a valid link is selected. iWRAP goes to data mode of the link link_id.
Events:
SYNTAX ERROR
This event occurs if an invalid link_id is given
6.46.2 Examples
Changing between links:
LIST
LIST 2
LIST 0 CONNECTED RFCOMM 668 0 0 243 8d 8d 00:07:80:80:38:77 1 OUTGOING ACTIVE
MASTER ENCRYPTED
LIST 1 CONNECTED RFCOMM 668 0 0 419 8d 8d 00:07:80:80:36:85 1 OUTGOING ACTIVE
MASTER ENCRYPTED
SELECT 1 (iWRAP switches to data mode with link ID 1)
4.8.2014
Bluegiga Technologies Oy
Page 109 of 274
6.47 SET
With the SET command, you can display or configure different iWRAP configuration values.
6.47.1 Syntax of SET Commands
Synopsis:
SET [{category} [{option} {value}]]
Description:
Without any parameters, SET displays the current configuration. Using the category as the only parameter,
only the settings which are under that category are listed.
category
Category of setting
BT
Changes different Bluetooth related settings. See SET BT commands
for more information about options.
CONTROL
Changes different iWRAP settings. See SET CONTROL commands for
more information about options.
PROFILE
Activates or deactivates Bluetooth profiles.
link_id
This command is used to control the various settings related to
Bluetooth links in iWRAP. These are, for example, master, slave and
power save modes (SNIFF and ACTIVE).
option
Option name, which depends on the category. See the following sections for
more information.
value
Value for the option. See the following sections for more information.
4.8.2014
Bluegiga Technologies Oy
Page 110 of 274
Response:
None if issued with parameters
SET {category} {option} {value}
If no parameters given displays current iWRAP settings.
Events:
None
6.47.2 Examples
Listing current settings:
SET
SET BT BDADDR 00:07:80:80:c2:37
SET BT NAME WT12
SET BT CLASS 50020c
SET BT AUTH * 9078
SET BT LAP 9e8b33
SET BT PAGEMODE 4 2000 1
SET BT PAIR 00:07:cf:51:f6:8d 9c4e70d929a83812a00badba7379d7c2
SET BT PAIR 00:14:a4:8b:76:9e 90357318b33817002c5c13b62ac6507f
SET BT PAIR 00:60:57:a6:56:49 3b41ca4f42401ca64ab3ca3303d8ccdc
SET BT ROLE 0 f 7d00
SET BT SNIFF 0 20 1 8
SET CONTROL BAUD 115200,8n1
SET CONTROL CD 80 0
SET CONTROL ECHO 7
SET CONTROL ESCAPE 43 00 1
SET
4.8.2014
Bluegiga Technologies Oy
Page 111 of 274
6.48 SET BT AUTH
SET BT AUTH shows or sets the local device’s PIN code.
6.48.1 Syntax
Synopsis:
SET BT AUTH {mode} {pin_code}
Description:
mode
Pin code usage mode:
*
Pin code will be displayed by SET” command.
-
Pin code will NOT be displayed by “SET” command.
pin_code
PIN code for authorized connections. Authorization is required if this option is
present. The PIN code can be from 0 to 16 characters.
Response:
No response
Events:
None
List format:
If PIN code is not set SET BT AUTH * is not displayed
SET BT AUTH * {pin_code}
If PIN code is set
SET BT AUTH *
If pin code set with “SET BT AUTH
Note:
If command “SET BT AUTH *” is given, PIN code will be disabled and no encryption can be used during
Bluetooth connections.
4.8.2014
Bluegiga Technologies Oy
Page 112 of 274
6.49 SET BT BDADDR
SET BT BDADDR shows the local device’s Bluetooth address.
6.49.1 Syntax
Synopsis:
SET BT BDADDR
Description:
No description
Response:
SET BT BDADDR {bdaddr}
Events:
None
List format:
SET BT BDADDR {bd_addr}
bd_addr
Bluetooth device address of the local device
Note:
This value is read-only!
— — # — hnp://b|uetoothrpentest.narod.ru/soflware/bluetooth class of device’service qeneratorhtml
4.8.2014
Bluegiga Technologies Oy
Page 113 of 274
6.50 SET BT CLASS
SET BT CLASS sets the local device’s Bluetooth Class-of-Device (CoD). Class of device is a
parameter, which is received during the device discovery procedure, indicating the type of device and
which services are supported.
6.50.1 Syntax
Synopsis:
SET BT CLASS {class_of_device}
Description:
class_of_device
Bluetooth Class-of-Device of the local device
AUTO
If this flag is used iWRAP automatically sets the class of device
during boot time.
Response:
None
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
List format:
SET BT CLASS {class_of_device}
Note:
The class-of-device parameter should reflect the features and supported profiles of a Bluetooth
device. Refer to the Bluetooth specification for more information.
A useful tool to work out Class of Device can be found from:
http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html
4.8.2014
Bluegiga Technologies Oy
Page 114 of 274
6.51 SET BT FILTER
SET BT FILTER command provides filtering options for the INQUIRY results. The filter makes it
possible to limit the amount of inquiry results so that it show only devices that you are interested of. SET
BT FILTER affects also the devices that SET CONTROL AUTOPAIR can detect.
6.51.1 Syntax
Synopsis:
SET BT FILTER {cod} {cod_mask} [rssi [address address_mask]
Description:
Cod
If class of device of a device found in inquiry matches the cod when ran through a
cod_mask it will be shown in inquiry results. Below is description of this process in
more programming orientated notation:
If (device_cod & cod_mask == cod) then show device
cod_mask
Is used as a bit mask for the CoD found in inquiry. Please see cod parameter
description for more information.
Rssi
Sets the lower threshold for RSSI. Setting rssi to 0 disables RSSI filtering. The
allowed range of values is -128 to -1.
address
If Bluetooth address of a device found in inquiry matches the address when ran
through a address_mask it will be shown in inquiry results. Below is description of
this process in more programming orientated notation:
If (device_address & address_mask == address) then show device
address_mask
Is used as a bit mask for the Bluetooth address found in inquiry. Please see
address parameter description for more information.
Disable:
SET BT FILTER
Response:
None
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
4.8.2014
Bluegiga Technologies Oy
Page 115 of 274
List format:
SET BT FILTER {cod} {cod_mask} [rssi [address address_mask]
6.51.2 Examples
Filters inquiry results to only include peripherals.
SET BT FILTER 0500 1F00
Filters inquiry results to only include devices with RSSI of -65 dB or better.
SET BT FILTER 0 0 -65
Filters inquiry results to only include devices with address :::66::*.
SET BT FILTER 0 0 0 0:0:0:66:00:00 0:0:0:FF:0:0
4.8.2014
Bluegiga Technologies Oy
Page 116 of 274
6.52 SET BT IDENT
This command changes the device identification information. By default vendor and product information
of Bluegiga is used. The settings can be replaced in case system in which the module is used has a
valid vendor ID from USB Implementer’s forum. A reset is needed for the setting to take place.
6.52.1 Syntax
Synopsis:
SET BT IDENT {src}:{vendor_id} {product_id} {version} [descr]
Description:
src
This attribute indicates which organization assigned the VendorID attribute. There
are two possible values: BT for the Bluetooth Special Interest Group (SIG) or USB
for the USB Implementer’s Forum.
vendor_id
Intended to uniquely identify the vendor of the device. The Bluetooth SIG or the
USB IF assigns VendorIDs. Bluegiga’s VendorID is 47.
product_id
Intended to distinguish between different products made by the vendor in question.
These IDs are managed by the vendors themselves, and should be changed when
new features are added to the device.
version
Vendor-assigned version string indicating device version number. This is given in
the form of major.minor.revision, for example “3.0.0”.
descr
Optional freeform product description string.
Respone:
SYNTAX ERROR
This event occurs if incorrect parameters are given
Events:
None
List format:
SET BT IDENT {src}:{vendor_id} {product_id} {version} [descr]
4.8.2014
Bluegiga Technologies Oy
Page 117 of 274
6.52.2 Examples
Changing the description string, but using VID and PID from Bluegiga:
SET BT IDENT BT:47 f000 5.0.0 My Description String
RESET
Using own VID and PID.
SET BT IDENT USB:99 ffff 1.0.0 My Description String
RESET
4.8.2014
Bluegiga Technologies Oy
Page 118 of 274
6.53 SET BT LAP
This command configures the Inquiry Access code (IAC) that iWRAP uses. IAC is used in inquiries and
inquiry responses.
6.53.1 Syntax
Synopsis:
SET BT LAP {iac}
Description:
iac
Value for the inquiry access code. The following values are possible:
9e8b33
General/Unlimited Inquiry Access Code (GIAC). This is the default value.
9e8b00
Limited Dedicated Inquiry Access Code (LIAC).
9e8b01 - 9e8b32 and 9e8b34-9e8b3f
Reserved for future use.
Response:
SYNTAX ERROR
This event occurs if incorrect parameters are given
Events:
None.
List format:
SET BT LAP {iac}
4.8.2014
Bluegiga Technologies Oy
Page 119 of 274
Note:
IAC is very useful in cases where the module needs to be visible in the inquiry but only for
dedicated devices, such as other iWRAP modules, but not for standard devices like PCs or
mobile phones. When the value of IAC is left to default value 9E8B33(GIAC) iWRAP will be
visible for all devices capable of making an inquiry. On the other, hand when IAC is set to
9E8B00 (LIAC), only devices capable of making limited inquiry will be able to discover iWRAP.
Using LIAC will usually speed up the inquiry process since standard Bluetooth device like
mobile phones and PC will normally not respond to inquiry.
4.8.2014
Bluegiga Technologies Oy
Page 120 of 274
6.54 SET BT MTU
SET BT MTU configures the Maximum Transfer Unit (payload size) for Bluetooth RFCOMM
connections. iWRAP tries to use this MTU by default for all outgoing RFCOMM connections, and this is
the maximum iWRAP will accept for incoming connections.
6.54.1 Syntax
Synopsis:
SET BT MTU {mtu} [sdp_mtu]
Description:
mtu
Maximum Transfer Unit. Valid range: 21 to 1009.
sdp_mtu
Maximum Transfer Unit for incoming SDP queries. Optional parameter.
Response:
None
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
List format:
SET BT MTU {mtu} [sdp_mtu]
Note:
The remote device may not accept as large MTU as iWRAP wants to use and MTU may be
limited to a smaller value.
6.54.2 Examples
Changing the default MTU to 1000 bytes.
SET BT MTU 1000
4.8.2014
Bluegiga Technologies Oy
Page 121 of 274
6.55 SET BT NAME
SET BT NAME configures the local device’s friendly name.
6.55.1 Syntax
Synopsis:
SET BT NAME {friendly_name}
Description:
friendly_name
Friendly name of the local device
Response:
None
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
List format:
SET BT NAME {friendly_name}
Note:
The maximum length of a friendly name is 140 characters in IWRAP 5.5 / 6.0.
If friendly_name is left empty, some devices (like PCs or PDAs) may have problems showing
the device in the inquiry.
PAIR ERR MAX PAIRCOUNT bd addr
4.8.2014
Bluegiga Technologies Oy
Page 122 of 274
6.56 SET BT PAIRCOUNT
This command can be used to set the maximum amount of pairings iWRAP will accept.
6.56.1 Syntax
Synopsis
SET BT PAIRCOUNT {max_pairings}
Description
max_pairings
0-16
Valid values are 0-16 (decimal). Values 0 and 16 disable pair count limiting.
Response
None
Events
PAIR {bd_addr}
ERR_MAX_PAIRCOUNT
This event will be received when the maximum number
of pairings already exists, and the pair event config bit is
set, and the automatically delete old pairings config bit is
not set.
List format
SET BT PAIRCOUNT {max_pairings}
Note:
It is highly recommended that config bit 12 (automatically make room for new pairings) is set, because if
the maximum pair count is reached and a remote party wishes to pair to us, they may see a successful
pairing followed by a failed connection attempt, because we have no room to store the new link key
while at the same time they have stored it.
Also, SET BT PAIRCOUNT should never be issued before all the pairings are cleared, because it may
not parse partially filled pairing tables correctly. When using SET BT PAIRCOUNT, you should set it
only once. If you need to change the pairing count, delete all old pairings before doing it.
4.8.2014
Bluegiga Technologies Oy
Page 123 of 274
6.57 SET BT PAGEMODE
SET BT PAGEMODE configures or displays the local device’s page mode.
Page mode controls whether iWRAP can be seen in the inquiry and whether it can be connected. This
command can also be used to change the page timeout.
6.57.1 Syntax
Synopsis:
SET BT PAGEMODE {page_mode} {page_timeout} {page_scan_mode} [{alt_page_mode}
{conn_count}]
Description:
page_mode
This parameter defines the Bluetooth page mode.
0
iWRAP is NOT visible in the inquiry and does NOT answers calls
1
iWRAP is visible in the inquiry but does NOT answers calls
2
iWRAP is NOT visible in the inquiry but answers calls
3
iWRAP is visible in the inquiry and answers calls
4
Just like mode 3 if there are NO connections. If there are
connections, it is like mode 0. (default value)
page_timeout
0001 FFFF
Page timeout defines how long the connection establishment can
take before an error occurs. Page timeout is denoted as a
hexadecimal number (HEX) and calculated as in the example
below:
2000 (HEX) equals 8192 (DEC). Multiply it by 0.625 and you get the
page timeout in milliseconds. In this case, it is 5120 ms (8192 *
0,625ms).
page_scan_mode
This parameter configures the Bluetooth page scan mode. The possible values
are:
0
Mode R0 means that iWRAP IS connectable all the time. High
current consumption! Since iWRAP is all the time connectable, it will
not be visible in the inquiry, no matter what the page mode
4.8.2014
Bluegiga Technologies Oy
Page 124 of 274
configuration is.
1
Mode R1 means that iWRAP is connectable every 1.28 sec (the
default value)
2
Mode R2 means that iWRAP is connectable every 2.56 sec (lowest
power consumption)
alt_page_mode
Alternative page mode which is applied when the connection count reaches conn
count. Has same possible values as the page_mode.
conn_count
When module has equal amount or more connections to different devicompared to
conn_count, alt_page_mode is used as the page mode.
Response:
SYNTAX ERROR
This event occurs if incorrect parameters are given
Events:
None
List format:
SET BT PAGEMODE {page_mode} {page_timeout} {page_scan_mode} [{alt_page_mode}
{conn_count}]
Note:
If page scan mode is set to 0 iWRAP will be visible even if page mode is set to 1.
Command “SET BT PAGEMODE” returns default values.
If no alternative page mode is set the list format will only contain the first three parameters
If multiple devices connect or pair at exactly the same time, pagemode 4 (and alt_page_mode)
may not limit the connections properly. If this is an issue, lowering pskey MAX_ACLS to the
desired number of maximum connections will force the module to reject additional connections.
4.8.2014
Bluegiga Technologies Oy
Page 125 of 274
6.58 SET BT PAIR
SET BT PAIR displays or configures the local device’s pairing information.
6.58.1 Syntax
Synopsis:
SET BT PAIR {bd_addr} {link_key}
Description:
bd_addr
Bluetooth address of the paired device
link_key
Link key shared between the local and the paired device.
If this value is empty, pairing for the given Bluetooth address will be removed. Link
key is 32hex values long.
Response:
SYNTAX ERROR
This event occurs if incorrect parameters are given
Events:
None
List format:
SET BT PAIR is not displayed if there are no pairings
SET BT PAIR {bd_addr} {link_key}
One line per pairing is displayed
Note:
iWRAP supports up to 16 simultaneous pairings. If 16 devices have been already paired, new
pairings will not be stored.
If command “SET BT PAIR *” is given, all pairings will be removed.
Issuing “SET BT PAIR without parameters lists current pairings.
Note that the byte ordering has changed since iWRAP4 to avoid the need to convert link keys to
Frontline sniffer software format.
4.8.2014
Bluegiga Technologies Oy
Page 126 of 274
6.59 SET BT POWER
This command changes the TX power parameters of the Bluetooth module. Notice that SET BT
POWER will automatically round the powers levels to the closest value which exists in a so called radio
power table.
6.59.1 Syntax
Synopsis:
SET BT POWER [RESET] | [{default} {maximum} [inquiry]]
Description:
If no parameters are given, displays current TX power settings.
RESET
Returns default TX power values and resets iWRAP
default
Default TX power in dBm. The default TX power used for CALL and NAME
operations and when responding to inquiries and connection requests.
maximum
Maximum TX power in dBm. Bluetooth power control may raise the TX power up to
this value.
inquiry
Transmit power in dBm used for INQUIRY operation. This is an optional parameter
introduced in iWRAP version 3.0.0: if not given, inquiry power is unchanged; by
default is equal to the default TX power.
Respone:
SYNTAX ERROR
This event occurs if incorrect parameters are given
Events:
None
List format:
SET BT POWER {default} {maximum} {inquiry}
4.8.2014
Bluegiga Technologies Oy
Page 127 of 274
6.59.2 Examples
Change the default TX power to 0, maximum TX power to 4 and inquiry power to 0.
SET BT POWER 0 4 0
Note:
Please see the table below for the Bluetooth power classes:
Power class:
Max. TX power:
Nominal TX power:
Minimum TX power:
1
20 dBm
N/A
0dBm
2
4dBm
0dBm
-6 dBm
3
0dbm
N/A
N/A
Table 9: Power TX power classes as defined in Bluetooth specification
The values passed with SET BT POWER will always be rounded to the next available value in
the radio power table.
If possible, always use default values!
4.8.2014
Bluegiga Technologies Oy
Page 128 of 274
6.60 SET BT ROLE
This command configures or displays the local device’s role configuration. With the SET BT ROLE
command, iWRAP’s master-slave behavior can be configured. This command can also be used to set
the supervision timeout and link policy.
6.60.1 Syntax
Synopsis:
SET BT ROLE {ms_policy} {link_policy} {supervision_timeout}
Description:
ms_policy
This parameter defines how the master-slave policy works.
0
This value allows master-slave switch when calling, but iWRAP
does not request it when answering (default value).
1
This value allows master-slave switch when calling, and iWRAP
requests it when answering.
2
If this value is set, master-slave switch is not allowed when
calling, but it is requested for when answering.
This bitmask controls the link policy modes. It is represented in
a hexadecimal format.
link_policy
Bit 1
If this bit is set, Role switch is enabled
Bit 2
If this bit is set, Hold mode is enabled
Bit 3
If this bit is set, Sniff mode is enabled
Bit 4
If this bit is set, Park state is enabled
F
This value enables all of the above modes (the default value)
0
4.8.2014
Bluegiga Technologies Oy
Page 129 of 274
This value disables all of the above modes
supervision_timeout
0001 FFFF
Supervision timeout controls how long a Bluetooth link is kept
open if the remote end does not answer. Supervision timeout is
denoted as a hexadecimal number (HEX) and is calculated as
in the example below:
12C0 (HEX) is 4800 (DEC). Multiply it by 0,625 and you get the
supervision timeout in milliseconds. In this case, it is 3000 ms
(4800 * 0,625ms).
In other words, the remote end can be silent for three seconds
until the connection is closed.
Response:
None
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
List format:
SET BT ROLE {ms_policy} {link_policy} {supervision_timeout}
Note:
If a master-slave switch occurs during the connection setup the supervision timeout set with
SET BT ROLE in the master device will not be used, unless SET CONTROL CONFIG bit 3 in
config block 1 is set. This forces iWRAP to update the supervision timeout after a master-slave
switch.
Command “SET BT ROLE” restores default values.
4.8.2014
Bluegiga Technologies Oy
Page 130 of 274
6.61 SET BT SCO
This command sets the SCO parameters used for (regular) CVSD and MSBC connections. MSBC is
supported by WT32i for HFP1.6 connections where both end support Wide Band Speech.
6.61.1 Syntax
Synopsis:
SET BT SCO {esco_latency} {esco_retx} {esco_packets} [msbc_latency msbc_retx msbc_packets ]
[NOWBS]
Description:
esco_latency
Maximum latency in milliseconds (hexadecimal number). FF means that iWRAP
has no preference about the maximum latency.
esco_retx
Retransmission effort:
0 No retransmission
1 Power saving optimized retransmission
2 Link quality optimized retransmission
FF No preference
esco_packets
Mask of allowed esco and sco packets:
001 HV1
002 HV2
004 HV3
008 EV3
010 EV4
020 EV5
040 2-EV3
080 3-EV3
100 2-EV5
200 3-EV5
msbc_latency
msbc_retx
msbc_packets
msbc_latency, msbc_retx and msbc_packets have the same values as esco_*
but are used only for MSBC connections. If the values are omitted, defaults are
used. MSBC is the codec used in Wide Band Speech in HFP 1.6 connections.
[NOWBS]
Optional flag NOWBS disables the Wide Band Speech codec.
4.8.2014
Bluegiga Technologies Oy
Page 131 of 274
Response:
None
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
List format:
SET BT SCO {esco_latency} {esco_retx} {esco_packets} [msbc_latency msbc_retx msbc_packets ]
Note:
esco_packets combines allowed packets for both eSCO and legacy SCO connections.
IWRAP first tries to establish eSCO connection (using the selected EV packets) and if that fails
falls back to SCO connection (using the selected HV packets).
Legacy SCO connections don't allow setting of maximum latency or retx effort.
6.61.2 Examples
Default settings.
SET BT SCO A 1 4D D 2 48
This example disables MSBC (Wide Band Speech) codec, but allows eSCO and SCO packets.
SET BT SCO NOWBS
Disable legacy SCO packets.
SET BT SCO A 1 48 D 2 48
Disable eSCO packets and MSBC and allow only legacy SCO packets (Do not use with iPhone).
SET BT SCO A 1 5 D 2 0 NOWBS
4.8.2014
Bluegiga Technologies Oy
Page 132 of 274
6.62 SET BT SNIFF
This command enables or disables automatic sniff mode for Bluetooth connections. Notice that remote
devices may not support sniff.
6.62.1 Syntax
Synopsis:
SET BT SNIFF {max} {min} [{attempt} {timeout} [active]]
or
SET BT SNIFF 0
Description:
Max
Maximum acceptable interval in milliseconds
Range: 0004 to FFFE; only even values are valid
Time = max * 0.625 msec
Time Range: 2.5 ms to 40959 ms
Min
Minimum acceptable interval in milliseconds
Range: 0002 to FFFE; only even values, up to max, are valid
Time = min * 0.625 ms
Time Range: 1.25 ms to 40959 ms
attempt
Number of Baseband receive slots for sniff attempt.
Length = N* 1.25 ms
Range for N: 0001 7FFF
Time Range: 0.625ms - 40959 ms
timeout
Number of Baseband receive slots for sniff timeout.
Length = N * 1.25 ms
Range for N: 0000 7FFF
Time Range: 0 ms - 40959 ms
active
Number of seconds the link will stay active before going to sniff mode. The link will
go back to active mode whenever data is received or transmitted if this parameter
is set.
Response:
None
4.8.2014
Bluegiga Technologies Oy
Page 133 of 274
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
List format:
SET BT SNIFF {max} {min} {attempt} {timeout} [active]
Note:
Supervisor timeout set with SET BT ROLE must be longer than maximum acceptable sniff
interval.
SET BT SNIFF 0 disables automatic sniff mode (this is the default, shown in the output of SET
command at line "SET BT SNIFF 0 20 1 8").
You can not change sniff mode on the fly with “SET BT SNIFF”, but you need to close all active
Bluetooth connections, then change the sniff setting and reopen the connections. If you want to
be able to control the sniff mode and keep the connections active, disable “SET BT SNIFFuse
command “SET {link_id} SNIFF” instead.
It is recommended to set the active parameter to a reasonable value (for example between 10
to 120 seconds) to avoid forcing the link always to sniff mode.
4.8.2014
Bluegiga Technologies Oy
Page 134 of 274
6.63 SET BT SSP
This command configures the Bluetooth 2.1 + EDR compliant Secure Simple Pairing mode.
6.63.1 Syntax
Synopsis
SET BT SSP {capabilities} {mitm}
Description
capabilities
0
Display only
1
Display + yes/no button
2
Keyboard only
3
None
Mitm
0
Man-in-the-middle protection not required (but if the remote end requires
MITM, iWRAP will attempt MITM as well)
1
Man-in-the-middle protection required. Due to how the CSR baseband
controller works, link keys without MITM protection may be generated if the
remote end does not have suitable capabilities, and the iWRAP user
wrongly accepts the MITM confirmation request. The subsequent
connection will fail, but the unauthenticated key will still exist. See SET
CONTROL CONFIG optional block 3, bit 0 for forcing iWRAP to discard
such link keys.
Response
None
Events
None
Illll‘x A Ian-s - - oannyOnIy DIIphyVfllo gym-«my pl‘ «unenc Lom- Nuns": um Passwy trfiy: Numenc unm- palm" vnlh paism m. M Dis- palm" will: manic mm mm now play lm 2mm con» «man... nn «mum on Input mm m ham m device B onIy bum devices Unanmenm Unammm A mmrcmd Umulhemr DisplayOnly ram-1 cated caed WWWW paisnn win paison: aw. W up pum- nit. Emma: Carlin lI‘xL lnnfi'mon devicernty. devioerva. mm , “mad ,. “mend W nipIunIIo mini and WWW: nnmmm Inmm DI:- Imam Du- IniIIamm and palm" wIIh play. pIay. Responds! amaticm may Input filmationou Input nun may-m , mmmea Amman Unamhernr Keyboard envy sled m [Alh- Mm WI!- Mum ball- mmmc WI- “ un— m cm— mc mn— m mm mm mm (mm In fnmfin-I m (mm on Im- devim device B wt] m device: bum device: " I I. a I V 7 U , pn- dad and and and
4.8.2014
Bluegiga Technologies Oy
Page 135 of 274
List format
SET BT SSP {capabilities} {mitm}
Note:
According to the Bluetooth 2.1 + EDR specification SSP pairing must always be enabled.
The Bluegiga recommendation is that that the “just works” mode is enabled and to support older
devices without SSP also the PIN code is enabled. If the remote device will not support SSP iWRAP
will fall back to PIN code. Recommended configuration is therefore
“SET BT SSP 3 0”
“SET BT AUTH * {pin}”
Man in the middle protection does not work if either end claims to be a "display only" device
while the other end is "display with buttons".
Figure 7: IO capability mapping to authentication stage 1
interface is not recommended for A2DP audio. Usin the S/PDIF
4.8.2014
Bluegiga Technologies Oy
Page 136 of 274
6.64 SET CONTROL AUDIO
This command controls the physical interface routing of audio on WT32i.
6.64.1 Syntax
Synopsis
SET CONTROL AUDIO {sco_routing} {a2dp_routing} [EVENT] [KEEPALIVE] [AAx] [i2s_bits]
Description
sco_routing
a2dp_routing
INTERNAL
Routes SCO/A2DP input and output through the internal PCM codec to the
analogue input and output.
PCM
Routes SCO/A2DP to the PCM pins (see the WT32i schematic.)
I2S
Routes SCO/A2DP to the PCM pins with the module acting as I2S master.
I2S_SLAVE
Same as above, but acting as Slave.
SPDIF
Routes SCO/A2DP to the PCM pins in S/PDIF encoding. Using the S/PDIF
interface is not recommended for A2DP audio. Please see the WT32
datasheet for more information.
EVENT
Issue this to receive audio routing events (and DSP codec events in WT32i).
KEEPALIVE
Prevents DSP from powering down between A2DP streams. Removes possible
clicks and pops from the beginning of the analog audio stream. Might decrease
also A2DP latency. Increases power consumption when not streaming audio.
AAx
GPIO for A2DP stream indication. Can have values from AA0 to AA11 where the
x indicates GPIO used for indicating ongoing A2DPstream.
i2s_bits
Specify the number of bits per sample when using I2S master mode. Can be
16/20/24/32 (default 24).
Response
None
AUDIO ROUTE {I 1 it Lie 1 A2DP CODEC (c 1 {c )_{r l BITPOOL 2-250
4.8.2014
Bluegiga Technologies Oy
Page 137 of 274
Events
AUDIO ROUTE {link_id}
{type} {channels}
This event occurs when the audio routings are changed; e.g. when an
A2DP or SCO connection is started or closed.
{link_id} indicates the link ID of the connection where the audio is
received or sent.
{type} indicates the type of the audio (SCO, A2DP or TUNE).
{channels} indicates which channels are used for the audio: LEFT,
RIGHT, or both.
A2DP CODEC {codec}
{channel_mode} {rate}
BITPOOL 2-250
This event occurs with a WT32i when a codec is loaded into the DSP,
e.g. when an A2DP starts or resumes after SCO is disconnected.
{codec} indicates which codec is used. Only SBC is included in the
standard iWRAP. AAC can be enabled, but requires separate IP
licensing (see A2DP application note). aptX is integrated into a special
version of iWRAP, which can be evaluated on demand; please contact
our Sales department for further information.
{channel_mode} can be JOINT_STEREO, STEREO, DUAL_CHANNEL
or MONO.
{rate} is the sampling rate in Hz.
List format
SET CONTROL AUDIO {sco_routing} {a2dp_routing} [EVENT] [KEEPALIVE] [AAx] [i2s_bits]
Notes about usage of the I2S interface:
- HFP supports only 8kHz in normal (CVSD) mode or 16kHz in wide-band speech (WBS) mode
when connected to remote devices which support WBS. The WT32i module doesn't do internal
sample rate conversion, so for an HFP connection, the I2S master would need to clock the
appropriate sample rate expected for that mode.
- The I2S stream is always stereo, but IWRAP will only use the left channel with HFP (right
channel contents should be ignored).
- IWRAP is flexible about the bitdepth when configured as I2S SLAVE. The bitdepth per channel
can be anything between 16 and 32. The BCLK for CVSD should then be between 256 kHz
(8kHz*2*16 ) and 512 kHz (8kHz*2*32) and for WBS/MSBC between 512 kHz (16kHz*2*16)
and 1024 kHz (16kHz*2*32).
4.8.2014
Bluegiga Technologies Oy
Page 138 of 274
6.65 SET CONTROL AUTOCALL
SET CONTROL AUTOCALL enables or disables the AUTOCALL functionality in iWRAP.
When the AUTOCALL feature is enabled, iWRAP tries to form a connection with a paired (see “SET BT
PAIR”) device until the connection is established. If the connection is lost or closed, iWRAP tries to
reopen it.
If there are several paired devices in iWRAP memory, an inquiry (transparent to the user) is made and
the first paired device found is connected.
6.65.1 Syntax
Synopsis:
SET CONTROL AUTOCALL {target} {timeout} {profile}
Description:
target
RFCOMM, HFP or HFP-AG, HID or A2DP target for the connection. The target can
be one of the following:
channel
RFCOMM channel number
HFP channel number
HFP-AG channel number
Format: xx (hex)
uuid16
16-bit UUID for searching channel
Format: xxxx (hex)
uuid32
32-bit UUID for searching channel
Format: xxxxxxxx (hex)
uuid128
128-bit UUID for searching channel
Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (hex)
L2CAP psm
16-bit L2CAP psm
Format: xxxx (hex)
timeout
Timeout between calls (in milliseconds)
profile
Defines the connection mode to be established.
Possible modes are:
4.8.2014
Bluegiga Technologies Oy
Page 139 of 274
RFCOMM
Normal RFCOMM connection
HFP
Opens a connection in the Hands Free device mode.
HFP-AG
Opens a connection in the Hands Free Audio Gateway mode.
A2DP
Opens a connection in the Advanced Audio Distribution Profile (A2DP)
mode or Audio Video Remote Control Profile (AVRCP) mode. L2CAP psm
for A2DP is 19 and for AVRCP 17.
HID
Opens a connection in the HID keyboard mode or HID mouse mode.
L2CAP psm for HID is 11.
L2CAP
Opens a generic L2CAP connection.
“Any other profile”
Any other type of profile can also be used.
Disable:
SET CONTROL AUTOCALL
Response:
SYNTAX ERROR
This event occurs if incorrect parameters are given
Events:
None
List format:
If AUTOCALL is not enabled, “SET
CONTROL AUTOCALL” will not be
displayed
4.8.2014
Bluegiga Technologies Oy
Page 140 of 274
SET CONTROL AUTOCALL {target} {timeout} {profile}
When AUTOCALL is enabled
Note:
If AUTOCALL is enabled no manual “CALL” commands should be given to iWRAP.
INQUIRY commands may fail when AUTOCALL is enabled, because AUTOCALL makes
inquiries (transparent to the user) if multiple devices are paired.
6.65.2 Examples
Periodically every 5000ms tries to call to paired devices’s service with UUID 1101.
SET CONTROL AUTOCALL 1101 5000 RFCOMM
4.8.2014
Bluegiga Technologies Oy
Page 141 of 274
6.66 SET CONTROL AUTOPAIR
SET CONTROL AUTOPAIR enables or disables the AUTOPAIR functionality in iWRAP.
When the AUTOPAIR feature is enabled, iWRAP tries to create a pairing with devices it finds in inquiry.
The pairing can be attempted using multiple PIN codes.
Please see SET BT FILTER command for information how to limit the amount of devices the INQUIRY
process discovers. AUTOPAIR functionality can be used together with AUTOCALL functionality.
AUTOPAIR feature is paused when there is active connection or whenever there is existing pairing.
6.66.1 Syntax
Synopsis:
SET CONTROL AUTOPAIR {interval} {timeout} [PIN code list]
Description:
interval
Defines the period between autopairing attempts (in units of 1.28 seconds)
timeout
Defines the inquiry timeout (in units of 1.28 seconds)
PIN code list
Space delimited list of PIN codes that are used for pairing attempts. PIN code set
with SET BT AUTH command is included by default.
Disable:
SET CONTROL AUTOPAIR
Response:
SYNTAX ERROR
This event occurs if incorrect parameters are given
Events:
None
4.8.2014
Bluegiga Technologies Oy
Page 142 of 274
List format:
If AUTOPAIR is not enabled, “SET
CONTROL AUTOPAIR will not be
displayed
SET CONTROL AUTOPAIR {interval} {timeout} [PIN code list]
When AUTOPAIR is enabled
6.66.2 Examples
Enables autopairing with period of 25 seconds and inquiry timeout of 5 seconds. Pin codes 1234 and
8888 will be tried automatically.
SET CONTROL AUTOPAIR 20 4 1234 8888
BATTERY LOW iv 1 BATTERY SHUTDOWN 1V 1 BATTERY FULL iv 1
4.8.2014
Bluegiga Technologies Oy
Page 143 of 274
6.67 SET CONTROL BATTERY
This command enables low battery indication and automatic shutdown. This command is only for WT32i
module.
6.67.1 Syntax
Synopsis
SET CONTROL BATTERY {low} {shutdown} {full} {mask}
Description
low
When battery voltage drops below this level, iWRAP will start sending low
battery warning events, and drives high the PIO(s) according to mask. Maximum
value is 3700 (millivolts).
shutdown
When battery voltage drops below this level, iWRAP will automatically shut itself
down to prevent the battery from completely draining. Maximum value is 3300
(millivolts).
full
When battery voltage rises above this level, the low battery warnings cease and
the low battery indicator PIO(s) is/are driven low.
mask
Hexadecimal PIO mask to select the PIO(s) used to indicate low battery status.
Response
None
Events
BATTERY LOW {voltage}
This event indicates that the battery is low. iWRAP will keep sending
these events until the battery is full.
{voltage} current battery voltage in millivolts.
BATTERY SHUTDOWN
{voltage}
This event indicates that the battery voltage has fallen below the
shutdown threshold. The module will shut down immediately.
{voltage} current battery voltage in millivolts.
BATTERY FULL
{voltage}
This event indicates that the battery is full and low battery warnings will
cease.
{voltage} current battery voltage in millivolts.
4.8.2014
Bluegiga Technologies Oy
Page 144 of 274
List format
SET CONTROL BATTERY {low} {shutdown} {full} {mask}
4.8.2014
Bluegiga Technologies Oy
Page 145 of 274
6.68 SET CONTROL BAUD
This command changes the local device’s UART settings.
6.68.1 Syntax
Synopsis:
SET CONTROL BAUD {baud_rate},8{parity}{stop_bits}
Description:
baud_rate
UART baud rate in bps. See modules data sheet for suitable values.
parity
UART parity setting
n
No parity
e
Even parity
o
Odd parity
stop_bits
Number of stop bits in UART communications
1
One stop bit
2
Two stop bits
Response:
None
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
4.8.2014
Bluegiga Technologies Oy
Page 146 of 274
List format:
SET CONTROL BAUD {baud_rate},8{parity}{stop_bits}
6.68.2 Examples
Configuring local UART to 9600bps, 8 data bits, no parity and 1 stop bit
SET CONTROL BAUD 9600,8N1
Note:
If you enter an incorrect or invalid baud rate and can not access iWRAP any more, the only way
to recover the module is via the SPI interface by deleting the value of PS-key : PSKEY_USR26.
Please see chapter 10.1 PS-keys and how to change them for information how to change the
PS-keys.
4.8.2014
Bluegiga Technologies Oy
Page 147 of 274
6.69 SET CONTROL BIND
With SET CONTROL BIND, it is possible to bind iWRAP commands to GPIO pins.
6.69.1 Syntax
Synopsis:
SET CONTROL BIND {pri} [io_mask] [direction] [command]
Description:
pri
Command priority. Determines the order in which the commands bound to a PIO are
executed (lowest pri is executed first).
pri range is 0-7
pri is an absolute value for all bindings, so there cannot be two or more similar pri
values (also across SET CONTROL BIND commands with different io_mask)
If only pri parameter is given, then the current bind will be removed.
io_mask
Determines which PIO is to be bind.
In WT11i, WT12 and WT41 possible PIOs are PIO2 to PIO7
In WT32i possible PIOs are PIO0 to PIO10
This is a hexadecimal value.
Example: PIO5 is referred to by 100000bin (5th bit is one) = 20hex
direction
Determines whether PIO is triggered on rising, falling, or on both edges of the signal.
Possible values are:
RISE
Command is executed on rising edge.
FALL
Command is executed on falling edge.
CHANGE
Command is executed on rising and falling edge.
command
Standard iWRAP command or string to be sent to the active Bluetooth link.
The maximum length for command is 31 characters.
4.8.2014
Bluegiga Technologies Oy
Page 148 of 274
Response:
No response
List format:
If no binding exists, “SET CONTROL
BIND” will not be displayed
SET CONTROL BIND {pri} [io_mask] [direction]
[command]
When a binding exists
6.69.2 Examples
Example of binding PIO5 to close the connection with ID 0 and delete all pairings after PIO5 has fallen.
SET CONTROL BIND 0 20 FALL CLOSE 0
SET CONTROL BIND 1 20 FALL SET BT PAIR *
4.8.2014
Bluegiga Technologies Oy
Page 149 of 274
6.70 SET CONTROL CD
This command enables or disables the carrier detect signal (CD) in iWRAP.
Carrier detect signal can be used to indicate that iWRAP has an active Bluetooth connection. With “SET
CONTROL CD” command, one PIO line can be configured to act as a CD signal.
6.70.1 Syntax
Synopsis:
SET CONTROL CD {cd_mask} {mode} [datamode_mask]
Description:
cd_mask
This is a bit mask, which defines the GPIO lines used for CD signaling
For example, value 20 (HEX) must be used for PIO5.
20 (HEX) = 100000 (BIN)
For PIO6, the value is 40
40 (HEX) = 1000000 (BIN)
mode
This parameter defines how the carrier detect signal works.
0
CD signal is driven high if there are one or more connections.
1
CD signal is driven high only in data mode.
2
IO(s) selected with cd_mask are used for indicating the exitence of a
connection. 3rd parameter datamode_mask is mandatory and defines
which IO(s) are used for indicating that the module is in data mode.
datamode_mask
Can be only used in case the mode parameter is set to 2. Defines which GPIO
lines used for CD signaling
For example, value 20 (HEX) must be used for PIO5.
20 (HEX) = 100000 (BIN)
For PIO6, the value is 40
40 (HEX) = 1000000 (BIN)
Events:
SYNTAX ERROR
This event occurs if incorrect parameters are given
4.8.2014
Bluegiga Technologies Oy
Page 150 of 274
List format:
SET CONTROL CD {cd_mask} {mode} [datamode_mask]
6.70.2 Examples
This configuration raises PIO7 when there is ongoing connection. PIO5 is raised when module is also in
data mode.
SET CONTROL CD 80 2 20
4.8.2014
Bluegiga Technologies Oy
Page 151 of 274
6.71 SET CONTROL CODEC
This command controls the preference of A2DP audio codecs, channel modes and sampling rates for
A2DP. In A2DP connections it’s always the device establishing the connection, who decides which
parameters to use and the device receiving the connection needs to adapt to those parameters despite
the configuration set with SET CONTROL CODEC.
6.71.1 Syntax
Synopsis:
SET CONTROL CODEC {codec} {channel_mode} {sampling_rate} {priority}
Description:
codec
Which codec to configure. Standard iWRAP supports only SBC. aptX and
FastStream codecs are available upon request.
channel_mode
Valid channel modes are JOINT_STEREO, STEREO, DUAL_CHANNEL or
MONO.
sampling_rate
Valid sampling rates are 48000 (A2DP sink only), 44100, 32000 and 16000.
priority
This is used to determine which codec to use in case both the module and the
remote end support multiple codecs. Lower priority number means higher
preference.
Response:
None