INDUSTRIAL BLUETOOTH™ Serial Port Adapter™ Version 2 and 3 AT Commands
Serial Port Adapter™ Version 2 and 3 AT Commands
Copyright © 2003 connectBlue AB. The contents of this document can be changed by connectBlue AB without prior notice and do not constitute any binding undertakings from connectBlue AB. connectBlue AB is not responsible under any circumstances for direct, indirect, unexpected damage or consequent damage that is caused by this document. All rights reserved. Release: 0510 Document version: 3.2 Document number: cBProject-0501-11 (6) Printed in Sweden.
Contents 1. Introduction 8 1.1 Related Documents ........................................................................... 8 2. Data Mode and AT Mode 3. Baud Rate 9 10 4. Configuration and Operation 4.1 4.2 4.3 4.4 4.5 4.6 4.7 LED Indication ................................................................................. 11 Bluetooth Settings............................................................................ 11 Searching for Other Bluetooth Devices .......................................
Introduction 10.2 10.3 10.4 10.5 10.6 Command “AT*”........................................................................... 22 Command “ATZ”.......................................................................... 22 Command “AT&F” ....................................................................... 23 Command “ATS2”........................................................................ 23 Command “ATE”.......................................................................... 23 GAP Commands...
Contents 10.7 11. Model Compatibility 6 Add_Change_Favorite (AT*ACACF=)......................................... 52 Delete_Favorite (AT*ACDF=) ...................................................... 53 Read_Allow_Configuration_Over_Bluetooth (AT*ACCB?) ......... 53 Write_Allow_Configuration_Over_Bluetooth (AT*ACCB=) ......... 54 Read_Controller_Power_Save_Mode (AT*AMPM?)................... 54 Write_Controller_Power_Save_Mode (AT*AMPM=)................... 55 Read_Max_Output_Power (AT*AMMP?) ..............
Introduction 7
Chapter 1: Introduction 1.1: Related Documents Chapter 1 Introduction 1.1 Related Documents • The Serial Port Adapter AT Commands document, this document, contains a description of the AT commands supported in the Serial Port Adapter. It also contains information on how to use the AT commands to create Bluetooth applications. • The OEM Serial Port Adapter Electrical & Mechanical Datasheet contains important information about the OEM Serial Port Adapter.
1.1: Related Documents Chapter 2: Data Mode and AT Mode Chapter 2 Data Mode and AT Mode The Serial Port Adapter can be in two different modes AT mode and data mode. The Serial Port Adapter starts up in data mode and can be requested to move to AT mode by sending an escape sequence. The default escape sequence consists of three consecutive forward slash characters ‘/’. The escape sequence character can be changed using the ATS2 command.
1.1: Related Documents Chapter 3: Baud Rate Chapter 3 Baud Rate The Serial Port Adapter does not support auto baud rate. The baud rate is set using the “Write_RS232_Settings” command. The default RS232 settings are 57600 bits/s, 8 data bits, no parity, 1 stop bit, and hardware flow control. Pressing the restore-button on the Serial Port Adapter, when it is powered up, restores the default serial settings.
Chapter 4: Configuration and Operation 4.1: LED Indication Chapter 4 Configuration and Operation This chapter gives some guidelines on how to perform basic configuration and operation. There are several request packets that can be used to configure the Serial Port Adapter. Many of these request packets take a boolean parameter called . If this parameter is set to 1 the setting will be applied immediately and also when the Serial Port Adapter starts up in the next power cycle.
4.4: Searching for Services Chapter 4: Configuration and Operation Two commands are available to search for other devices: • The “Device Discovery” command returns the Bluetooth device address, the class of device and the name of all the devices in the vicinity that are in discoverable mode. • The “Inquiry” command returns the Bluetooth device address and the class of device of all the devices in the vicinity that are in discoverable mode.
4.6: Master/Slave Handling Chapter 4: Configuration and Operation If you want to use the Wireless Multidrop™ feature and allow several devices to simultaneously connect to your device you must enable Wireless Multidrop™ using the “Write_Wireless_Multidrop_Configuration” command. In addition, the Serial Port Adapter must be configured to perform a master/slave switch every time a device connects to it. This is done using the “Write_MasterSlaveRole_Policy” command.
4.7: Bluetooth Security Chapter 4: Configuration and Operation A master can: • Setup a connection to another device. • Perform searches. • Accept connections from other devices. A slave cannot: • Connect to another device. • Perform searches. • Accept connections from other devices. There are a few settings and parameters that affect how the roles master and slave are assigned to the devices communicating.
4.7: Bluetooth Security Chapter 4: Configuration and Operation • On one device use the “Bond” command. • Create a connection. If authentication or encryption is turned on, on either device, bonding will be performed automatically. It is possible for the Serial Port Adapter to store link keys for several devices at the same time. Use the “Read_Bonded_Devices” command to get a list of the currently bonded devices. It is also possible to remove a device from the list of bonded devices.
5.1: How to Use the Stop Mode Feature Chapter 5: Power Save Modes Chapter 5 Power Save Modes The Serial Port Adapter is optimized to consume as little power as possible. However, the deepest power save mode, called stop mode, is not turned on by default. Instead an AT command (AT*AMPM) is available to allow the host system to turn on the stop mode feature. When the Serial Port Adapter is in stop mode: • It can accept incoming connections over Bluetooth.
6.1: Serial Settings Chapter 6: Restoring Default Configuration Chapter 6 Restoring Default Configuration 6.1 Serial Settings In some situations it is necessary to restore some settings to their default values. The following settings can be restored using the procedure described below: • Serial settings: 57600 baud, 8 data bits, no parity, 1 stop bit, hardware flow control. • Serial interface type: RS232. • AT escape sequence: ‘///’.
6.2: Factory Settings Chapter 7: AT Commands Over Bluetooth Chapter 7 AT Commands Over Bluetooth It is possible to configure and control a remote Serial Port Adapter via Bluetooth using AT commands. Criteria for using AT commands over Bluetooth: 18 • A Bluetooth connection to the remote device (the device to configure) must exist. The Bluetooth connection can e.g. be established using another Serial Port Adapter, a device with a PC-card/compact flash or a device with embedded Bluetooth support.
6.2: Factory Settings Chapter 8: Version 3 vs. Version 2 Chapter 8 Version 3 vs. Version 2 If you are migrating from using the version 2 (second generation) of Serial Port Adapters from connectBlue to version 3 there are some AT commands/events that have been changed, added or removed. Each AT command description will include a table to clarify what the differences are (if any) between different models.
9.1: Command Line Format Chapter 9: Syntax Chapter 9 Syntax 9.1 Command Line Format Each command line sent from the DTE to the DCE is made up of a prefix, body and terminator. As prefix for the Serial Port Adapter AT commands, only “AT” (ASCII 065, 084) and “at” (ASCII 097, 116) can be used. There is no distinction between upper and lower case characters. The body is a string of characters in the range ASCII 032-255.
9.2: Data Types Chapter 9: Syntax String A string shall consist of a sequence of displayable characters from the ISO 8859-1 (8-bit ASCII) character set, except for characters “\” and “"“ and characters below 32 (space). A string constant shall be delimited by two double-qoute (“"“) characters, e.g. “Donald Duck”. If the double-quote character (“"“) is to be used within a string, e.g. "My friend "Bono" is a singer", they have to be represented as “\22”. If the back-slash character (“\”) is to be used withi
10.1: Standard AT Commands Chapter 10: AT Commands Reference Chapter 10 AT Commands Reference 10.1 Standard AT Commands Command “AT” AT Command Description AT Attention command determining the presence of a DCE, i.e. the Serial Port Adapter. Responses Description OK Successful response. ERROR Error response. Command “AT*” AT Command Description AT* Lists the supported AT commands.
10.1: Standard AT Commands Chapter 10: AT Commands Reference cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Command “AT&F” AT Command Description AT&F If the command Store_Factory_Settings has been used to fill the factory settings database then this command will restore all the settings to the factory settings. If the command Store_Factory_Settings has not been used to fill the factory settings database then this command will do nothing. Responses Description OK Successful response.
10.2: GAP Commands Chapter 10: AT Commands Reference echo integer 0: Incoming characters will not be echoed. 1: Incoming characters will be echoed. Responses Description OK Successful response. ERROR Error response. 10.2 GAP Commands Read_Discoverability_Mode (AT*AGDM?) AT Command Description AT*AGDM? This command reads the current GAP discoverability mode. Responses Description *AGDM:OK Successful response.
10.2: GAP Commands Chapter 10: AT Commands Reference ERROR Error response. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Limited discoverability mode not supported. Read_Connectability_Mode (AT*AGCM?) AT Command Description AT*AGCM? This command reads the current GAP connectability mode. Responses Description *AGCM:OK Successful response. ERROR Error response.
10.2: GAP Commands Chapter 10: AT Commands Reference Read_Pairing_Mode (AT*AGPM?) AT Command Description AT*AGPM? Reads the pairing mode. Responses Description *AGPM:OK Successful response. ERROR Error response.
10.2: GAP Commands Chapter 10: AT Commands Reference Result Parameters Type Value security_mode enumerator 1: Link level authentication and encryption disabled (GAP security mode 1 with encryption disabled). 2: Link level authentication and encryption enabled (GAP security mode 3 with encryption enabled). Write_Security_Mode (AT*AGSM=) AT Command Description AT*AGSM=, Writes the GAP security mode.
10.2: GAP Commands Chapter 10: AT Commands Reference ERROR Error message. Response Parameters Type Value device_name string Null terminated string of maximum 240 characters (8-bit ASCII). Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Device names longer than 31 bytes will be truncated. Device_Discovery (AT*AGDD=) 28 AT Command Description AT*AGDD=, Performs device discovery.
10.2: GAP Commands Chapter 10: AT Commands Reference Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. Instead use the Inquiry and Name_Discovery commands. Inquiry (AT*AGI=) AT Command Description AT*AGI=,, Performs an inquiry procedure to find any discoverable devices in the vicinity.
10.2: GAP Commands Chapter 10: AT Commands Reference AT*AGB= Performs a GAP bond procedure with another Bluetooth device. During the bonding procedure the fixed PIN code is used, see the Write_Fixed_PIN and Read_Fixed_PIN commands. Note that to be able to perform bonding the remote device must be in pairable mode. Command Parameters Type Value bd_addr Bd_Addr Bluetooth device address of the device to bond with.
10.2: GAP Commands Chapter 10: AT Commands Reference every found device. ERROR Error message. Response Parameters Type Value no_of_bonded_devices integer Number of bonded devices. bd_addr Bd_Addr Bluetooth device address of the device from which to retrieve the name. device_name_valid enumerator 0: device_Name parameter valid. 1: Device is bonded but its name is not available. Device_Name is parameter invalid. device_name string Name of discovered device.
10.2: GAP Commands Chapter 10: AT Commands Reference pin_code string The PIN code is a string of maximum 16 characters in range {0..9}, e.g. “0145673829029827”. store_in_startup_database enumerator 0: The setting will only be valid for the current power cycle. 1: The Serial Port Adapter will remember the setting between power cycles. The settings database in the Serial Port Adapter will be updated. Responses Description OK Successful response.
10.2: GAP Commands Chapter 10: AT Commands Reference Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 The name is limited to a maximum of 31 characters. Read_Local_COD (AT*AGLC?) AT Command Description AT*AGLC? Reads the Local Class Of Device code. Responses Description *AGLC:OK Successful response. ERROR Error response.
10.2: GAP Commands Chapter 10: AT Commands Reference Command Parameters Type Value cod integer See Read_Local_COD command. store_in_startup_database enumerator 0: The setting will only be valid for the current power cycle. 1: The Serial Port Adapter will remember the setting between power cycles. The settings database in the Serial Port Adapter will be updated. Responses Description OK Successful response. ERROR Error response.
10.2: GAP Commands Chapter 10: AT Commands Reference Change_MasterSlaveRole (AT*AGCMSR=) AT Command Description AT*AGCMSR=, Changes the master-slave role. Changes the role of the Serial Port Adapter, master or slave, for the connection between the Serial Port Adapter and the remote device identified by the ‘bd_addr’ parameter. Note that the remote device does not have to accept the master/slave switch.
10.2: GAP Commands Chapter 10: AT Commands Reference Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. The module always allows a master slave switch if requested by the remote side. Write_MasterSlaveRole_Policy (AT*AGMSP=) AT Command Description AT*AGMSP=, Writes the role policy of the device. Command Parameters Type Value role_policy enumerator 0: Always attempt to become master on incoming connections.
10.3: Service Search Commands Chapter 10: AT Commands Reference Parameters bd_addr Bd_Addr Identifies a device that the Serial Port Adapter is currently communicating with. Responses Description *AGRSS:OK Successful response. ERROR Error response. Response Parameters Type Value rssi integer < 128: The received signal strength is 128-RSSI dB below the optimal signal range. 128: The received signal strength is within the optimal signal range.
10.3: Service Search Commands 38 Chapter 10: AT Commands Reference service_name_valid >, serial port profile service search. *ARSRDUN:, , , , , This response is the result of a GW dialup networking profile service search.
10.4: Data Mode Commands Chapter 10: AT Commands Reference Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Only supports serial port and dial-up networking profiles and not LAN access profile. 10.4 Data Mode Commands Data_Mode (AT*ADDM) AT Command Description AT*ADDM Request the Serial Port Adapter to move to data mode. After a successful response the Serial Port Adapter will leave AT-mode and enter data mode.
10.4: Data Mode Commands Chapter 10: AT Commands Reference must_be_master enumerator 0: The remote device may choose to become master or slave. 1: This device must be master of the new connection. Responses Description *ADCP:OK Successful response. ERROR Error response. Response Parameters Type Value connection_handle integer The connection handle identifies the connection. The connection handle is used when closing the connection.
10.4: Data Mode Commands Chapter 10: AT Commands Reference ERROR Error response. Response Parameters Type Value role_and_profile enumerator 0: DevB role, Serial Port Profile 1: Gateway role, Dial-Up Networking Profile 2: LAN Access Point role, LAN Access Profile 255: No profile Write_Default_Client_Profile (AT*ADDCP=) AT Command Description AT*ADDCP=, This command reads the default client profile.
10.4: Data Mode Commands Chapter 10: AT Commands Reference Responses Description *ADDSP:OK Successful response. ERROR Error response.
10.4: Data Mode Commands Chapter 10: AT Commands Reference Read_Max_No_Of_Remote_Peers (AT*ADMRP?) AT Command Description AT*ADMRP? For some Serial Port Adapters it is possible to have more than one remote peer defined. This command reads the maximum number of allowed remote peers. Responses Description *ADMRP: OK Successful response. ERROR Error response.
10.4: Data Mode Commands Chapter 10: AT Commands Reference Read_Max_No_Of_Remote_Peers command. After writing the number of remote peers the host must use the Write_Default_Remote_Peer command to write all the remote peers to the Serial Port Adapter. For more information see Read_No_Of_Remote_Peers. Command Parameters Type Value no_of_remote_peers integer The number of remote peers. store_in_startup_database enumerator 0: The setting will only be valid for the current power cycle.
10.4: Data Mode Commands Chapter 10: AT Commands Reference connect_scheme integer This parameter is a bit field. Bit 0 is the least significant bit. Each bit is defined as follows: Bit 0: Try to connect to default remote peer on data traffic. Bit 1: Always try to be connected to the default remote peer when in data mode. Bit 2: Try to connect to default remote peer on external signal. The external signal is implementation specific, e.g. some Serial Port Adapters might have a button.
10.4: Data Mode Commands Chapter 10: AT Commands Reference Responses Description OK Successful response. ERROR Error response. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 The parameter is only used when bit 3 in the connect scheme is set. Max length is 32 characters. cB-OEMSPA313 cB-OEMSPA333 cB-OEMSPA13 cB-OEMSPA33 Connect to name functionality is not supported.
10.4: Data Mode Commands Chapter 10: AT Commands Reference Command Parameters Type Value inactivety_tick integer 0: no inactivity tick. 1-255: the period (in minutes) of the inactivity timer. store_in_startup_database enumerator 0: The setting will only be valid for the current power cycle. 1: The Serial Port Adapter will remember the setting between power cycles. The settings database in the Serial Port Adapter will be updated. Responses Description OK Successful response.
10.4: Data Mode Commands Chapter 10: AT Commands Reference *ADWM:, OK ERROR Successful response Error message. Response Parameters Type Value enabled enumerator auto_forward enumerator 0: Wireless Multidrop™ disabled. 1: Wireless Multidrop™ enabled. 0: Data received from a connected device will only be forwarded to the host. 1: Reserved for future use.
10.5: Informational Commands Chapter 10: AT Commands Reference 10.5 Informational Commands Read_Local_BD_ADDR (AT*AILBA?) AT Command Description AT*AILBA? Reads the Bluetooth Device Address of the local device. Responses Description *AILBA:,OK Successful response ERROR Error message. Response Parameters Type Value bd_addr Bd_Addr Local Bluetooth device address.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Responses Description *AMRS:, , , , OK Successful response ERROR Error message.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Command Parameters Type Value baud_rate enumerator See Read_RS232_Settings. data_bits enumerator See Read_RS232_Settings. stop_bits enumerator See Read_RS232_Settings. parity enumerator See Read_RS232_Settings. flow_control enumerator See Read_RS232_Settings. change_after_confirm enumerator 0: The Serial Port Adapter will not change RS232 settings until after the next power cycle.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Command Parameters Type Value serial_interface_type enumerator See Read_Serial_Interface_Type. store_in_startup_database enumerator 0: The setting will only be valid for the current power cycle. 1: The Serial Port Adapter will remember the setting between power cycles. The settings database in the Serial Port Adapter will be updated. Responses Description OK Successful response ERROR Error message.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Command Parameters Type Value bd_addr Bd_Addr Bluetooth device address of the favorite. favorite_name string Maximum 240 characters (8-bit ASCII). Responses Description OK Successful response ERROR Error message. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference *ACCB: OK Successful response ERROR Error message. Response Parameters Type Value allow_configuration_over_bluetooth enumerator 0: Configuration over Bluetooth is not allowed. 1: Configuration over Bluetooth is allowed.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference ters mode enumerator 1: Allow only online mode. The Serial Port Adapter will never enter sleep or stop mode to save power. 2: Allow sleep mode (default value). The Serial Port Adapter will enter sleep mode when possible to save power. 3: Allow sleep mode and stop mode. The Serial Port Adapter will enter sleep or stop mode when possible to save power. 4: As online mode except that the internal clock will always be 32 MHz.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Responses Description *AMMP: OK Successful response ERROR Error message. Response Parameters Type Value max_output_power integer 255: Use the highest output power supported by the Serial Port Adapter as the maximum output power (default).
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Read_Esc_Sequence_Timing (AT*AMET?) AT Command Description AT*AMET? For an escape sequence to be valid, a period of no data activity is required before and after the escape sequence. This command reads the minimum time of no data activity required before and after the escape sequence. Responses Description *AMET:, OK Successful response ERROR Error message.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Command Parameters Type Value button_id integer Identifies the button to control. Responses Description *AMBOR:, OK Successful response ERROR Error message. Response Parameters Type Value operation_mode integer The button operation mode (1=default).
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. Read_LED_Operation_Mode (AT*AMLO?) AT Command Description AT*AMLO? For some Serial Port Adapters it is possible to select an alternate operation mode for control of LEDs. Responses Description *AMLO: , OK Successful response ERROR Error message.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Responses Description OK Successful response ERROR Error message. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. Store_Factory_Settings (AT*AMSF) AT Command Description AT*AMSF Store all the current settings in the factory settings database. The factory settings can be restored using the AT&F command.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference bt_write_timeout integer Time in seconds before SPA disconnects if out of credits. 0: Disabled > 0: Timeout in seconds bt_inactivity_timeout integer Time in seconds before SPA disconnects if no activity. 0: Disabled > 0: Timeout in seconds bt_connect_timeout integer Max connection time in seconds before a connection is terminated.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Responses Description OK Successful response ERROR Error message. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Only implemented to reset the module. All other parameters are ignored. Read_DTR_DSR_Settings (AT*AMDS?) AT Command Description AT*AMDS? Read current DTR/DSR configuration.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference cB-OEMSPA333 cB-OEMSPA13 cB-OEMSPA33 Write_DTR_DSR_Settings (AT*AMDS=) AT Command Description AT*AMDS=, , Write DTR/DSR configuration. Command Parameters Type Value dtr_cfg integer See Read_DTR_DSR_Settings. dsr_cfg integer See Read_DTR_DSR_Settings. store_in_startup_database enumerator 0: The setting will only be valid for the current power cycle.
10.6: Miscellaneous Commands Chapter 10: AT Commands Reference Model Constraint cB-OEMSPA313 cB-OEMSPA333 cB-OEMSPA13 cB-OEMSPA33 Not supported. Write_Link_Policy (AT*AMLP=) 64 AT Command Description AT*AMLP=, , Write link policy. The link policy can be chosen to optimize the link for a specific application.
10.7: Events Chapter 10: AT Commands Reference parameter integer Bit 0: Exit sniff on data activity. Only used when link policy supports sniff. If set the SPA will try to temporarily exit sniff when receiving data on the serial interface. When no data has been received on the serial interface for 1s, then the link will be put back into sniff mode. If not set, then the link will always be in sniff.
Chapter 11: Model Compatibility 10.7: Events Chapter 11 Model Compatibility The following table describes what AT commands different serial port adapter models supports.
10.