Serialio BlueSnapXP, BlueSnap-Standard, BlueSnap-9V Serial Adapters User Manual

27
BlueSnapXP, BlueSnap-Standard, BlueSnap-9V Serial Adapters
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 1 of
User Guide
For:
®
Serialio.com
Serial Module Command Set
As applied to
Bluetooth Modules:
Version 4.83SIO
January 20, 2016
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 2 of
27
1 INTRODUCTION ................................................................................................................................................................ 3
2 MODES OF OPERATION ................................................................................................................................................. 4
3 CONFIGURATION ............................................................................................................................................................. 6
3.1 Configuration Locally over Serial port………………..….……………………………………6
3.2 Configuration Remotely over Bluetooth……………………………………………………….6
3.3 Using PIO/Dip switches for quick configuration………...……………………………………7
4 COMMAND SET REFERENCE ........................................................................................................................... 8
4.1.1 Using Low Power modes (inquiry and page timers)….……………………………………14
4.1.2 Using Low Power SNIFF mode……………………………………………………………14
4.2 Profile Selection………………………………………………………………………………16
4.3 Using PIO Pins to create Modem control signals………….…………………………………16
5 COMMAND QUICK REFERNCE TABLE..................................................................................................................... 17
6 FACTORY DEFAULT SETTINGS ................................................................................................................................. 19
7 COMMON PROBLEMS AND QUESTIONS: ............................................................................................................... 18
8 EXAMPLE OF A MASTER DISCOVERY/CONNECTION SEQUENCE .................................................................. 20
9 INSTANT CABLE REPLACEMENT EXAMPLE ................................................................................................22
10 BLUESNAP CONFIGURATION SWITCHES ....................................................................................................23
APPENDIX A - BLUESNAP EVALUATION BOARD CONNECTORS, SIGNALS..................................................24
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 3 of
27
2. Introduction
Scope: This Command Set document is created to enable developers and integrators an opportunity to create wireless networks using Bluetooth technology. The goal is to make the transition to Bluetooth wireless networks as seamless and easy as possible. This document will explain how to establish Bluetooth communications between Bluetooth enabled devices for data applications.
Background: The BlueSnap evaluation board is designed to accommodate the Class1 Bluetooth radio modem serial modules with 2.4GHz RF ceramic chip antenna or external SMA antenna Jack. The modules are Bluetooth ver. 2.0 compliant. The evaluation board enables a stable platform environment to test serial RS-232 cable replacement over Bluetooth RF links before going directly to an embedded printed circuit board design and layout.
Commands: This document describes the protocol used to control and configure Bluetooth Serial Modules. The protocol is similar to the industry standard Hayes AT protocol used in telephone modems due to the fact that both types of devices are connection oriented. Appropriate commands have been provided to make the module perform the two core actions of a Bluetooth device, which is make/break connections and Inquiry. Additional commands are also provided to perform other functions. The serial radio modems can be configured, commanded, and controlled through simple ASCII strings through the hardware serial UART or over a remote Bluetooth RF connection .
Applications: The BlueSnap has RS-232, DB-9 and 0-3.3Vdc direct UART interfaces to the module.
Pico-Nets: For applications that require more than point-to-point (2) devices communicating simultaneously – this is called a pico-net. These applications require one of the Bluetooth devices to manage all the network connections. The easiest implementation is using a Personal Computer (PC) that manages this activity with MS Windows Bluetooth stack software and USB Bluetooth Communicator plugged into the PC (see figure below).
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 4 of
27
Making a Connection
BlueSnap shows up under Service discovery defaulted as Serial Port Profile (SPP) Service
“SPP on BlueSnap-5302”, where SPP is the service name and RN-5302 is the local device name. The local device name can be changed, and defaults from the factory to the last 2 bytes of the Bluetooth address.
To connect to BlueSnap, browse for services, you should see: “SPP” as the Profile. BlueSnap and will be connected to a Virtual COM port on PCs, BlackBerrys, Palm Pilot’s, PocketPCs, or other clients. Once connected, data will flow in both directions in regular data mode as if the serial port were locally attached. Commands to the device can be sent by a remote RF Bluetooth device or on the local UART hardware connection (if not connected over Bluetooth) by typing “$$$” (three dollar signs) BlueSnap is a Class1 Bluetooth device with high power transceiver (100meters/330 feet) actual range may vary due to environment or type of client device used to connect to BlueSnap.
NOTE: Only one client can make connection to BlueSnap at a time, and there is a limit of 7 simultaneous communicating devices in a Bluetooth pico-net network.
2. Modes of Operation
0- Slave mode – This is the default mode, whereby other Bluetooth devices can discover and
connect to the device. Outbound connections can also be made in this mode. 1- Master Mode - This mode is useful when the device only wants to initiate connections (not
receive them). In this mode the device will NOT be discoverable or connectable. 2- Trigger Master Mode - In this mode, the device will automatically connect to the pre
configured remote slave address when a character (or characters( are received on the local UART. Connection will continue until a configurable idle timer (1 to 255 seconds) determines that no more data is being received, or a configurable BREAK character is seen.
3-Auto-connect Master Mode- This mode can be set by command, or by sensing of Switch 3 during powerup on the BlueSnap.(PIO6 high on the module). If this mode is set, the device will initiate a connection to the pre-stored remote address immediately upon power up. If no address is stored, an inquiry process will be attempted and the first device found that matches the COD will be stored. In this mode, data is passed without being interpreted by the BlueSnap (high speed), hence the connection cannot be broken via command. If disconnect occurs, the device will attempt to re-connect until successful.
4-Auto-connect DTR Mode- This mode must be set by command. This mode operates like mode 3 Auto-Connect, except that the connection and disconnection are controlled by the DTR
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 5 of
27
line on the BlueSnap. Setting the DTR line high will initiate the auto-connect process, and turning it off/low will cause a disconnect.
5-Auto-connect ANY Mode- This mode must be set by command. This mode operates like mode 4 DTR mode, except that each time the Switch/PIO is set, an inquiry is performed and the first device found is connected. The stored address is NOT used, and the found address is never stored.
3. Configuration
Command Mode (vs Normal Data mode)- Upon powerup, the device will be in data mode. To enter
command mode, The characters “$$$” must be sent. The device will respond with “CMD”. To exit
command mode, send “---<cr>”. The device will respond with “END”.
Parameters, such as the Bluetooth Name, Class of Device and Serial Port settings can be viewed and configured. This can be done locally through the serial port UART or from a remote Bluetooth RF link. To access configuration, the device must be in command mode by issuing ($$$). While in command mode, the device will accept ASCII bytes as commands.
3.1 LOCAL CONFIGURATION (via serial port)
Use a normal RS-232 pass through cable from PC passing ASCII characters through the terminal to the
BlueSnap. The communications settings should match the settings used when BlueSnap connects, for
example: the default is 115,200bps, 8 bits, No Parity, 1 stop bit, and hardware flow control disabled. Local configuration works at any time when the device does NOT have a Bluetooth connection, and also works under certain conditions when the device is connected (see the table below). If the device is in configuration mode and a connection occurs, the device will exit configuration mode, and data will pass back and forth from the remote device.
Run your favorite terminal emulator, HyperTerminal or other program. Type “$$$” on your screen. You
should see “CMD” returned to you. This will verify that your cable and comm. settings are correct. Valid commands will return an “AOK”, response, and invalid ones will return “ERR “. Commands that are not recognized will return a “?”.
To exit command mode, type “---“<cr>. (three minus signs).
NOTE1 : You can enter command mode locally over the serial port at any time when not connected. Once a connection is made, you can only enter command mode if the config timer has not expired. To enable continuous configuration, set the config timer to 255. Also, if the device is in Auto Master mode 3, you will NOT be able to enter command mode when connected over Bluetooth.
3.2 REMOTE CONFIGURATION (via Bluetooth)
It is often useful to be able to perform configuration remotely over a Bluetooth connection. To do this, connect to the device over Bluetooth, and using your terminal emulator, perform the same steps as you
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 6 of
VALUE (decimal)
DESCRIPTION 0
No remote config, No local config when connected
1-252
Time in seconds from powerup to allow config
253
Continous config LOCAL only
254
Contiuous config, REMOTE only
255
Continous config, both LOCAL and REMOTE
Function
DIP Switch (adapters)
PIO (modules)
Settings Factory Reset
1
PIO 4
OFF (0V) = disabled, ON (3V) = ARMED
Auto Discovery/Pairing
2
PIO 3
OFF (0V) = disabled, ON(3V) = enabled
Auto-Connect
3
PIO 6
OFF (0V) = disabled, ON(3V) = enabled
Baudrate
4
PIO 7
OFF (0V) = 115K, ON(3V) = 9600
27
would for local configuration above. When finished configuring, be sure to either reset the device, or Send the “---“command, which will exit configuration mode and allow data to pass normally.
NOTE 2: You can only enter command mode remotely over Bluetooth if you have made a connection and sent the $$$ within the “config timer” window after powerup. This can be modified, the default config timer expires 60 seconds after powerup. Once the timer has expired, any data sent to the device will pass unmodified and unrecognized by the command interpreter. The timer can be set to any value from 0 (disable remote configuration) to 0xFF hex , which allows continuous (no timeout) configuration. WARNING: Configuration (local or remote) is NEVER enabled when the device is in auto-mode and is connected over Bluetooth.
CONFIG TIMER settings
3.3 Using the PIO pins/DIP switches to perform quick configuration
Factory Reset- Set this switch/PIO on powerup. This arms the reset function. Then toggle the
switch/PIO 3 times and all settings in the device (other than the Bluetooth name) will return to defaults.
Auto Discovery/Pairing Mode - Used with Switch3/PIO6. If Switch3/PIO6 also set,, the device will
perform a device Inquiry Scan, searching for a partner Device with a special matching class, (0x55AA) and once found, store the address of such device into the remote address field, and then auto-connect to the remote device. If Switch3/PIO6 is NOT set, the device will enter slave mode with the special matching class, waiting to be found by the master. This mode is usually set once on both ends of a pair
of devices, for instant “cable replacement”, and then removed.
Auto Connect mode –This is equivalent to auto-master mode 3 in software. The device will connect to
the stored address. If Switch2/PIO3 is also set, new discovery/pairing can be made, see above.
Baud Rate select - used to configure 9600 or 115K default baudrate. If the baudrate is configured in software, this switch is ignored.
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 7 of
27
NOTE: for the purpose of configuration above, the swithes/IO pins are sampled ONLY at power up time, (during the first 500milliseconds) so they can be used for other functions once the device is in operation. The exception is the factory reset switch/PIO, which once enabled, can be toggled at any time after powerup, a total of 3 transitions will cause the factory reset to occur.
4. Command Reference
The commands are all single or 2 character, generally comma delimited. Commands and hex input data can be upper or lower case. Text data, such as Bluetooth name, and pin code, are case sensitive. Commands fall into 4 general categories:
SET COMMANDS - Store information permanently and take effect after power cycle or software reset. GET COMMANDS - Retrieve the permanently stored information for display to the user. CHANGE COMMANDS – Temporarily change the value of serial baudrate, parity, etc. ACTION COMMANDS – Perform action such as inquiry, connect, etc.
SET COMMANDS
S7,<1,0> 7 bit data mode. 1 to enable, 0 to disable. (setting can be seen with the “d” command).
SA,<1,0> Authentication. 1 to enable, 0 to disable. This will force authentication when any remote
device attempts to connect. Regardless of this setting, if a remote device forces authentication, this device will respond with the stored pin code. Once a remote device has exchanged pin codes with this device, a link key will be stored for future use. Up to 8 keys are automatically and permanently in flash on the device, in a first in, first out fashion.
SB,<timer> Send BREAK. This is an immediate command, which can send a BREAK signal on the
TX . The timer is used to send a variable length BREAK signal.
Timer value Break length (in milliseconds) 1= 37ms, 2=18.5ms, 3=12ms, 4=9ms, 5= 7ms, 6=6ms.
Example : “SB,2” sends a 18.5 millisecond break signal.
SC,<hex word> Service Class ( 16 bits, 11 used, this is used with Device Class below to create the 24
bit class of device number.
Example : “SC,0002”
SD,<hex word> Device Class (major and minor in a 16bit word, used with service class above)
Example : “SD,8040”
SE,<1,0> Encryption 1 to enable, 0 to disable.
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 8 of
27
SF,1 Set Factory Defaults. SI, <hex word> - Inquiry Scan Window. Sets amount of time device spends enabling inquiry scan
(discoverability) . Minimum value is 0x0012, corresponding to about 1% duty cycle. Inquiry interval is fixed at 0x1000, so time spent in inquiry is 0x12/0x1000 by default. Maximum value is 0x1000, set to 0x0000 to disable inquiry scan and make device non­discoverable. Default value is 0x0200.
SJ, <hex word> - Page Scan Window. Sets amount of time device spends enabling page scan
(connectability) . Minimum value is 0x0012, corresponding to about 1% duty cycle. Page Scan interval is fixed at 0x1000, so time spent in page scan mode is 0x12/0x1000 by default. Maximum value is 0x1000, set to 0x0000 to disable page scan and make device non-connectable. Default value is 0x0200.
SL,<E,O,N> Parity. Can be any of, Even, Odd, or None. Only the first character is needed
Example : “SL,E” sets the parity to Even.
SM,<3,2,1,0> Mode (0=slave, 1=master,2=trigger, 3=auto)
Example : “SM,1” sets the mode to Master
SN,<name> Friendly Name of the device, 16 characters maximum.
Example : “SN,MyDevice”
S-,<Name> This command automatically sets the Bluetooth Friendly Name to “Name-EC42”
where “EC42” is the last 4 digits of the Bluetooth address.
SO,<text> Extended Status String, 8 character maximum. Setting this string to from 1 to 8
characters will enable status messages to be sent to the local serial port. Two status messages are sent, when a Bluetooth connection is established, the string
”<text>CONNECT” will be sent. Upon a Disconnect, the string <text>DISCONNECT
will be sent. This parameter is useful, for example, when connected to a printer, the printer can examine an escape sequence, if the <text> is set to ESC%, the printer can parse the ESC%CONNECT and ESC%DISCONNECT messages without interfering with normal print jobs. In Trigger or Master modes, the first character of this string is used as the BREAK connection character.
Example : “SO,ESC%”
SP,<text> Security Pin Code, 16 character maximum
Example : “SP,secretcode”
SR,<adr> Remote Address. 12 hex digits, (6 bytes) no spaces or chars between.
Example : “SR,00A053112233”
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
BlueSnap Commands Version 4.81SIO, 1/20/2016 Page 9 of
27
NOTE: 2 special characters can be used here: “SR,Z” will erase any stored address. “SR,I” will write the last address seen by using the Inquiry command. This can be helpful when you just have 1 other device in range and want to
quickly store and connect to it.
SS,<text> Service Name (1 to 16 characters ).
Example : “SS,SerialPort”
ST,<num> Config Timer, # of seconds ( range= 0 to 255 decimal,, default = 60 decimal) to allow
remote configuration over Bluetooth after power up in Slave Mode. In all Master modes, the remote config timer is set to 0 (no remote configuration). In Trigger Master Mode, this Timer is used as an Idle timer to Break the connection after the timer expires with no characters being received.
Example : “ST,0” disables remote configuration Example : “ST,255” enables remote configuration forever
SU,<rate> Baudrate, {1200, 2400, 4800, 9600, 19.2, 38.4, 57.6, 115K, 230K, 460K, 921K }, only
the first 2 characters are needed.
Example : “SU,96” sets the baudrate to 9600 buad.
SW,<hex word> Enable low power SNIFF mode. Default is 0000=disabled. SNIFF mode allows extreme
low power operation. Device goes into a deep sleep, and wakes up every
every 625us * <hex word> to send/receive chars.
Example: “SW,0050” enables Sniff mode and sets the interval time to 50 hex * .625 = 50
milliseconds. This will cause the module to enter low power sleep, and wake once every 50 milliseconds to check for RF activity. See Section
4.1 for more details on Sniff. SX,<1,0> Bonding enabled, which creates a single stored connection pair with a remote device. SZ,<num> Raw Baudrate (decimal) allows entering of non-standard baudrates. Based on the
formula num = Baudrate * 0.004096.
S$,<char> Configuration detect character. This allows a change from the default $$$ to some other
character. Factory defaults returns the device to $$$.
S~,<0,1> Profile to use. 0=SPP (default), 1 = DUN DCE, 2 = DUN DTE, 3 = MDM. See Section 4.2 for more details on Profiles.
S~,<6> Profile to use. 6=HID (Bluetooth keyboard), sets to HID mode when it has HID/SPP
firmware (version 6.10). Must reboot (r,1) after.
Cedar Park, TX, USA (512) 994-3630 sales@serialio.com www.serialio.com
Loading...
+ 18 hidden pages