Ezurio TDK-BTISM Bluetooth Intelligent Serial Module User Manual AT Command Set
Ezurio Ltd Bluetooth Intelligent Serial Module AT Command Set
Ezurio >
Contents
- 1. Users Manual
- 2. AT Command Set
AT Command Set
Bluetooth Serial Module AT Command Set Doc No: Date : Author : XRBLU020-001SW-0 3 Feb 2003 Mahendra Tailor Issue No : 1.9 Page 1 of 38 Bluetooth Serial Module AT Command Set Prepared by : Mahendra Tailor Signature : Authorised by: Signature : © 2003 COPYRIGHT TDK Systems Europe Ltd This document is issued by TDK Systems Europe Limited (hereinafter called TDK) in confidence, and is not to be reproduced in whole or in part without the prior written permission of TDK. The information contained herein is the property of TDK and is to be used only for the purpose for which it is submitted and is not to be released in whole or in part without the prior written permission of TDK. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 2 of 38 Change History Issue 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 Description First Draft *) Added S registers 504,530,531 *) Added commands AT+BTR & AT+BTA *) Audio capability *) Added Chapter “Asynchronous Responses” *) Added S Registers 533 and 534 *) Updated Pin Designation on 40 way connector *) Added S Register 535 *) Error in AT Command sequence in the pure cable replacement chapter corrected *) Removed paragraph regarding unilateral acceptance of incoming call – not an issue anymore *)Added the “Frequently Asked Questions” Chapter *)Added NickH’s comments *) Updated the “pure cable replacement” chapter *) Added the AT&F* command for completely erasing the nvram *) AT+BTI now returns ERROR 27 if S Reg 518 is set too high *) ERROR 17,18 and 19 no longer reported *) New Asynchronous response => PAIR n*) Version = 0.3.6 *) S Reg 533 now takes value 0 to 2 inclusive *) Added S Reg 525 *) Added the Motherboard Chapter *)Corrected details for SReg 508 to 511 inclusive *)AT&F command modified *)Added Power Consumption Chapter © TDK Systems Europe Ltd 2003 Author M Tailor M Tailor Date 4-Oct-2002 16-Oct-02 M Tailor M Tailor M Tailor M Tailor 31-Oct-02 1 Nov 02 12 Nov 02 6 Dec 02 M Tailor 9 Dec 02 M Tailor 2 Jan 03 M Tailor M Tailor 14 Jan 03 3 Feb 03 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 3 of 38 Contents 1. Introduction 2. AT Command Set 2.1 Assumptions ....................................................................................................................................6 2.2 Commands ......................................................................................................................................6 2.2.1 AT................................................................................................................................6 2.2.2 ATZ {Hardware Reset}.........................................................................................6 2.2.3 ATEn {Enable/Disble Echoes} .............................................................................7 2.2.4 AT&Fn {Set S Reg Defaults}................................................................................7 2.2.4 AT&F* {Clear NonVolatile Storage} ....................................................................7 2.2.5 AT&W {Write S Regs to Non-Volatile Memory} ...................................................7 2.2.6 ATIn {Information} ................................................................................................8 2.2.7 ATSn=m {Set S Register} ....................................................................................9 2.2.6 Future S Registers ......................................................................................................10 2.2.8 ATSn? {Query S Register}...................................................................................11 2.2.9 ATD {Make Connection}.....................................................................11 2.2.10 ATDU {Make Authenticated Connection}...........................................11 2.2.11 ATDY {Make Encrypted Connection} .................................................11 2.2.12 ATDUY {Make Encrypted/Authenticated Connection} .......................11 2.2.13 ATDYU {Make Encrypted/Authenticated Connection} .......................11 2.2.14 +++ {Enter Command Mode} ................................................................................11 2.2.15 ^^^ {Enter Command Mode} .................................................................................12 2.2.16 ATA {Answer Call} ...............................................................................................12 2.2.17 ATH {Drop Connection} .......................................................................................12 2.2.18 ATO {Enter Online Mode} (letter ‘o’) ...................................................................12 2.2.19 AT+BTO {Open and make Unit Detectable} .....................................12 2.2.20 AT+BTI {Inquire} .................................................................................12 2.2.21 AT+BTIV {Inquire} ..............................................................................13 2.2.22 AT+BTIN {Inquire} ..............................................................................13 2.2.23 AT+BTX {Disable Page/Inquiry Scanning} ..........................................................13 2.2.24 AT+BTQ {Enable Inquiry Scans ONLY} ..............................................................13 2.2.25 AT+BTG {Enable Promiscuous Page Scanning ONLY}......................................13 2.2.26 AT+BTGU {Enable Promiscuous Page Scanning ONLY} ...................................13 2.2.27 AT+BTGY {Enable Promiscuous Page Scanning ONLY} ...................................14 2.2.28 AT+BTGUY {Enable Promiscuous Page Scanning ONLY}.................................14 2.2.29 AT+BTGYU {Enable Promiscuous Page Scanning ONLY}.................................14 2.2.30 AT+BTG {Enable Cautious Page Scanning ONLY}...........................14 2.2.31 AT+BTP {Enable Promiscuous Page Scaning + Inquiry Scans} .........................14 2.2.32 AT+BTPU {Enable Promiscuous Page Scaning + Inquiry Scans} ......................14 2.2.33 AT+BTPY {Enable Promiscuous Page Scaning + Inquiry Scans}.......................15 2.2.34 AT+BTPUY {Enable Promiscuous Page Scaning + Inquiry Scans} .....................15 2.2.35 AT+BTPYU {Enable Promiscuous Page Scaning + Inquiry Scans} ....................15 2.2.36 AT+BTP {Enable Cautious Page Scanning + Inq Scans}..................15 2.2.37 AT+BTN= {Set Friendly Name in NonVol Mem}.....................................15 2.2.38 AT+BTN? {Read Friendly Name from NonVol Mem} ..........................................15 2.2.39 AT+BTF= {Set Friendly Name}...............................................................15 2.2.40 AT+BTS= {Set Service Name} ...............................................................16 2.2.41 AT+BTS? {Read Service Name from NonVol Mem} ...........................................16 2.2.42 AT+BTW {Initiate pairing}.......................................................................16 2.2.43 AT+BTK= {Set Passkey}..........................................................................16 2.2.44 AT+BTT {Add Trusted Device} ............................................................................16 2.2.45 AT+BTT? {List Trusted Devices} .........................................................................17 2.2.46 AT+BTW? {List Cached Trusted Device} ............................................................17 © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 2.2.47 2.2.48 2.2.50 2.2.49 2.2.51 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 4 of 38 AT+BTD {Remove Trusted Device} ......................................................17 AT+BTD* {Remove All Trusted Device} .................................................................17 AT+BTR {Set Peer Address}.................................................................17 AT+BTR? {Display Peer Address}.......................................................................18 AT+BTAn {Control Audio Channel} .....................................................................18 3. Unsolicited Responses 19 3.1 RING................................................................................................................................................19 3.2 PIN?.................................................................................................................................................19 3.3 AUDIO ON.......................................................................................................................................19 3.4 AUDIO OFF .....................................................................................................................................19 3.5 AUDIO FAIL.....................................................................................................................................19 3.6 ERROR 27.......................................................................................................................................19 3.7 PAIR n ...........................................................................................................................19 4. Incoming Connections 20 5. Dropping Connections 21 6. Pairing and Trusted Devices 22 7. Error Responses 23 8. Pin Out 24 9. RS232 Signal Pin Mapping 25 10. Power Consumption and Reset 26 10.1 Reset .....................................................................................................................................26 10.2 Power Consumption..............................................................................................................26 11 Pure Cable Replacement Mode 28 11.1 Data Cable ............................................................................................................................28 11.2 Audio Cable...........................................................................................................................29 12. Frequently Asked Questions 30 13. Development Motherboard 32 14. Use Cases 35 14.1 Example 1: Light Switch Controller .......................................................................................35 14.1.1 Background.................................................................................................................35 14.1.2 AT Command Sequence ............................................................................................35 14.2 Example 2: Remote Data Logger..........................................................................................36 14.2.1 Background.................................................................................................................36 14.2.2 AT Command Sequence ............................................................................................36 14.3 Example 3: Trusted Device Management.............................................................................37 14.3.1 Background.................................................................................................................37 14.3.2 Obtain a new Link Key ................................................................................................37 14.3.3 Store link key in trusted device database ...................................................................37 14.3.4 List trusted device database .......................................................................................37 14.3.5 Store link key in trusted device database (full) ...........................................................38 © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 1. 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 5 of 38 Introduction This document describes the protocol used to control and configure TDK’s Bluetooth Serial Module. The protocol is similar to the industry standard Hayes AT protocol used in telephony modems due to the fact that both types of devices are connection oriented. Appropriate AT commands have been provided to make the module perform the two core actions of a Bluetooth device, which is make/break connections and Inquiry. Many other AT commands are also provided to perform ancillary functions, such as, pairing, trusted devices database management, S Register maintenance etc. Just like telephony modems, the serial module powers up into an unconnected state and will only respond via the serial interface. In this state the module will not even respond to Bluetooth Inquiries. Then, just like controlling a modem, the host can issue AT commands which map to various Bluetooth activities. The command set is extensive enough to allow a host to make connections which are authenticated and/or encrypted or have neither. The device has a serial interface which can be configuration for baudrates from 1200 up to 921600, and an RF communications end point. The latter has a concept of connected and unconnected modes and the former will have a concept of Command and Online mode. This leads to a 2x2 matrix of four states, as shown below. Command Mode Online Mode RF Unconnected OK ILLEGAL RF Connected OK OK One combination, ‘RF unconnected’ and ‘Online Mode’ does not make sense and will be ignored. Navigation between these states is done using the AT commands which are described in detail in subsequent sections. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 2. 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 6 of 38 AT Command Set 2.1 Assumptions The CSR (Cambridge Silicon Radio) BC2 chipset in the TDK Modules is memory resource limited therefore it is NOT proposed that there be full implementation of the AT protocol as seen in modems. The claim made for this device is that it will have a protocol similar to an AT modem. In fact, the protocol is similar enough so that existing source code written for modems, can be used with very little modification for use with this serial module. Therefore the following assumptions are made:1 2.2 All commands will be terminated by the carriage return character 0x0D, which is represented by the string in descriptions below and cannot be changed. All responses from the module will have carriage return and linefeed characters prepending and appending the response. These dual character sequences have the values 0x0D and 0x0A respectively and shall be represented by the string and cannot be changed. All Bluetooth addresses shall be represented by a fixed 12 digit hexadecimal string, case insensitive. All Bluetooth Device Class codes shall be represented by a fixed 6 digit hexadecimal string, case insensitive. All new Bluetooth specific commands shall be identified by the string +BTx, where x is generally a mnemonic of the intended functionality. Commands This section describes all available AT commands. Many commands require mandatory parameters and some take optional parameters. These parameters are either integer values,strings,Bluetooth addresses or device classes. The following convention is used when describing the various AT commands A 12 character Bluetooth address consisting of ascii characters ‘0’ to ‘9’, ‘A’ to ‘F’ and ‘a’ to ‘f’. A 6 character Bluetooth device class consisting of ascii characters ‘0’ to ‘9’, ‘A’ to ‘F’ and ‘a’ to ‘f’. A positive integer value An integer value which could be positive or negative, which can be entered as a decimal value or in hexadecimal if preceded by the ‘$’ character. Eg the value 1234 can also be entered as $4D2 A string delimited by double quotes. Eg “Hello World”. The “ character MUST be supplied as delimiters. 2.2.1 AT Response: 2.2.2 ATZ OK {Hardware Reset} Forces the device through a hardware reset which means it will eventually come alive in the Command mode and Bluetooth Unconnected mode. This allows changes to the PS store to take effect. Allow for about 2 seconds for the device to start responding to AT commands again. The surest way of determining that the device is alive again, is to keep sending it AT until it responds with an OK response. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Response: Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 7 of 38 OK note OK is returned before the RESET 2.2.3 ATEn {Enable/Disble Echoes} It affects S Register 506. Set n=0 to disable echoes and n=1 to enable. All other values will generate an error. Response: OK 2.2.4 AT&Fn {Set S Reg Defaults} This command will only work when the device is in idle mode. Depending on the value of ‘n’ it installs S Reg values appropriate for various power modes, ranging from minimum power consumption to maximum. Legal values of ‘n’ are as per the following table. All other values of n will generate a syntax error response. ‘n’ 0 (Default) Description Medium power consumption, UART baudrate unchanged, Left LED off, Right Led = DCD Minimum power consumption, UART baudrate set to 9600, Both LEDs off Minimum power consumption, UART baudrate set to 38400, Both LEDs off Minimum power consumption, UART baudrate set to 115200, Both LEDs off Medium power consumption, UART baudrate set to 115200, Left LED off, Right Led = DCD Maximum power consumption, UART baudrate set to 115200, Left LED=DSR, Right Led = DCD Maximum power consumption, UART baudrate set to 460800, Left LED=DSR, Right Led = DCD If ‘n’ is not specified then a default value of 0 is assumed where the baudrate is NOT changed. Please refer to the “Power Consumption” chapter further on, for a more detailed discussion of power usage. The new values are NOT updated in nvram until the AT&W command is sent to the module Response: Or Response: OK ERROR nn 2.2.4 AT&F* {Clear NonVolatile Storage} This command will only work when the device is in idle mode. It installs values in S registers as per command AT&F4 and then all other user parameters in non-volatile storage is erased. This means that the trusted device database is cleared, and so are parameters related to the following commands:- AT+BTR, AT+BTN, AT+BTS. Response: Or Response: OK ERROR nn 2.2.5 AT&W {Write S Regs to Non-Volatile Memory} Writes current S Register values to non-volatile memory so that they are retained over a power cycle. This command only works if not in ONLINE_COMMAND mode. This is due to the fact that writing to non-volatile storage is not allowed while a Bluetooth connection is active. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Response: Or Response: 2.2.6 ATIn Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 8 of 38 OK ERROR nn {Information} This will return information about the module. For example, version numbers, manufacturer etc For n=0, the response describes the product. Response: TDK Serial Module OK For n=1, the CSR firmware build number is returned, for example Response: 520 OK For n=2, the TDK Image number is returned, for example Response: 06G OK A letter suffix implies an engineering build for internal use. For n=3, the version number of the vm app is returned, for example Response: 1.01 OK For n=4, a 12 digit hex number corresponding to the Bluetooth address of the device is returned Response: aabbccddee OK For n=5, the Manufacturer of this device is returned Response: TDK Systems Europe Ltd, UK OK For n=6, the maximum size of trusted device database is returned Response: 4 OK For n=7, the manufacturer of the Bluetooth chipset is returned Response: CSR OK For n=8, the chipset designation is returned Response: BC2-EXT OK © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 2.2.7 ATSn=m Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 9 of 38 {Set S Register} There is a concept of registers which are used to store parameters, such as escape sequence character, inquiry delay time etc, as listed in detail below. The value part ‘m’ can be entered as decimal or hexadecimal. A hexadecimal value is specified via a ‘$’ leading character. For example $1234 is a hex number. When S register values are changed, the changes are not stored in non-volatile storage UNTIL the AT&W command is used. Note that AT&W does not affect S registers 520 to 525, 1000 to 1010 as they are updated in non-volatile storage when the command is received. Register ‘n’ Default Range Comment -1..15 ‘^’ 0..255 12 500 501 502 503 504 505 100 50..5000 0..1 0..1 0..1 0..1 0..1 2 .. 120 506 507 0..1 0..2 508 509 510 511 512 640 320 640 320 10..2550 10..2550 10..2550 10..2550 0..4 513 514 515 10 0x000000 0..1 1..60 0.. 0xFFFFFF 516 0xFFFFFF 0.. 0xFFFFFF 517 518 20 2 .. 61 0..255 519 500 100.. 6000 520 115200 300.. 921600 Number of RING indication before auto answering an inbound connection. A value of 0 disables autoanswer. If -1, then autoanswer on one RING and do NOT send RING/CONNECT response to the host. This emulates a serial cable replacement situation. Escape sequence character. It is not ‘+’ by default as a Bluetooth serial link can be used to connect to a mobile phone which exposes an AT command set, which will in turn use ‘+’ as default. So if both used ‘+’ there will be confusion Escape sequence guard time in milliseconds. Default Authentication for outgoing connections, Set to 1 to Enable Authentication Default Encryption for outgoing connections, Set to 1 to Enable Encryption Default Authentication for incoming connections, Set to 1 to Enable Authentication Default Encryption for incoming connections, Set to 1 to Enable Encryption Set to 1 for suppression of CONNECT message to host for outbound connections Delay before abandoning connection attempt as a master. Referenced by the ATD. In units of seconds Enable/Disable echoes. The ATEn command also affects this. When set to 0, a connection can be dropped using ^^^ escape sequence only and the state of DSR line is ignored. When set to 1 a connection can be droped using EITHER the ^^^ escape sequence OR the DSR handshaking line. Finally when set to 2, a connection can only dropped using a deassertion of DSR. Mode 2 provides for the highest data transfer rate. Page Scan Interval in units millisec ( 10ms will give 11.25ms) Page Scan Window in units millisec ( 10ms will give 11.25ms) Inquiry Scan Interval in units of millisec ( 10ms will give 11.25ms) Inquiry Scan Window in units of millisec ( 10ms will give 11.25ms) Specify power up state. If set to 0 then AT+BTO is required to open the device for Bluetooth activity. When set to 1, it proceeds to a state as if AT+BTO was entered. When set to 2, it will scan for inquiries only, similar to issuing AT+BTQ. When set to 3, it will page for a connection but not be discoverable eg AT+BTG and finally when set to 4, it will be like AT+BTP. Note that by implication, a change to this can only be seen after a power cycle AND if AT&W is actioned prior to the power cycle. Pairing Authentication , 1 = Enable Pairing Timeout in seconds Default Device Class Code to be used with AT+BTO when it is not explicitly specified. When queried, the value is always printed as a hex number. Default Device Class Code to be used with AT+BTI when it is not explicitly specified. When queried the value is always printed as a hex number. Inquiry Length in units of seconds. This parameter is referenced by the AT+BTI command Maximum number of responses from an inquiry request . This parameter is reference by the AT+BTI command. If this number is set too high, then AT+BTI will return ERROR 27. For a particular firmware revision, determine the effective maximum value by trial and error. That is, set to a high value, send AT+BTI and if ERROR 27 is returned, then retry with a smaller value. This effective max value will remain unchanged for that particular firmware build. When S507>0, and in a connection, DSR can be used to change from online to command state by deasserting the DSR line for less than the time specified in this register. This value is rounded down to the nearest 100ms Change baudrate. The effect is immediate and in fact the OK will be sent at the new baudrate. Due to the integer arithmetic involved, the actual baudrate is different. To inspect the actual baudrate, do ATS521? ATS520? will return the baudrate to the nearest 100. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Issue No : 521 115200 300.. 921600 522 523 524 525 See Comment 1..2 0..2 0..1 530 1000 100.. 15000 531 532 0..1 0..3 533 0..2 534 0..1 535 20 0..41 540 0 48-127 1001 to 1010 610 620 n/a 0..31 0..31 621 622 623 624 625 626 627 628 n/a n/a n/a n/a n/a n/a n/a n/a 0..1 0..1 0..1 0..1 0..1 1.9 Doc No : XRBLU020-001SW-0 If Sreg 525=1, then the max baudrate is limited to 115200 Change baudrate. The effect is immediate and in fact the OK will be sent at the new baudrate. Due to the integer arithmetic involved, the actual baudrate is different. To inspect the actual baudrate, do ATS521? If Sreg 525=1, then the max baudrate is limited to 115200 1 = CTS/RTS hardware handshaking enabled Number of StopBits Parity. 0=None, 1=Odd, 2=Even Apply multiplier of 8 to baudrate internally. This is set to 0 (disabled) by default for the serial module, and set to 1 (enabled) by default for the pc card variant. It is required in the pc card because the UART chip on the pc card is driven by a 14.7456MHZ crystal instead of 1.8432MHz. This means that when a host asks for a baudrate, in reality it gets a baudrate which is 8 times faster. If S Reg 520 > 115200 then this register cannot be set to 1. Reconnect delay when configured as master in pure-cable-replacement mode. This value is rounded down to the nearest 100ms If Set to 1 then on connection, remain in Command Mode. If non zero then on every connection, and SCO channel (audio) will be initiated. If value =1 then HV1, if =2 then HV2 and finally if =3 then HV3 If set to 1 then left LED follows RI state, if set to 2 then it follows the state of DSR and if 0 then neither and GPIO5 is available as a user i/o. This register will not necessarily be effective immediately after changing the value. It must be saved to non-volatile store using AT&W and will operate as expected after an ATZ or a power cycle. If set to 1 then right LED follows DCD state, otherwise GPIO4 is available as user i/o. This register will not necessarily be effective immediately after changing the value. It must be saved to non-volatile store using AT&W and will operate as expected after an ATZ or a power cycle. Link Supervision Timeout. If units go out of range, then a NO CARRIER message will be sent to the host after the time specified here Sets the MTU in L2CAP configuration negotiations. The value of 0 is a special value which is taken to mean that the current value should remain. 10 General Purpose 32 bit Registers for use by host. These are stored in non-volatile memory. Set direction of digital i/o lines Read/Write to all 8 Digital lines in one atomic step. The value is returned as a 4 digit hex value wth trailing 0s. Read/Write to GPIO1 Read/Write to GPIO2 Read/Write to GPIO3 Read/Write to GPIO4 Read/Write to GPIO5 Read/Write to GPIO6 - Not Available so 0 always returned Read/Write to GPIO7 - Not Available so 0 always returned Read/Write to GPIO8 - Not Available so 0 always returned 0.. 2^32 2.2.6 Future S Registers The following registers are planned for the future. Register 601 602 603 604 Default n/a n/a Response: Range TBD TBD 0..1 0..1 Comment Read/Write to Analogue Line 1 Read/Write to Analogue Line 2 Set direction of Analogue Line 1 Set direction of Analogue Line 2 OK If the register is not recognised or the value specified is out of range then Response: Page 10 of 38 ERROR nn © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 2.2.8 ATSn? Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 11 of 38 {Query S Register} This will return the current value of register n. For recognised values of n Response: As Appropriate OK For unrecognised values of n Response: ERROR nn 2.2.9 ATD {Make Connection} Make a connection to device with Bluetooth addess . Authentication and Encryption is as per S registers 500 and 501. The timeout is specified by S register 505 Response: Or CONNECT 123456789012 NO CARRIER 2.2.10 ATDU {Make Authenticated Connection} Make an authenticated connection to device with Bluetooth addess . Encryption is disabled. Response: Or CONNECT 123456789012 A NO CARRIER 2.2.11 ATDY {Make Encrypted Connection} Make an encrypted connection to device with Bluetooth addess . Authentication is disabled Response: Or CONNECT 123456789012 E NO CARRIER 2.2.12 ATDUY {Make Encrypted/Authenticated Connection} Make an encrypted and authenticated connection to device with Bluetooth addess . Response: Or CONNECT 123456789012 AE NO CARRIER 2.2.13 ATDYU {Make Encrypted/Authenticated Connection} Make an encrypted and authenticated connection to device with Bluetooth addess . Response: Or 2.2.14 +++ CONNECT 123456789012 AE NO CARRIER {Enter Command Mode} Usually this is the escape sequence for forcing a modem into command mode when in online state. Since this device could be used to connect to a mobile phone modem over a Bluetooth serial port profile, it could confuse matters considerably, therefore the sequence ^^^ is used as described next. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 2.2.15 ^^^ Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 12 of 38 {Enter Command Mode} When in online and connected mode, the host can force the device into a command and connected mode so that AT Commands can be issued to the device. The character in this escape sequence is specified in the S2 register , so can be changed. In addition, the escape sequence guard time is specified by S Register 12. By default the guard time is set to 100 milliseconds. Please refer to Section 5: Dropping Connections for more related information. Response: 2.2.16 ATA OK {Answer Call} Accept an incoming connection. Which is indicated by the unsolicited string RING 123456789012 every second. Where 123456789012 is the Bluetooth address of the connecting device. Response: 2.2.17 ATH CONNECT 123456789012 {Drop Connection} Drop an existing connection or reject an incoming connection indicated by unsolicited RING messages Response: 2.2.18 ATO OK {Enter Online Mode} (letter ‘o’) Return to online data mode. Assume online after OK is received. Will repond with ERROR if there is no Bluetooth connection Response: OK or Response: ERROR nn 2.2.19 AT+BTO {Open and make Unit Detectable} After power up and ATZ, this command is sent so that RFCOMM is initialised and opened and the service name as specified in AT+BTN is exposed via the SDP registry. The value specifies a device class code mask and is a fixed length hex digit optional string. If it is not specified, then the device class code is taken from S register 515. For this command to be effective S Register 512 must be set to 0. 2.2.20 AT+BTI {Inquire} This will make the device perform an inquiry for device class code cccccc for delay milliseconds and max number of unique responses, where delay is specified by S register 517 and max is specified by S register 518. The value specifies a device class code and is a fixed length hex digit optional string. If it is not specified, then the device class code is taken from S register 516. must be exactly 6 hex characters long. Response: 12346789012 12345678914 OK © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 13 of 38 ERROR RESPONSE A Bluetooth inquiry process is such that for a single inquiry request a device could respond many times. To ensure that an address is sent to the host only once for a particular AT+BTI, an array of addresses is created at the start of each AT+BTI and is filled as responses come in. This array of addresses is stored in dynamic memory and as such if the memory allocation fails then the inquiry procedure is aborted and in that case an error response is sent to the host. To clarify, a single AT+BTI will never return the same Bluetooth address more than once, but as long as the responding device is active, all AT+BTI commands will always return it. Response: ERROR 27 2.2.21 AT+BTIV {Inquire} As per AT+BTI but the response includes the device class code for all inquiry responses. Please refer to the ‘ERROR RESPONSE’ note in the description for AT+BTI . Response: 12346789012,123456 12345678914,123456 OK 2.2.22 AT+BTIN {Inquire} As per AT+BTI but the response includes the device class code and friendly name for all inquiry responses. Please refer to the ‘ERROR RESPONSE’ note in the description for AT+BTI . Response: 12346789012,123456,”TDK AT DONGLE 1” 12345678914,123456,”TDK AT DON7GLE 3” OK 2.2.23 AT+BTX {Disable Page/Inquiry Scanning} Disable page/inquiry scanning. This means it will not accept incoming connections or inquiry requests. In fact this negates the effect of AT+BTQ, AT+BTG and AT+BTP commands Response: OK 2.2.24 AT+BTQ {Enable Inquiry Scans ONLY} When inquiry scan is enabled, it implies that this device will respond to inquiries from other devices. Use AT+BTX to disable inquiries. Response: OK 2.2.25 AT+BTG {Enable Promiscuous Page Scanning ONLY} Enable page scanning only and wait for a connection from any device. Inquiry scans are disabled Response: OK 2.2.26 AT+BTGU {Enable Promiscuous Page Scanning ONLY} Enable page scanning only and wait for a connection from any device. Inquiry scans are disabled. Authentication is enabled and Encryption is disabled. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Response: Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 14 of 38 OK 2.2.27 AT+BTGY {Enable Promiscuous Page Scanning ONLY} Enable page scanning only and wait for a connection from any device. Inquiry scans disabled Response: OK 2.2.28 AT+BTGUY {Enable Promiscuous Page Scanning ONLY} Enable page scanning only and wait for a connection from any device. Inquiry scans are disabled. Authentication is disabled and Encryption is enabled. Response: OK 2.2.29 AT+BTGYU {Enable Promiscuous Page Scanning ONLY} Enable page scanning only and wait for a connection from any device. Inquiry scans are disabled. Both Authentication and Encryption is enabled. Response: OK 2.2.30 AT+BTG {Enable Cautious Page Scanning ONLY} Enable page scanning and wait for a connection from device with Bluetooth address . If the specified address is 000000000000 then incoming connections are accepted from any device, is as per AT+BTP without an address. Inquiry Scans are disabled This command also has variants which allow authentication and encryption to be explicitly specified. For example:AT+BTGU123456789012 AT+BTGY123456789012 AT+BTGUY123456789012 AT+BTGYU123456789012 Response: OK 2.2.31 AT+BTP {Enable Promiscuous Page Scaning + Inquiry Scans} Enable page scanning and wait for a connection from any device. Inquiry scanning is also enabled. Authentication and Encyprion is as per defaults in S registers Response: OK 2.2.32 AT+BTPU {Enable Promiscuous Page Scaning + Inquiry Scans} Enable page scanning and wait for a connection from any device. Inquiry scanning is also enabled. Authentication is enabled but Encryption is disabled. Response: OK © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 2.2.33 AT+BTPY Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 15 of 38 {Enable Promiscuous Page Scaning + Inquiry Scans} Enable page scanning and wait for a connection from any device. Inquiry scanning is also enabled. Authentication is disabled but Encryption is enabled. Response: OK 2.2.34 AT+BTPUY {Enable Promiscuous Page Scaning + Inquiry Scans} Enable page scanning and wait for a connection from any device. Inquiry scanning is also enabled. Both Authentication and Encryption is enabled. Response: OK 2.2.35 AT+BTPYU {Enable Promiscuous Page Scaning + Inquiry Scans} Enable page scanning and wait for a connection from any device. Inquiry scanning is also enabled. Both Authentication and Encryption is enabled. Response: OK 2.2.36 AT+BTP {Enable Cautious Page Scanning + Inq Scans} Enable page scanning and wait for a connection from device with Bluetooth address . If the specified address is 000000000000 then incoming connections are accepted from any device, is as per AT+BTP without an address. Inquiry scanning is also enabled. This command also has variants which allow authentication and encryption to be explicitly specified. For example:AT+BTPU123456789012 AT+BTPY123456789012 AT+BTPUY123456789012 AT+BTPYU123456789012 Response: OK 2.2.37 AT+BTN= {Set Friendly Name in NonVol Mem} This sets the default friendly name of this device as seen by other devices. It will be stored in a non volatile storage area. Use AT+BTF to make the name visible to other devices. Use AT+BTN? to read it back Response: OK 2.2.38 AT+BTN? {Read Friendly Name from NonVol Mem} Reads the default friendly name from non-volatile store. Response: ”My FriendlyName” OK 2.2.39 AT+BTF= {Set Friendly Name} This sets the friendly name of this device as seen by other devices Response: OK © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 Issue No : 2.2.40 AT+BTS= 1.9 Doc No : XRBLU020-001SW-0 Page 16 of 38 {Set Service Name} This writes the name to non-volatile storage area. It will be used after ATZ, power cycle or AT+BTO if it has not been issued yet. Use AT+BTS? to read it back from non-volatile store. Response: OK If the service name cannot be set for any reason then an error response ERROR 11 is returned. 2.2.41 AT+BTS? {Read Service Name from NonVol Mem} Reads the default fservice name from non-volatile store. Response: ”My ServiceName” OK 2.2.42 AT+BTW {Initiate pairing} This initiates pairing with a device whose Bluetooth address is . An OK response is sent and when the PIN is required, asynchronous indications will be sent to the host in the form PIN? where the address confirms the device with which the pairing is to be performed. To supply a PIN, use the AT+BTK command detailed next. For a successful pairing, the link key is stored in a volatile cache which is overwritten everytime a new pairing is initiated using this command. The link key can be stored in a non-volatile database within the device. The list of trusted devices is managed using commands AT+BTT?, AT+BTT and AT+BTD. The AT+BTT? command produces a list of trusted Bluetooth addresses (link key is NEVER displayed) and AT+BTT is used to store the cached link key. The command AT+BTD123456789012 is used to remove the specified device from the data base. The “OK” response is sent immediately on receipt of the AT+BTW command. On pairing completion, an unsolicited message will be sent to the host which will be in the form PAIR n . See section 3.7 for more details. Response: OK 2.2.43 AT+BTK= {Set Passkey} This command is used to provide a passkey when PIN? 12345678 indications are received asynchronously. If a pairing is not in progress then the pin is written to non-volatile store for future use. Specifying an empty string deletes the key from the non-volatile store. The string length must be in the range 0 to 8, otherwise an error will be returned. Response: OK 2.2.44 AT+BTT {Add Trusted Device} This command is used to store the cached link key in the non-volatile database. If the database is full it will respond with an ERROR. If the device is already in the database, then the key is replaced. If the link key cache is empty, that is, a pairing has not been performed since the device was powered, then the response will be an ERROR. Response: OK or ERROR © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 2.2.45 AT+BTT? Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 17 of 38 {List Trusted Devices} This command is used to list the contents of the trusted device database. The link key is NOT displayed so the response is as shown below. If the list is empty then just the OK response is sent otherwise an OK is used to terminate the list. Use the command ATI6 to read the maximum size of the trusted device database Response: 12346789012 12345678913 12345678914 OK 2.2.46 AT+BTW? {List Cached Trusted Device} This command is used to list the cached trusted device and the response is as follows. Response: 12346789012 OK If the cache is empty the the response is as follows. Response: OK 2.2.47 AT+BTD {Remove Trusted Device} This command is used to remove the specified device from the list of trusted devices in the non-volatile database. If the device is not in the database then the response will still be an OK. Response: OK 2.2.48 AT+BTD* {Remove All Trusted Device} This command is used to remove all devices from the list of trusted devices in the non-volatile database. No confirmation will be asked for. So beware !!! Response: OK 2.2.50 AT+BTR {Set Peer Address} This command is used to store a peer address in non-volatile storage. A value of 000000000000 has the special meaning of invalid peer address. This command is used to set up a module in pure cable replacement mode. If S register 512 = 1 and the peer address is NOT 000000000000, then it will periodically (time specified via S register 505) attempt to connect to the peer address specified. If S register 512 = 3 or 4 then it will wait for an inbound connection from the peer address specified. If the peer address is not 000000000000, then it waits for a connection from the specified master, otherwise will connect to anyone. Response: OK © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3 Feb 03 2.2.49 AT+BTR? Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 18 of 38 {Display Peer Address} This command is used to display the peer address stored in non-volatile storage, used to put the module in pure cable replacement mode. Response: 12346789012 OK If the location is empty the the response is as follows. Response: 00000000000 OK 2.2.51 AT+BTAn {Control Audio Channel} Once a Bluetooth connection is active, and assuming the peer device is a TDK Serial Module, this command is used to start/stop a SCO channel which will connect the PCM interfaces of the two peer devices. This means that if a codec is attached to the PCM pins, then 2 way audio can be established. The parameter is 0 to switch off the channel and it is 1 to switch it off. On receipt of the command, the following response immediately follows. Response: OK The lower layers then go through the process of seting up the SCO channel, and as soon as a SCO link is established, the following response is asynchronously sent to the host. Response: AUDIO ON Or if the SCO failed to be established … Response: AUDIO FAIL On the peer device, the host will asynchronously get …. Response: AUDIO ON © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 3. 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 19 of 38 Unsolicited Responses The ‘AT’ Protocol is a command/response type of protocol. This means that the TDK Serial Module will normally only respond to AT commands. Under special circumstances, unsolicited responses will be sent to the host. They are described in the following subsections. 3.1 RING This string is sent to the host when a remote device is initiating a serial port connection. The fully qualified string is in the form RING 012345678901 where 012345678901 is a 12 digit hex number which corresponds to the remote device’s Bluetooth address. This response is sent to the host every 2 seconds until the host either accepts the connection using the ATA command or rejects it using the ATH command. 3.2 PIN? This response is sent to the host during a pairing negotiation. The fully qualified string is PIN? 012345678901 where 012345678901 is the Bluetooth address of the peer device. In response, the host must supply a pin code which is entered using the AT+BTK command. If the peer address does not supply the address in the message exchange, then the address is specified as 000000000000 – and the paring will proceed as normal. 3.3 AUDIO ON This response is sent to the host when a SCO channel has been established. 3.4 AUDIO OFF This response is sent to the host when an existing SCO channel has been closed. 3.5 AUDIO FAIL This response is sent to the host when a SCO channel setup fails. 3.6 ERROR 27 This response is sent to the host on power up if the firmware is unlicensed. 3.7 PAIR n This response is sent to the host on termination of a pairing process. If pairing was successful then ‘n’ = 0, if a timeout occurred then ‘n’=1 and for all other unsuccessful outcomes the value will be 2. The parameter is the address of the peer device if available. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 4. 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 20 of 38 Incoming Connections The serial module can be configured using the AT+BTP or AT+BTG command so that it will scan for incoming connections from other Bluetooth devices. When the lower layers detect an incoming call, a RING 123456789012 string is sent to the host every second. The command ATA is used to accept the connection and ATH to reject it. On connection, if the S0 Register is >=0 then confirmation to the host is in the form:CONNECT 123456789012 CONNECT 123456789012 A CONNECT 123456789012 E CONNECT 123456789012 AE Where ‘A’ means authenticated connection and ‘E’ means encryption has been enabled. When S0 register is -1, neither RING nor CONNECT is sent to the host and the connection is silently accepted. © TDK Systems Europe Ltd 2003 Bluetooth Serial Module AT Command Set Date : 5. 3 Feb 03 Issue No : 1.9 Doc No : XRBLU020-001SW-0 Page 21 of 38 Dropping Connections In a conventional telephony modem, a call is normally terminated by first sending a +++ character sequence enveloped by an escape sequence guard time (of the order of 100 to 1000 milliseconds) and then the ATH command. This device will provide a couple of ways of dropping a connection. One method will be similar to the above, but instead a ^^^ character sequence is used, this is to eliminate ambiguity when a data call is in progress via a mobile phone which was established using the mobile phone’s Bluetooth AT modem. The second method will involve the host dropping the DTR (DSR from the module’s viewpoint) handshaking line. Being able to drop a connection using the escape sequence ^^^ has a severe penalty on data throughput, in fact, the data rate is of the order of 85kbps instead of about 200kbps. To cater for this performance hit, the device’s connection drop capability is configurable to be in one of two modes. One mode allows for a connection to be dropped using either method, and the other mode allows for a connection drop using the DTR method only. By default, the device is in former mode. This mode is selected using the S507 register. See S register table described in an earlier section. To reiterate, the escape sequence is as follows: This means that even when a file transfer is occurring and it happens to be full of characters then it is not going to drop into command mode because, when transferring a file it is going to happen as fast as possible and so the inter character gap is going to be significantly shorter than the . The character can be changed via the S2 register and the