Wintec_SPP_Simplified_Starter_Guide_v0.5.pdf

Schemat podłączenia modułu bluetooth BTM 330.

Tutaj są inne przykłady połączen modułów i komendy do nich.Niestety innych producentów ale może okazać się przydatne...


SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

Wintec Bluetooth SPP Command Interface Quick Start Guide
1.0) Introduction
The start guide introduces three basic commands, which allows the Wintec Bluetooth SPP module to
connect to another Bluetooth enabled device. In order for this to succeed, the other Bluetooth enabled
device must support Serial Port Profile (SPP).
The advantage of Wintec's Bluetooth module is its' user friendly operation. As long as the user knows how
to apply basic AT commands to control the operations of a modem, the same firmware routines can be used
to run Wintec's Bluetooth module by replacing the AT command set with "AT command-like" instructions.
On a PC, HyperTerminal communication software is used to enter an AT command, which is then
converted into a bit stream to control the operation of a modem through a PC serial port. In Wintec's
Bluetooth module, a host can issue an AT-command like syntax through its UART interface to drive the
Bluetooth module with SPP profile supports. This is why the HyperTerminal software in Microsoft
Windows can be used to generate a bit-stream to evaluate the operation of Wintec Bluetooth module
through a PC serial port. All required Bluetooth software stacks are built in the module's 8-Mb flash. The
default UART interface baud rate is preset at 115,200 bps at the factory.
The Bluetooth module responds with an ASCII string event. Based on the response or event, the host can
determine if the Bluetooth connection with another Bluetooth device is successful or not.
To establish a Bluetooth link with another Bluetooth SPP device, three basic commands are required:
Discovery, Bond and Connect.

2.0) Command and Response Conventions
Each command sent to the Bluetooth module must start with "AT+ZV", and the response from the
Bluetooth module will always start with "AT-ZV".
Command:
ASCII command string sends from the host to the Bluetooth module. Each command
should be terminated with a carriage return (0xD) character.
Response:
ASCII response or message sends from the Bluetooth module to the host. Each string is
ended with a carriage return (0xD) and line feed (0xA) characters.
The user can choose to enter the command string in either upper or lower case, as it is not case sensitive.

3.0) Hardware Interface Connection
The host CPU requires a UART Interface in order to communicate with the Bluetooth module. The host
CPU should also have a GPIO pin to connect to the reset pin of the module so that a hardware reset can be
issue from the host. The host system should supply a 3.3V power to the Bluetooth module as well. Please
refer to the Wintec Bluetooth Module specification (WBTV42) for more information on the hardware
interface.

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

1

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

The following block diagram shows the hardware UART connection between the Bluetooth module and the
host CPU.

Host CPU
TxD
RxD
RTS
CTS

Wintec Bluetooth Module
TxD
3.3V
RxD
GND
RTS
RESET#
CTS

DTE

DTE

The UART interface setting should be set at 115.2K baud per second, 8 data bits, no parity, 1 stop bit and
with hardware flow control.

4.0) Bluetooth Module Startup
When the Bluetooth module is reset or powered up, a sequence of four null characters (0x00), following
response messages will be sent out to the UART interface to indicate the Bluetooth module is ready to
accept commands:
AT-ZV -CommandModeAT-ZV BDAddress 000F7010001
Where [BT address] is the Bluetooth address of the local Wintec Bluetooth SPP module. The address is
represented by 12 hex numbers- equivalent to a 48-bit binary number.
Note: Please note that the Bluetooth SPP module sends both Carriage Return (0xD) and Line Feed (0xA)
characters at the end of each response string.

Example of the start-up message displayed

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

2

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

5.0) Establish a Bluetooth Connection
The following sequence of commands will establish a Bluetooth link between the Wintec Bluetooth SPP
module and another Bluetooth enabled device. Note that the other Bluetooth device must support SPP
service in order to establish a connection.

5.1) Discovery Command
When the Bluetooth device is ready to accept commands, the host can send the following message to the
Bluetooth controller for discovering the Wintec Bluetooth SPP device, or any other Bluetooth SPP device.
AT+ZV Discovery All SPP False
The options "All" and "SPP" request the Bluetooth module to search all devices with SPP profile. To
search for all Bluetooth devices nearby, enter "AT+ZV Discovery All". The "False" option requests the
controller to skip the remote services naming request and will speedup the Discovery process.
The Bluetooth module will respond with the following messages:
AT-ZV InqPending
When the initial inquiry is completed and the discovery has been started, the response is:
AT-ZV DiscoveryPending [number]
Where [number] is the number of devices found.
If it is successful, the controller will return the following message:
AT-ZV Device [BT Address] ["Name"] [Service Name]
Where [BT Address] is the Bluetooth address of the remote Bluetooth device. The address is represented by
12 hex numbers, which is equivalent to a 48-bit binary number. The ["Name"] field is the name of the
Bluetooth Device and [Service Name] is the Bluetooth service that the remote device can support.
The discovery process usually takes about 10 seconds to complete depending on the numbers of Bluetooth
devices that it finds.
For example:
AT+ZV
AT-ZV
AT-ZV
AT-ZV
AT-ZV

