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 (8) Printed in Sweden.
Contents 1. Introduction 8 1.1 Related Documents ........................................................................... 8 2. Data Mode and AT Mode 9 3. Baud Rate 10 4. Configuration and Operation 11 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 11. AT Commands Reference 11.1 11.2 11.3 11.4 11.5 11.6 23 Standard AT Commands ................................................................. 23 Command “AT” ............................................................................ 23 Command “AT*”........................................................................... 23 Command “ATZ”.......................................................................... 23 Command “AT&F” ....................................................
Contents 11.7 12. Model Compatibility 6 Write_RS232_Settings (AT*AMRS=) .......................................... 52 Read_Serial_Interface_Type (AT*AMSIT?) ................................ 52 Write_Serial_Interface_Type (AT*AMSIT=) ................................ 53 Read_Favorites (AT*ACF?)......................................................... 53 Add_Change_Favorite (AT*ACACF=)......................................... 54 Delete_Favorite (AT*ACDF=) ...................................................
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 mode1. 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.3: Searching for Other Bluetooth Devices Chapter 4: Configuration and Operation All Bluetooth devices have a ‘class-of-device’ indicator that can be discovered by other devices when they are performing searches. Use the “Write_Local_COD” command to set the ‘class-of-device’. 4.
4.6: Master/Slave Handling Chapter 4: Configuration and Operation join the wireless multidrop network. If configured as a client you must tell the Serial Port Adapter which devices to connect to. Exactly how to configure for Wireless Multidrop™ see Connection Establishment – Server and Connection Establishment – Client. Connection Establishment – Server In AT mode, use the “Write_Default_Server_Profile” command to select what profile to use when acting as a server.
4.7: Bluetooth Security Chapter 4: Configuration and Operation S M S M S S 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 Bonding and Pairing To be able to communicate if security has been enabled, bonding has to be performed. The bonding procedure creates a link key, valid between two devices, which is used during the authentication procedure. Once bonded the two devices can establish connections with each other using security enabled. During bonding both devices must be in pairable mode (able to accept bonding).
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: Optimization Chapter 8 Optimization On some versions of the serial port adapter there are some limited optimization support regarding throughput, response time and power consumption. Typically consider the following settings for the “Write_Link_Policy” command: • High throughput: Link policy 1 and 2 depending on which side is transmitting and receiving. Note that this will only be useful to improve performance in one direction. • Short Response times: Link policy 3.
6.2: Factory Settings Chapter 9: Version 3 vs. Version 2 Chapter 9 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.
10.1: Command Line Format Chapter 10: Syntax Chapter 10 Syntax 10.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.
10.2: Data Types Chapter 10: 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 wit
11.1: Standard AT Commands Chapter 11: AT Commands Reference Chapter 11 AT Commands Reference 11.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.
11.1: Standard AT Commands Chapter 11: 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.
11.2: GAP Commands Chapter 11: AT Commands Reference characters. Command Parameters Type Description echo integer 0: Incoming characters will not be echoed. 1: Incoming characters will be echoed. Responses Description OK Successful response. ERROR Error response. 11.2 GAP Commands Read_Discoverability_Mode (AT*AGDM?) AT Command Description AT*AGDM? This command reads the current GAP discoverability mode.
11.2: GAP Commands Chapter 11: AT Commands Reference 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.
11.2: GAP Commands Chapter 11: AT Commands Reference 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. Read_Pairing_Mode (AT*AGPM?) AT Command Description AT*AGPM? Reads the pairing mode.
11.2: GAP Commands Chapter 11: AT Commands Reference Read_Security_Mode (AT*AGSM?) AT Command Description AT*AGSM? Reads the GAP security mode. Responses Description *AGSM:OK Successful response. ERROR Error response. Result Parameters Type Value security_mode enumerator 1: Link level authentication and encryption disabled (GAP security mode 1 with encryption disabled).
11.2: GAP Commands Chapter 11: AT Commands Reference Bluetooth device address. Command Parameters Type Value bd_addr Bd_Addr Bluetooth device address of the device from which to retrieve the name. Responses Description *AGND:OK ERROR Successful response Error message. Response Parameters Type Value device_name string Null terminated string of maximum 240 characters (8-bit ASCII).
11.2: GAP Commands Chapter 11: AT Commands Reference Response Parameters Type Value no_of_devices integer Value in range {0..255}. Number of devices discovered during the inquiry procedure. bd_addr Bd_Addr Bluetooth device address of a discovered device. cod integer See Read_Local_COD command. device_name_valid enumerator 1: device_Name parameter valid. 0: Device was discovered, but its name could not be retrieved. device_name is parameter invalid and should be ignored.
11.2: GAP Commands Chapter 11: AT Commands Reference Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 If more than 20 devices are found, then devices may be listed several times. Bond (AT*AGB=) AT Command Description 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.
11.2: GAP Commands Chapter 11: AT Commands Reference OK Successful response ERROR Error message. Read_Bonded_Devices (AT*AGBD?) AT Command Description AT*AGBD? Read the bonded devices. Responses Description *AGBD:OK Successful response *AGBDE:,, This response is sent for every found device. ERROR Error message.
11.2: GAP Commands Chapter 11: AT Commands Reference pin_code string The PIN code is a string of one to sixteen alphanumerical characters. It is recommended to use a pin code of at least eight characters of mixed type, e.g. “12w35tg7”. The default value is “0”. Write_Fixed_PIN (AT*AGFP=) AT Command Description AT*AGFP=, Writes the fixed PIN code used by the Serial Port Adapter during bond.
11.2: GAP Commands Chapter 11: AT Commands Reference device name. Command Parameters Type Value device_name string Max 240 characters. The default name is “Bluetooth Device”. 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.
11.2: GAP Commands Chapter 11: AT Commands Reference cod integer Valid values for this parameter are specified in the Bluetooth Assigned Numbers Document, www.bluetooth.com. The parameter has been divided into three segments, a service class segment, a major device class segment and a minor device class segment (bits 2-7).
11.2: GAP Commands Chapter 11: AT Commands Reference Get_MasterSlaveRole (AT*AGGMSR=) AT Command Description AT*AGGMSR= Read the local master-slave role. Returns 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. Command Parameters Type Value bd_addr Bd_Addr Identifies a device that the Serial Port Adapter is currently communicating with.
11.2: GAP Commands Chapter 11: AT Commands Reference Responses Description OK Successful response. ERROR Error response. 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. Read_MasterSlaveRole_Policy (AT*AGMSP?) AT Command Description AT*AGMSP? Reads the role policy of the device.
11.2: GAP Commands Chapter 11: AT Commands Reference Responses Description OK Successful response. ERROR Error response. 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.
11.3: Service Search Commands Chapter 11: AT Commands Reference cB-OEMSPA332 11.3 Service Search Commands Service_Search (AT*ARSS=) AT Command Description AT*ARSS=,, Search for services on a remote device. Command Parameters Type Value bd_addr Bd_Addr Bluetooth device address of the device on which to search for services.
11.4: Data Mode Commands Chapter 11: AT Commands Reference service_name string Service name. audio_feedback_support_valid enumerator 0: The audio_feedback_support parameter could not be retrieved from the remote device and the value is not valid. 1: The audio_feedback_support parameter could be retrieved from the remote device and the value is valid. audio_feedback_support enumerator 0: No, device does not support audio feedback. 1: Yes, device supports audio feedback.
11.4: Data Mode Commands Chapter 11: AT Commands Reference Connect_To_Serial_Service_Data_Mode (AT*ADCP=) AT Command Description AT*ADCP=, , , Connect to a serial service enabled on a remote device. This request is used to connect to profiles based on the Serial Port Profile. The connection shall be used in data mode.
11.4: Data Mode Commands Chapter 11: AT Commands Reference Close_Serial_Connection_Data_Mode (AT*ADCC=) AT Command Description AT*ADCC= Close an existing data mode connection. Command Parameters Type Value connection_handle integer The connection handle identifies the connection. Responses Description OK Successful response. ERROR Error response.
11.4: Data Mode Commands Chapter 11: AT Commands Reference store_in_startup_database enumerator Responses 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. Description OK Successful response. ERROR Error response.
11.4: Data Mode Commands Chapter 11: AT Commands Reference Command Parameters Type Value role_and_profile enumerator 0: DevB role, Serial Port Profile (default value) 1: Gateway role, Dial-Up Networking Profile 2: LAN Access Point role, LAN Access Profile 255: No profile. 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.
11.4: Data Mode Commands Chapter 11: AT Commands Reference Read_No_Of_Remote_Peers (AT*ADNRP?) AT Command Description AT*ADNRP? For some Serial Port Adapters it is possible to have more than one remote peer defined. This command reads the number of remote peers defined. Responses Description *ADNRP: OK Successful response. ERROR Error response.
11.4: Data Mode Commands Chapter 11: AT Commands Reference AT*ADRDRP=< peer_id > This command reads the Bluetooth device address and device name of the selected default remote peer (peer id). Command Parameters Type Value peer_id integer The peer ID can be between 0 and the value written by the Write_No_Of_Peers command –1 or read by the Read_No_Of_Peers command –1.
11.4: Data Mode Commands Chapter 11: AT Commands Reference , , , dress, connect scheme and device name of the currently selected default remote peer. Command Parameters Type Value peer_id integer The peer ID can be between 0 and the value written by the Write_No_Of_Peers command –1 or read by the Read_No_Of_Peers command –1. bd_addr Bd_Addr Bluetooth device address of the default remote peer.
11.4: Data Mode Commands inactivety_tick Chapter 11: AT Commands Reference integer 0: no inactivity tick (default value). 1-255: the period (in minutes) of the inactivity timer. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. Write_Inactivity_Tick (AT*ADIT=) AT Command Description AT*ADIT=, This command writes a new inactivity tick setting.
11.4: Data Mode Commands Chapter 11: AT Commands Reference Connections to remote devices can be established using three methods: • Let the Serial Port Adapter connect to the desired devices when it is in data mode. The host uses the request Write_No_Of_Remote_Peers and Write_Default_Remote_Peer to tell the Serial Port Adapter how many devices to connect to, which devices to connect to and when to connect to the defined devices.
11.5: Informational Commands Chapter 11: AT Commands Reference 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. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. 11.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Response Parameters Type Value manufacturer string Serial Port Adapter manufacturer. sw_ver string Serial Port Adapter software version. host_stack sw_ver string Bluetooth host stack version. link_manager_sw_ver string Bluetooth link manager version. bluetooth_hardware_manufacturer string Bluetooth hardware manufacturer. 11.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference parity enumerator 1: no parity (default value) 2: odd parity 3: even parity flow_control enumerator 1: CTS/RTS used for flow control (default value) 2: CTS/RTS not used. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 For the non-standard baud rates the 312500 and 625000 has an accuracy of 1.5% and 2.5 %. For all other baud rates the accuracy is no worse than 0.5 %.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Responses Description *AMSIT: OK Successful response ERROR Error message. Response Parameters Type Value serial_interface_type enumerator 1: RS232 (default value) 2: RS422 3: RS485 4-255: Reserved for future use.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Response Parameters Type Value no_of_stored_favorites integer Number of stored favorite devices. bd_addr string Bluetooth device address of the stored favorite. favorite_name string Name of favorite. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. Add_Change_Favorite (AT*ACACF=) AT Command Description AT*ACACF=, Add or change a favorite.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Responses Description OK Successful response ERROR Error message. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. Read_Allow_Configuration_Over_Bluetooth (AT*ACCB?) AT Command Description AT*ACCB? Determine whether or not configuration over Bluetooth is allowed. Configuration can either be performed using AT commands or using the ECI protocol.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference store_in_startup_database enumerator Responses 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. Description OK Successful response ERROR Error message.
11.6: Miscellaneous Commands store_in_startup_database Chapter 11: AT Commands Reference enumerator Responses 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. Description OK Successful response ERROR Error message.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference AT*AMMP=, Set the maximum output power to be used by the Serial Port Adapter when communicating. Note that not all Serial Port Adapter models support output power control. Command Parameters Type Value max_output_power integer See Read_Max_Output_Power. store_in_startup_database enumerator 0: The setting will only be valid for the current power cycle.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Write_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 sets the minimum time of no data activity required before and after the escape sequence. Command Parameters Type Value min_before_time integer See Read_Esc_Sequence_Timing.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported. Write_Button_Operation_Mode (AT*AMBO=) AT Command Description AT*AMBO=, , , For some Serial Port Adapters it is possible to select the operation that shall be associated with a specific button.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Response Parameters Type Value operation_mode integer The new LED operation mode (1=default). general_parameter integer The meaning of this parameter depends on the value of the operation_mode parameter. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Not supported.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Responses Description OK Successful response ERROR Error message. Model Constraint cB-OEMSPA311 cB-OEMSPA331 cB-OEMSPA312 cB-OEMSPA332 Only available in production. Read_Watchdog_Settings (AT*AMWS?) 62 AT Command Description AT*AMWS? Read current watchdog settings. Watchdog settings are only active in data mode and not AT or ECI mode.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Write_Watchdog_Settings (AT*AMWS=) AT Command Description AT*AMWS=, , , , , Write watchdog parameters. The watchdog functionality is only active in data mode and not AT or ECI mode. Furthermore, the power mode must also be set to online (see AT*AMPM).
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Responses Description *AMDS: , OK Successful response ERROR Error message. Response Parameters Type Value dtr_cfg integer Configuration of module behavior on the UART DTR pin. 1: DTR is activated when module is started. (default value) 2: DTR is active if there is a Bluetooth connection. If there is no connection, DTR is inactive.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference Responses Description OK Successful response ERROR Error message. Model Constraint cB-OEMSPA13 cB-OEMSPA33 Not supported. Read_Link_Policy (AT*AMLP?) AT Command Description AT*AMLP? Read current Link Policy. Responses Description *AMLP: , OK Successful response ERROR Error message.
11.6: Miscellaneous Commands Chapter 11: AT Commands Reference When using a baud rate of 460 kbps or more on the serial interface, a combination of link policy 1 on the sender and link policy 2 on the receiver gives the highest throughput. When using a slower baud rate, then the default link policy gives equally high throughput. If the remote device rejects the link policy requested by the SPA, then the red LED gives an error indication.
11.7: Events Chapter 11: AT Commands Reference 11.7 Events Serial_Connection_Data_Mode_Closed (*ADCCO) Event Description *ADCCO:, A connection to a remote device has been disconnected. Event Parameters Type Value connection_handle integer Identifies the connection.
Chapter 12: Model Compatibility 11.7: Events Chapter 12 Model Compatibility The following table describes what AT commands different serial port adapter models supports.
11.