AN4127 Application note Demonstration board for Bluetooth® module class 2 SBT2632C2A.AT2 Introduction This document describes the STEVAL-SPBT3ATV3 demonstration board (dongle) for the Bluetooth® class 2 SPBT2632C2A.AT2 module. The dongle includes the module under evaluation, an RF antenna, and a USB connector. The USB connector is used to connect the dongle with a PC, to access the Bluetooth module and to supply the dongle. The STEVAL-SPBT3ATV3 is an easy solution to test and operate with the SPBT2632C2A.AT2 module and familiarize the user with the embedded FW which enables the creation of a Bluetooth link with simple AT commands. The AT command list is detailed in the UM1547 user manual. This document introduces the main technical characteristics of the dongle and includes a quick start guide to get started with the STEVAL-SPBT3ATV3. Dongle features: ■ Based on V3.0 Bluetooth class 2 module, SPBT2632C2A.AT2 ■ USB interface and power supply ■ Supported reprogrammability via USB interface ■ Reset button ■ Antenna onboard ■ RoHS compliant Figure 1. June 2012 STEVAL-SPBT3ATV3 dongle Doc ID 023304 Rev 1 1/27 www.st.com Contents AN4127 Contents 1 Demonstration board usage limitation . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Recommended operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 Dongle layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4 I/O connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.1 PAD description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.2 Reset switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5 Dongle schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6.1 Dongle installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6.2 Setup and connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 6.2.1 Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 6.2.2 Inquiry and available services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.2.3 Command and answer syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6.2.4 GPIO and LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Appendix A USB driver installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7 2/27 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Doc ID 023304 Rev 1 AN4127 1 Demonstration board usage limitation Demonstration board usage limitation The dongle based on the SPBT2632C2A.AT2 module is not qualified; it is a pure demonstration tool only for evaluation purposes and not a product in itself. 2 Recommended operating conditions Table 1. Symbol Recommended operating conditions Parameter VDD Board supply voltage Top Operating case temperature range Condition Min. Typ. Max. Unit -40 °C < T < 85 °C 4.5 5 5.5 V +85 °C Doc ID 023304 Rev 1 -40 3/27 Dongle layout 3 4/27 AN4127 Dongle layout Figure 2. Dongle component layout, front side Figure 3. Dongle component layout, bottom side Doc ID 023304 Rev 1 AN4127 I/O connections 4 I/O connections 4.1 PAD description Other than the USB plug, some pads are also available. In fact PAD1 to PAD13 make the SPBT2632C2A.AT2 pins available to the user. Figure 4. Front side connection PAD 1 to 3 1 Figure 5. Bottom side connection J1 JTAG connector LED1 3 13 4 PAD 4 to 13 LED3 LED2 AM12669V1 AM12670V1 Table 2 gives a description of these pads. Table 2. Pad connections Description PAD 1 BOOT0 - Boot pin used for firmware downloading - used for testing purposes 2 3.3 V (module – LED1 is connected to this PAD) 3 RESETN - reset - connected in parallel to onboard reset switch 4 GND 5 +5 V (USB) 6 LPO (external 32.768 kHz frequency input to allow deep sleep and sniff mode Bluetooth module functional states) 7 GPIO07 – general purpose I/O 8 GPIO01 – general purpose I/O (1) (LED2 is connected to this GPIO) 9 GPIO02 – general purpose I/O (1) 10 GPIO03 – general purpose I/O (1) 11 GPIO04 – general purpose I/O (1) (LED3 is connected to this GPIO) 12 GPIO06 – general purpose I/O (1) 13 GPIO05 – general purpose I/O Doc ID 023304 Rev 1 5/27 I/O connections AN4127 Table 2. Pad connections (continued) Description 1 JTRST 2 JTDO 3 JTCK 4 JTMS 5 JTDI 6 nRESET (max. voltage 2.5 V) 7 + 3.3 V 8 GND JTAG 1. Default configuration - a different configuration may be chosen (see the SPBT2632C2A.AT2 datasheet). 4.2 Reset switch A reset switch SW1 is present on the dongle. When SW1 is pushed, SPBT2632C2A.AT2 is forced to reset. The following prompt is displayed on the screen: ● AT-AB - CommandMode ● AT-AB BDAddress xxxxxxxxxxxx Figure 6. Reset switch Reset switch AM12671V1 6/27 Doc ID 023304 Rev 1 Doc ID 023304 Rev 1 *3,263,B&/., 6B&. *3,263,B66, 6B:6 *3,263,B026,, 6B6' *3,263,B0,62 *3,2 /32 986%9&& 5 10 *3,2 ' *1' ' *3,2'$& ' 9 ' ,& 86%8): 1& 1& 6863(1' 6863(1' 1& 567 9%86 53"'.$ 53"$ 53"$ 53"6CC 5 . . 2KP 5 *5((1 *5((1 /(' 5 -3 2KP 5 .- 5(6(71 5 1& &76 576 5;' 7;' '65 '75 & X) /(' 9,1 %227 5(6(7 &76 576 5;' 7;' 9 6: Q & 9 6:386+%87721 -3 %227 - & X 9 2KP 5 1567 3%-1 7567 3$-706 3%-7'2 3$-7', 3$-7&. 63%7&$$7%702'8/( !.4%..! *3,2 *1' *3,2 *3,2 *3,2 *3,2 *3,2 /32 *3,2 %7 37 37 37 37 37 37 86%0$/(&211(&725 & Q 1& 1& 1& 1& 1& 1& 1& Dongle electrical drawing &3 % :$51,1*Q5(6(7VLJQDOOHYHOPD[ 9 Figure 7. '&' 5, *1' ' ' 9GG 5(*,1 $ &21 Dongle schematic 9B86%9&& ,& % ,& 67* - Q5(6(7 -7' , -70 6 -7& . -7' 2 -75 67 /(' *5((1 & Q ',5 5;'B&3 &76B&3 & X 9 $ ',5 7;'B&3 576B&3 *1' 9&&% 5 2KP 5 2KP & X) 9 *1' 9&&$ 9 !,4%2.!4) 6%$%6)#% 73 ,& 0&37( 9LQ 9RXW & X 9 7$17 2( *1' & Q & Q 5 9B&3 5 10 *1' 9B+& 8$ 0&37(77 9LQ 9RXW & Q & X 9 %\ 3DVV 9RXW /'605 ,1+,%,7 9LQ ,& 73 & Q AN4127 Dongle schematic 3$' 3$' 3$' 3$' 3$' 3$' 3$' 3$' 3$' 3$' 3$' 3$' 3$' !-V 7/27 Getting started AN4127 6 Getting started 6.1 Dongle installation The Bluetooth SPBT2632C2.AT2 module and the related dongle do not need any Bluetooth driver on the host processor. However, before using a new USB device the user must install it on their PC. If the USB driver is not present on the PC, it is necessary to apply a simple installation procedure as follows: ● Step 1: Simply plug the STEVAL-SPBT3ATV3 into any available USB port. The computer responds with the following two messages: Figure 8. ● USB drive installation first and second step Step 2: Next, a “Found New Hardware Wizard” installation window opens. Select ‘Yes, this time only’ to locate the drivers from the Microsoft® website. Figure 9. Wizard installation first step Click ‘Next’ to install automatically. 8/27 Doc ID 023304 Rev 1 AN4127 Getting started Figure 10. Wizard installation second step The STEVAL-SPBT3ATV3 USB to UART controller and virtual COM port driver is now installed. ● Step 3: The “Found New Hardware Wizard” now opens again in order to install the USB device driver. Select ‘Yes, this time only’ to locate the drivers from the Microsoft website. Figure 11. Wizard installation third step The following message appears: Figure 12. Wizard installation completed Doc ID 023304 Rev 1 9/27 Getting started ● AN4127 Step 4: Open the Windows® device manager application to verify correct installation, and see which COM port has been assigned to the STEVAL-SPBT3ATV3 Bluetooth serial device. The STEVAL-SPBT3ATV3 is usually assigned the same virtual COM port each time it is inserted (unless there are other virtual COM devices altering port assignments). Two device drivers for the STEVAL-SPBT3ATV3 Bluetooth device should be seen here. Figure 13. Windows device manager The CP2102 chip provides the function of using standard UART serial communications from the computer via the universal serial bus, and interfaces directly to the Bluetooth module inside the STEVAL-SPBT3ATV3 Bluetooth serial adapter. If USB driver wizard installation fails, follow Appendix A: USB driver installation installation procedure. 6.2 Setup and connect The purpose of this section is to describe all the necessary steps to establish a connection between two Bluetooth STEVAL-SPBT3ATV3 dongles realizing a serial line/cable replacement application. Two PCs and two STEVAL-SPBT3ATV3 boards are needed to perform the connection. 10/27 Doc ID 023304 Rev 1 AN4127 Getting started Figure 14. Basic setup 6FUHHQ 'RQJOH 'RQJOH 'RQJOH 6FUHHQ 'RQJOH !-V (Please refer to the UM1547 user manual for the listing and meaning of the AT commands.) 6.2.1 Startup Two dongles are needed to perform the connection. Each dongle has its own BD address. Suppose 0080e1f00001 for dongle1 and 0080e1f00002 for dongle2. Each dongle has the following factory default: – UART: 115200 baud rate, no parity, 1 stop bit, 8 data bits – Local name: “Amp'ed UP!’ – Class of device: misc. device – Profile: SPP (serial port profile) – Service name: “AMP-SPP” – Deep sleep: disabled – Page and inquiry scan: 1.28s interval, 11ms duration – Security: disabled – Bonding PIN: “1234” – Bonding allowed: always enabled ● Plug each dongle into the PC using the USB connector ● Open the HyperTerminal program on both PCs and create a new connection “AT Command”. Doc ID 023304 Rev 1 11/27 Getting started AN4127 Figure 15. Connection setup Set the connection port: Figure 16. Connection port setup and configure it: Figure 17. Port parameters 12/27 Doc ID 023304 Rev 1 AN4127 Getting started with the following parameters: – Select the proper COM line (COM1, COM2……) – Set baud rate = 115000 (default baud rate of SPBT2632C2.AT2 module) – Set data bits = 8 – Set stop bits = 1 – Set parity = none – Set flow control = none From the menu file set the AT command connection properties: Figure 18. Connection properties setup !-V The dongle is ready to use: – Press the reset switch on the dongle – On the screen, the prompt followed by the module Bluetooth address should appear: Figure 19. AT command prompt “AT-AB -CommandMode -” “AT-AB BDAddress xxxxxxxxxxxx” Doc ID 023304 Rev 1 13/27 Getting started AN4127 Figure 20. BDAddress dongle1, dongle2 From now on the user can operate the dongle using the AT commands. 6.2.2 Inquiry and available services Before establishing a connection, the dongle must know which Bluetooth devices are present and which services are offered. Each module has its own address which identifies the module itself in the network. The BD address can be found during the discovery phase. If the BD address of the Bluetooth device the user wants to connect to is known, the inquiry procedure can be omitted. ● Discovery: – AT+AB discovery This command returns the number of responses of nearby devices and then the individual responses with the BD address, and device name. The number of devices returned is limited to 10. Inquiry is performed with an interval of 10.24 seconds. The devices are reported in the same order as the original inquiry results. For each name or service name request that is successful, the response uses the returned names in the following format: – AT-AB device [BD addr] [name] – AT-AB device [BD addr] Unknown As a consequence of a discovery command issued by dongle1, the following lines are displayed: 14/27 Doc ID 023304 Rev 1 AN4127 Getting started Figure 21. Discovery dongle1 Note: In the case of 1 device found. ● Service: To verify, at the same time, which kind of service is available, use the command: AT+AB discovery [CoD] [profile] Response is: AT-AB device [BD addr] [name] As a consequence of a discovery command for SPP service issued by dongle1, the following appears on the screen: Figure 22. Service dongle1 Note: In the case of 1 device found. ● Bonding: Bonding is used when an application needs to pair with another remote device. Devices must be enabled to bond, with this aim, the EnableBond command is used. The BD address, PIN and timeout parameters are optional. – AT+AB EnableBond If the operation is successful, the response is: – AT-AB BondEnabled To bond devices the “bond command” is used where the device address and the identification number (PIN) is specified. The command is: – AT+AB bond [BD addr] [Pin] Doc ID 023304 Rev 1 15/27 Getting started AN4127 If the request is successfully submitted, the response is: – AT-AB BondPending [BD addr] If the operation is successful, the response is: – AT-AB BondOk If it fails: – AT-AB BondFail In this case, dongle1 is requesting a bonding with dongle2. Figure 23. Bonding dongle1, dongle2 ● Connection: Once the dongle knows the device present and the service offered, the command to set up connection is: – AT+AB SPPconnect [BD Addr] [Service] If the connection is successful, the response is: – AT-AB ConnectionUp – AT-AB -BypassMode- At this point the connection is established. The dongles can send and receive data. In this case, dongle1 knows the address of dongle2, and wants to connect to dongle2: 16/27 Doc ID 023304 Rev 1 AN4127 Getting started Figure 24. Connection dongle1, dongle2 Now the two dongles are connected to one another and in -BypassMode-. In other words, everything typed on a terminal is transferred to the other via the Bluetooth link and vice versa. In -BypassMode- the dongle doesn't answer the commands. If, for example, the user needs to change some parameters of a dongle, it’s necessary to switch to -CommandMode-, giving the “escape command”. The escape command is a special sequence of characters followed by at least two seconds of inactivity on the serial port. The escape command sequence is: ^ #^$^%. Figure 25. Escape dongle1, dongle2 As can be noted, the escape command given to dongle1 doesn't affect dongle2 which remains in -BypassMode-. Connection between the two dongles is still active; to return to the “exchange data” situation, dongle1 must be re-configured in -BypassMode- with the command “Bypass”. Doc ID 023304 Rev 1 17/27 Getting started AN4127 Figure 26. Return to -BypassMode- dongle1, dongle2 Now the two dongles can exchange data again. ● Disconnection: The SPPDisconnect command is used to terminate a connection with the remote device. – AT+AB SPPDisconnect If the disconnection is successful, the response is: – AT-AB SPPConnectionClosed SPPDisconnect is a command; it is recognized and accepted by the dongle only if the dongle is in -CommandMode-. If the dongle is in -BypassMode-, send the “escape command” before giving the disconnection command. Figure 27. Disconnection dongle1, dongle2 18/27 Doc ID 023304 Rev 1 AN4127 Getting started Information related to successful disconnection is displayed on both screens. ● Smart cable setup: The smart cable setup command is used to enable and configure a SmartCable device. A device BD address is specified with which to automatically establish a connection, replacing the need for AT connection commands. It is stored in the non-volatile memory. The command is: – AT+AB SmartCableSetup [BD Addr] [Attempts] [Interval] If the command is successful, the response is: – AT-AB SmartCableConfigDone In this case, suppose an automatic connection of dongle1 to dongle2 at power-on is needed, with the possibility to retry for 5 times with an interval of 1 sec between each retry. The command is: – AT+AB SmartCableSetup 0080e1f00002 5 1 This command is stored inside the non-volatile memory and executed at power-on. In case dongle2 is already powered: Figure 28. Smart cable dongle1, dongle2 If dongle2 is not powered or not available, dongle1 automatically retries 5 times. Figure 29. Automatic retrial dongle1 If dongle2 is present, dongle1 automatically connects. If dongle2 is unplugged, connection fails. However, connection is automatically restored if dongle2 is again plugged in during the interval of retrial assigned to dongle1. Doc ID 023304 Rev 1 19/27 Getting started AN4127 Figure 30. Automatic connection dongle1, dongle2 ● Delete smart cable setup: The command to remove the SmartCableSetup is: – AT+AB DeleteSmartCable If the operation is successful, the answer is: – AT-AB DeleteSmartCableDone To give the command the dongle must be in; -CommandMode-. ● Erase bond table: The erase bond table command must be used to clear all the bonded device entries: – AT+AB EraseBondTable If the operation is successful, the answer is: – 6.2.3 AT-AB BondTableErased Command and answer syntax The syntax of the commands is fixed and cannot be changed, the prefix for each command is AT+AB. Each command has an answer which is preceded by the prefix AT-AB; this identifier can be changed by means of the AT+AB config command. If it is necessary to change the prefix of the answer from AT-AB to “>>” on dongle1, the steps to follow are shown in Figure 31: 20/27 Doc ID 023304 Rev 1 AN4127 Getting started Figure 31. Change syntax dongle1 Note: Change reply prefix. 6.2.4 GPIO and LED The SPBT2632C2A.AT2 has several pins which can be configured as GPIOs (GPIO01 to GPIO07). If GPIO function is selected, GPIO direction (input/output) and GPIO level can be chosen by means of the AT commands. GPIO must be configured for output or input using the proper command: – AT+AB GPIOConfig [GPIO Pin] I for input – AT+AB GPIOConfig [GPIO Pin] O for output Once configured, the GPIO port can be read or written with the commands: – AT+AB GPIOWrite [GPIO Pin] 1 write 1 – AT+AB GPIOWrite [GPIO Pin] 0 write 0 – AT+AB GPIORead [GPIO Pin] read On the dongle there are 2 LEDs connected to GPIOs: LED2 connected to GPIO01 and LED3 to GPIO004. Each LED can be switched on/off by driving the corresponding GPIO with the proper AT command. Doc ID 023304 Rev 1 21/27 Getting started AN4127 Example: Figure 32. GPIO set dongle1 22/27 Doc ID 023304 Rev 1 AN4127 USB driver installation Appendix A USB driver installation If USB driver wizard installation fails, the dongle can be installed using the driver available on the silicon lab website at www.silabs.com/support/pages/support.aspx?ProductFamily=USB+to+UART&PartNumber =cp2102. Insert the dongle into a USB port on the PC, follow the steps described in Section 6.1 of this document. Figure 33. USB driver installation launch Figure 34. License agreement Doc ID 023304 Rev 1 23/27 USB driver installation AN4127 Figure 35. Wizard installation 1 Figure 36. Wizard installation 2 Figure 37. Wizard installation 3 !-V 24/27 Doc ID 023304 Rev 1 AN4127 USB driver installation Figure 38. Wizard installation terminated Figure 39. Installation completed The USB driver installation is now complete. Doc ID 023304 Rev 1 25/27 Revision history 7 AN4127 Revision history Table 3. 26/27 Document revision history Date Revision 21-Jun-2012 1 Changes Initial release. Doc ID 023304 Rev 1 AN4127 Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST’s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. © 2012 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com Doc ID 023304 Rev 1 27/27