Discovery ALL SPP False
InqPending
DiscoveryPending 2
Device 000f70102005 " WINTEC Serial Port "
Device 00025b016b51 " ENG002PC "

The response from the module shows that 2 Bluetooth SPP devices were found. One was the "Wintec
Serial Port" module and the other is a Bluetooth enable PC with the name "ENG002PC"

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

3

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

5.2) BOND Command
The Bond command is used to bond or pair with the remote Bluetooth device where the host wants to
connect:
AT+ZV Bond [BT Address] [PIN code]
Where [PIN code] is the security code required for the pairing process. For the current release of Wintec's
Bluetooth module, the embedded default PIN Code is the last 4 digits of the Bluetooth address of the
module. If another Bluetooth device knows this PIN Code, it can bond to the module by entering this PIN
Code.
For example, if this module wants to bond with a remote Wintec Serial Port module which has a Bluetooth
address 000f70102028, then enter the following command:
AT+ZV Bond 000f70102028 2028
The Bluetooth SPP module will respond:
AT-ZV BondPending 00025b016b51
If the bond is successful, the response is:
AT-ZV BondOk
If the bond is not successful, the response is:
AT-ZV BondFail
Please try to use the "bond" command if the bonding is not successful. Please also refer to the
"enablebond" command for more information.
Example of Bonding or Pairing with a Bluetooth enabled PC
To connect to a Bluetooth enabled PC (BT address: 00025b016b51) with SPP service, pick any PIN Code
i.e. "1234" (up to 16 characters):
AT+ZV Bond 00025b016b51 1234
The Bluetooth SPP module will respond:
AT-ZV BondPending 00025b016b51
Now, go to the PC and it will ask you to enter the PIN code. Enter 1234. Then:
If the bond is successful, the response is:
AT-ZV BondOk
Now, the Bluetooth SPP module is bonded or paired with the Bluetooth enabled PC.
If the operation fails, the response is:
AT-ZV BondFail

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

4

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

5.3) SPPConnect Command
If the bonding or pairing is successful, then the host can issue the SPPConnect command to establish a
Bluetooth connection with a remote device.
The command to setup the Bluetooth connection with Serial Port Profile is:
AT+ZV SPPConnect [BT Address]
If the command is successful, the response is:
AT-ZV ConnectionUp
AT-ZV -BypassModeNow, data can be exchanged between the host and the remote device just like a modem in data mode. The
connection speed is 115200bps which is limited by the UART interface.
If the Bluetooth link cannot be completed, the response is:
AT-ZV SPPConnectionClosed

Example of SPP Connection Setup

5.4) EnableBond Command
This command allows other Bluetooth devices to pair with the local Bluetooth module.
AT+ZV EnableBond [BT Address] [Pin Code]
A Bluetooth address and PIN code should be specified with this command. The Bluetooth address is the
remote device that will be connected to the local module. The PIN code can be up to 16 characters or digits
in length. (For example PIN code: 1234ab can be used). The remote Bluetooth device (use the "AT+ZV
Bond" command) will need to specify the same PIN code in order to bond with this module.
If it is successful, the response of this command is:
AT-ZV EnableBondOk

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

5

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

5.5) Bypass Mode and Disconnect Command
In Bypass mode, the Bluetooth SPP module will forward all data received from the host to the remote
device. To escape out of Bypass mode and back to command mode, the host has to sent an escape sequence
"^#^$^%" (Please note that there is no carriage return or line feed character in this case) and then send no
data for about 2 seconds.
If the escape sequence characters have been entered and 2 seconds has passed, the Bluetooth module will
respond with:
AT-ZV -CommandModePlease note that when the Bluetooth module is in command mode, all data received from the remote device
will be discarded. Once the Bluetooth module is in command mode, the host can terminate the connection
with the remote device by:
AT+ZV SPPDisconnect
The Bluetooth controller will respond with:
AT-ZV SPPConnectinClosed
AT-ZV ConnectionDown
The above responses indicate the Bluetooth connection has been terminated.

5.6) Bypass Command
The Bypass command is used to return to the Bypass mode if the Bluetooth connection is still active.
AT+ZV Bypass
If a connection is still active, the response is:
AT-ZV -BypassModeIf there is currently no connection, the response is:
AT-ZV ConnectionDown

5.7) Unexpected Disconnected
When the Bluetooth connection gets an unexpected disconnect such as when the remote Bluetooth device
disconnects or a change in RF conditions, the local Bluetooth controller will respond with:
###NO CARRIER
AT-ZV -CommandModeIt is the responsibilities of the host to monitor this message for an unexpected disconnection of a Bluetooth
connection.

5.8) Connect to a Bonded Device

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

6

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

To connect to a Bluetooth device, which has been bonded or paired before, the SPPConnect command can
be sent directly to the Bluetooth module after power up.
If the connection is successful, the response is:
AT-ZV ConnectionUp
AT-ZV -BypassModeIf it is unable to connect to a remote device, the response is:
AT-ZV SPPConnectionClosed
If after 3 attempts, it is unable to connect, it is recommended to use the Discovery and Bond commands
before trying the SPPConnect command again.

5.9) Error Response
The host will receive error responses if the Bluetooth device found the command or option entered is
invalid. There are several error responses such as:
o
o
o

AT-ZV ErrFormat
AT-ZV ErrInvlidParam
AT-ZV ErrUnkownCmd

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

7

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

Appendix A: Using PC and HyperTerminal as the Host.
The following is an example of how to start a HyperTerminal session under Windows 2000 Professional.
Please note that other Windows versions should be similar to this setup. This HyperTerminal session will
connect to COM Port 1 where it connects to an external device through a serial cable.
1. Click the "Start" button. Select "Programs". Select "Accessories". Select "Communications", then
selects the HyperTerminal icon.
2. A window appears. Type in a name such as "COM_Port1" and then click the "OK" button.
3. A new window "Connect To" appears. Under the "Connect using" option, select COM1. (If the
device is connected to COM2, select COM2). Click the "OK" button. Ignore the "Phone Number"
option.
4. A window appears which you can customize the Port Setting: (Please see the example below)
- Bits per second:
115200
- Data bits:
8
- Parity:
None
- Stop bits:
1
- Flow control:
Hardware
Click the "OK" button after the above settings are selected.
5. The HyperTerminal window should appear under windows and it should connect to the external
device after it is powered up or reset.

To efficiently send the ASCII commands to the Bluetooth module using HyperTerminal communication
software, it is best to save each command string in a text file and send the command using the "Send Text
File" option under the Transfer menu. Also configure the HyperTerminal setting such that line feed will be
sent after line end. Set the character delay to 1 millisecond as well. This setting is under "Properties - & gt;
Setting - & gt; ASCII Setup.

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

8

SPP Command Interface Quick Start Guide v0.5
Wintec Embedded Bluetooth Modules

Appendix B: Advantages of the Wintec Bluetooth Module
The Wintec Bluetooth Module contains a Bluetooth controller chip (supports Bluetooth spec. V1.2), 8Mbit
Flash to store protocol stack and profiles, antenna, crystal oscillators (one for normal operation and one for
sleep mode to save power) and other supporting passives. It consumes 38mA in master mode and 45mA in
slave mode at a UART bit rate of 115,200 bps. Low power, high throughput (up to 700 Kbps under
symmetric connection at 921,600 UART bps), and 1600 frequency hops per second among 79 subfrequencies make the Bluetooth module an attractive and efficient solution for wireless communication.
The size of the Wintec Bluetooth module is 14.7mm x 33mm. It is assembled in 34 balls along two long
sides, which can be surface-mounted onto a main-board. A 24-pin DIP version is also available (being used
in the evaluation board). The 34 balls contain the UART interface, USB interface, JTAG interface, PCM
interface, Power Amplifier control for Class 1 Antenna, and a second UART port, plus power and ground.
The VCC to the module is 3.3V to simplify its integration to the target system.

About Wintec Industries, Inc.:
Wintec, founded in 1988, is headquartered in Fremont, California. Wintec, a leading third party memory
module manufacturer, specializes in a variety of module design and manufacturing, such as memory
module, flash module, Handspring module, modem module, game module, etc. Besides a complete line of
DDR, SDR, and EDO/FPM legacy memory modules, Wintec also distribute CPU, motherboard,
peripherals, PC software, and consumer Flash products (such as MMC, SD, SMC, CompactFlash, PC Card,
etc.). With excellent design engineering and manufacturing capability, Wintec provides a wide range of
design and manufacturing services for our valuable customers from concept design to final product
delivery. Wintec is ISO9001-certified.

Important Notice:
Wintec Industries, Inc. makes no representations or warranties with respect to the contents of this User Guide
and specifically disclaims any implied warranties of any product design for any particular purpose. Wintec
Industries, Inc. reserves the rights to revise this publication and to make changes from time to time in the
content hereof without obligation of Wintec Industries, Inc. to notify any person or organization of such
revisions or changes.

Wintec Industries, Inc., 4280 Technology Drive, Fremont, CA 94538 (www.wintecind.com)

9


Pobierz plik - link do postu