RN-4142-EK-UG RN-41-EK & RN-42-EK Evaluation Kit User’s Guide © 2012 Roving Networks. All rights reserved. RN-4142-EK-UG Version 1.0 12/10/12 Copyright © 2012 Roving Networks. All rights reserved. Roving Networks is a registered trademark of Roving Networks. Apple Inc., iPhone, iPad, iTunes, Made for iPhone are registered trademarks of Apple Computer. Roving Networks reserves the right to make corrections, modifications, and other changes to its products, documentation and services at any time. Customers should obtain the latest relevant information before placing orders and should verify that such information is current and complete. Roving Networks assumes no liability for applications assistance or customer’s product design. Customers are responsible for their products and applications that use Roving Networks components. To minimize customer product risks, customers should provide adequate design and operating safeguards. Roving Networks, Inc. 102 Cooper Court Los Gatos, CA 95032 +1 (408) 395-5300 www.rovingnetworks.com www.rovingnetworks.com Roving Networks products are not authorized for use in safety-critical applications (such as life support) where a failure of the Roving Networks product would reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing such use. Version 1.0 12/10/12 page 2 RN-4142-EK-UG 1.0 OVERVIEW This document describes the hardware and software setup for Roving Networks RN-41-EK and RN-42-EK evaluation boards. The RN-41-EK and RN-42-EK evaluation boards are field-ready, Bluetooth SIG qualified prototyping platforms for the RN41 and RN42 modules, respectively. The boards have the flexibility to connect directly to PCs via a standard USB interface (via the FTDI chipset) or to embedded processors through the TTL UART interface. The status LEDs, dipswitches, and signal headers enable rapid prototyping and integration into existing systems. You configure and control the modules from a console with a simple ASCII command language. Once the configuration is set up, the module can connect over Bluetooth. You use the evaluation kit to configure the Bluetooth module using the command interface, create connections, and transfer data. See “Resources & Related Documents” on page 16 for information on available documentation. The RN-41-EK and RN-42-EK evaluation boards support the serial port profile (SPP) and human interface device (HID) profiles. The instructions in this document use the SPP profile. For more information on these profiles and how to switch between them, refer to the Bluetooth Command Reference & Advanced Information User’s Guide. 2.0 EVALUATION KIT DESCRIPTION The evaluation kit includes the hardware required to connect the evaluation board to your computer. See Table 2-1. To evaluate the module on the evaluation board, you need a computer with a USB port running the Microsoft Windows or Mac OS-X operating system. Note: Before beginning your evaluation, you may need to install the FTDI driver for the USB cable. You can download the driver (as well as other tools and utilities) from the Roving Networks website at http://www.rovingnetworks.com/support.php. TABLE 2-1: EVALUATION KIT CONTENTS Hardware Description Evaluation board Contains the Bluetooth module, status LEDs, and dipswitches. Mini-USB cable Links your computer to the evaluation board. Figure 2-1 describes the evaluation board’s interfaces and connectors.Table 2-2 describes the status LEDs. The green LED indicates the status of the Bluetooth connection and when the device is in configuration mode. The RN41 and RN42 modules are pin compatiable; therefore, the description applies to both the RN-41-EK and RN-42-EK boards. Refer to “RN-41-EK & RN-42-EK Schematic” on page 17 for the board’s schematic. www.rovingnetworks.com Version 1.0 12/10/12 page 3 RN-4142-EK-UG FIGURE 1-1: RN-41-EK & RN-42-EK EVALUATION BOARD, Note 1 GPIO Signal Header 2 (J2) Top Pin 13 USB Interface PCB Trace Antenna LED Indicators (S = Green A = Red) Programming Header (J3) GPIO Signal Header 1 (J1) Bottom PCB Trace Antenna Configuration Switches Note 1: This figure shows the RN-42-EK board. The RN-41-EK board is similar. GPIO Signal Header 1 (J1) GPIO Signal Header 2 (J2) Programing Header (J3) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 2 3 4 5 6 Pin Description Pin Description Pin Description 1 GPIO6 13 GPIO4 1 SPI_MISO 2 GPIO7 14 GPIO3 2 SPI_MOSI 3 RESET_N 15 GPIO2 3 SPI_SCK 4 No Connect 16 CTS 4 SPI_SS 5 No Connect 17 RTS 5 3.3 V 6 No Connect 18 TXD 6 GND 7 No Connect 19 RXD 8 Sensor Input 1 (AIO1) 20 GPIO11 9 Shutdown (SHDN) 21 GPIO10 10 No Connect 22 11 3.3 V 23 12 GND 24 Sensor Input 0 (AIO0) 3 Automatic Master 4 Default Baud Rate www.rovingnetworks.com Configuration Switches Switch Description GPIO9 1 Restore Factory Defaults GPIO8 2 Automatic Discovery Version 1.0 12/10/12 page 4 RN-4142-EK-UG TABLE 2-2: STATUS LEDS Mode Green LED (S) Red LED (A) Fast blink, 10 times per second Command mode – Blinks twice per second Boot up, remotely configurable – Blinks once per second Discoverable/idle Data over the UART Solid on Connected – 3.0 HARDWARE SETUP To set up the evaluation hardware, perform the following steps: 1. Connect the mini-USB cable to your computer’s USB port and to the evaluation board’s mini-USB connector. This connection provides power to the board and provides a data connection to the command console. Note: 2. Windows prompts you to install the FTDI drivers (that create a virtual COM port to the module’s USB port) if they are not already installed. You can download the drivers from the Support page on the Roving Networks website at http://www.rovingnetworks.com/support.php. Note the COM port to which you have attached the cable. Figure 3-1 shows the completed hardware setup for the evaluation boards. FIGURE 1-2: www.rovingnetworks.com COMPLETED HARDWARE SETUP Version 1.0 12/10/12 page 5 RN-4142-EK-UG 4.0 USING THE EVALUATION KIT You program Roving Networks Bluetooth devices over the Bluetooth link or through the serial interface (USB port) using a simple ASCII command language, which is similar to the industrystandard Hayes AT protocol. set commands configure the module and get commands echo the current configuration. Configuration settings modified with the set command do not take effect until the module has been rebooted, even though the get command may show otherwise. This section assumes that you have a working knowledge of Bluetooth operation and communications. To configure the Roving Networks devices you need a Bluetooth-enabled PC (either built-in or using a USB Bluetooth dongle). You can only configure one device at a time. Once configured, device settings are saved (independent of power down) until they are explicitly changed or the factory defaults are restored. Note: 4.1 For detailed information on the ASCII commands you use to configure the Bluetooth module, refer to the Bluetooth Command Reference & Advanced Information User’s Guide. Command Mode vs. Data Mode The Bluetooth device operates in two modes: data mode (default) and command mode. Upon power up the device is in data mode. While in data mode, the module is essentially a data pipe. When the module receives data from a remote Bluetooth device over a serial port profile (SPP) connection, it strips the Bluetooth headers and trailers and passes the user data to the UART. When data is written to the UART, the module constructs the Bluetooth packet and sends it out over the Bluetooth SPP connection. Thus, the entire process of sending/receiving data to the host is transparent to the end microprocessor. See Figure 1-1. FIGURE 1-3: DATA & COMMAND MODES Host Bluetooth User Data A B UART Bluetooth Module $$$ Bluetooth Interface A B $$$ Command Mode www.rovingnetworks.com Version 1.0 12/10/12 page 6 RN-4142-EK-UG The default configuration for the Bluetooth device is: • • • • • Bluetooth slave mode Keyboard default authentication mode (no pin code required) Serial port 115,200 Kbps baud rate, 8 bits, no parity, 1 stop bit Serial port flow control disabled Low power mode off You configure the device by putting it into command mode and sending ASCII commands over a serial port or the Bluetooth link. Once you change the configuration parameters, they persist until you change them or perform a factory reset. There are two ways to configure the Bluetooth module: • Local configuration using your computer’s USB port • Via Bluetooth You need a terminal emulator to complete the setup. Note: 4.2 Suggested terminal emulator programs are TeraTerm (Windows OS) or CoolTerm (Mac OS-X). Configure the Module Locally Using the USB Port Set up the RN-41-EK or RN-42-EK hardware as described in “Hardware Setup” on page 5. With the Bluetooth device connected and powered on, run a terminal emulator and open the COM port to which the cable is connected. You should configure the virtual COM port connected to the RN-41-EK or RN-42-EK USB interface with the default settings (115,200 Kbps baud, no parity, 8 bits, 1 stop bit). You can use command mode through the UART interface via the USB connector at any time when the device does NOT have a Bluetooth connection, as well as under certain conditions. If the device is in configuration mode and a connection occurs, the device exits configuration mode and data passes back and forth from the remote device. Note: 4.3 If the device is in Auto-Connect Master Mode, you cannot enter command mode when connected over Bluetooth. See “Operating Modes” on page 9 for more information on the various operating modes. Enter Command Mode To enter command mode, launch a terminal emulator and specify the module’s default settings. Table 4-1 shows the serial port settings. TABLE 4-1: SERIAL PORT SETTINGS Setting Value Port COM port to which you attached the module Baud rate 115200 Data rate 8 bits Patiry None Stop bits 1 Flow control None Type $$$ into the terminal emulator to enter command mode. The module returns the string CMD, which indicates that your connection and terminal settings are correct. While in command mode, the device accepts ASCII bytes as commands. www.rovingnetworks.com Version 1.0 12/10/12 page 7 RN-4142-EK-UG When you power up the module, you must enter command mode within a 60 second configuration window; otherwise, the module goes into fast data mode in which all characters are ignored including $$$. If the configuration timer expires while the device is in command mode, the device does not go into fast data mode after exiting command mode. When you enter a valid command, the module returns AOK. It returns ERR for an invalid command and ? for unrecognized commands. Type h <cr> to see a list of commands. A quick check to confirm that you are in command mode is to type the X <cr> command after entering command mode. This command shows the a summary of the module’s current settings, such as the Bluetooth name, device class, and serial port settings. See Figure 1-2. To return to data mode, type --- <cr> or reset the device and re-connect. FIGURE 1-4: www.rovingnetworks.com VIEW CURRENT SETTINGS Version 1.0 12/10/12 page 8 RN-4142-EK-UG 4.4 Operating Modes The Bluetooth device has several operating modes, which you set using the SM command in command mode. Note: In all master modes, the device cannot be discovered or configured remotely over Bluetooth. • Slave Mode (SM,0)—Default mode, in which other Bluetooth devices can discover and connect to the device. You can also make outbound connections in this mode. • Master Mode (SM,1)—In this low-speed connection mode, the device makes connections when a connect command (C) is received. This command can also contain the Bluetooth address of the remote device. If a device is not specified, the module uses the stored remote address. The connection can be broken if the special break character or string is sent (use the SO command to set the break character). This mode is useful when you want the device to initiate connections (not receive them). In this mode, the device is NOT discoverable or connectable. • Trigger Mode (SM,2)—In this low-speed connection mode, the device makes connections automatically when a character is received on the serial port (UART). The connection continues as long as characters are received on either end. The device has a configurable timeout (which you set using the ST command) that disconnects the module after the specified number of seconds of inactivity (1 to 255) or a configurable break character is received. • Auto-Connect Master Mode (SM,3)—In this mode, the device makes connections automatically on power-up and re-connects when the connection is lost. This mode can be set by command, or by setting the external dipswitch 3 during power up. If an address is not stored, the device performs an inquiry process and the first device found that matches the COD is stored. In this mode, high-speed data is passed without being interpreted; therefore, the connection cannot be broken via commands or software break characters. If a disconnect occurs, the device attempts to re-connect until successful. • Auto-Connect DTR Mode (SM,4)—This mode must be set by command. It operates like Auto-Connect Master Mode, except that you control connection and disconnection with dipswitch 3. Turning the dipswitch on initiates the auto-connect process; turning the dipswitch off causes a disconnect. • Auto-Connect ANY Mode (SM,5)—This mode must be set by command. This mode operates like Auto-Connect DTR Mode, except that each time the dipswitch is set, an inquiry is performed and the first device found is connected. The stored address is NOT used, and the address found is never stored. • Pairing Mode (SM,6)—In this mode, the device attempts to connect with the remote device matching the store remote address. You set the remote address using the SR command. www.rovingnetworks.com Version 1.0 12/10/12 page 9 RN-4142-EK-UG 4.5 Configuration Switches The evaluation boards have small configuration switches on the bottom. You need a paper clip or small screwdriver to flip them. Holding the board with the PCB antenna facing to the right, refer to Figure 1-3 for the switch numbering and on/off positions. FIGURE 1-5: CONFIGURATION SWITCHES Off On 1 2 3 4 Table 4-2 describes the functions controlled by the switches. TABLE 4-2: Switch CONFIGURATION SWITCH FUNCTIONS Function Default (Off) Description 1 Restore factory defaults Do not restore factory defaults. Turn on the switch, power up the evaluation kit, and toggle the switch ON-OFF-ON-OFF-ON to return the module to its factory settings. The green (labeled as S) LED blinks quickly for a moment and then continues to blink about once per second. 2 Automatic discovery Automatic discovery is turned off. In slave mode, this switch sets a special class of device that is used by the master to auto connect. If switch 3 also turned on, the module performs a search, stores, and connects to a remote Roving Networks Bluetooth device that has switch 2 turned on. 3 Automatic master Automatic master is turned off. With this switch turned on, the module acts as Bluetooth master and auto-connects to a stored remote address. You must first set the Bluetooth address of the slave device using the SR command or using instant cable replacement settings. 4 Default baud rate With this switch turned off, the If this switch is turned on, the baud rate is 9600 and the default 115 K baud rate is over- module ignores the software configuration. ridden by software baud rate configuration commands. www.rovingnetworks.com Version 1.0 12/10/12 page 10 RN-4142-EK-UG 4.6 Making a Bluetooth Connection By default, the Bluetooth module acts as a slave and the PC is the master. You connect to the Bluetooth module using your computer’s Bluetooth device manager, which varies depending on the operating system. Regardless of the operating system, the process is the same: discovery, pairing, and connecting. 4.6.1 DISCOVERY When you turn on the RN-41-EK or RN-42-EK, the green LED (labeled as S) blinks once per second and the module is discoverable. Open your PC’s Bluetooth device manager and choose to add a new device. The Bluetooth device manager’s icon is located in the bottom right corner of your screen in the taskbar for Windows and in the upper right corner for Mac OS-X. The Bluetooth device manager displays a list of discoverable Bluetooth device. The board displays as FireFly-XXXX, where XXXX are the last 2 bytes of the device’s Bluetooth address. See Figure 1-4. FIGURE 1-6: 4.6.2 DISCOVERY - ADD A BLUETOOTH DEVICE PAIRING To pair with the evaluation board, double-click the board’s name in the list. The firmware automatically stores up to 8 pairings from remote hosts in a first in, first out fashion. The evaluation board’s default authentication mode is keyboard (no pin code required). However, most PCs require authentication and display a pin code. If you are using a Bluetooth USB dongle (e.g., RN-USB-T), your PC prompts you to choose how you want to pair. Figure 1-5 shows examples of pairing with and without a pin code. Note: www.rovingnetworks.com If your PC displays a pin code and asks you to confirm if it is correct, choose Yes. Version 1.0 12/10/12 page 11 RN-4142-EK-UG FIGURE 1-7: PAIRING - COMPARING PIN CODES & PAIRING OPTIONS When the Bluetooth device manager completes pairing, it issues a message that the Bluetooth device is installed on COMX where COMX is unique to your computer. In some cases, the Bluetooth device manager creates two COM ports; in this situation, only use the COM port labeled outgoing. Figure 1-6 shows example COM port settings. FIGURE 1-8: www.rovingnetworks.com PAIRING - BLUETOOTH COM PORT SETTINGS Version 1.0 12/10/12 page 12 RN-4142-EK-UG If the remote Bluetooth device does not require authentication, a connection can occur without the pairing process. However the Bluetooth specification requires that if either device involved in the pairing process requires authentication, the other device must participate to ensure a secure link. Roving Networks modules default to an open mode, such that the module does NOT require authentication. See “Security Modes” on page 15 for more information on using pass keys. The module may use simple secure pairing (SSP) if it is attempting to pair with devices that support the Bluetooth specification version 2.1 + EDR. SSP does not require the user to remember the pin code, but it asks to confirm the 6-digit number if the device has a display capability. 4.6.3 CONNECTING In most cases, you connect from another device to the RN-41-EK or RN-42-EK as an outgoing Bluetooth connection. You can also make an incoming connection in which the evaluation board initiates the connection to the remote device. 4.6.3.1 Outgoing Connections To establish an outgoing Bluetooth connection from a PC to the RN-41-EK or RN-42-EK board, open the module’s outgoing COM port from your application or a terminal emulator. When you establish a connection by opening the COM port, the evaluation board’s green LED (labeled as S) goes on solid (not blinking) to indicate that the device is connected. The device remains connected until you close the COM port, remove power from the board, or terminate the connection using the K,1 command. Refer to the Bluetooth Command Reference & Advanced Information User’s Guide for more information on using commands. Once connected, the device is in data mode allowing data to flow in both directions. The board’s red LED (labeled as A) blinks once per second when data is transferred over the UART. For configuration and programming, the device must be in command mode. See “Enter Command Mode” on page 7 for more information. Note: 4.6.3.2 Only one client can connect to a slave device at a time. As a master, the device can make multiple connections, but only in a point-to-point, serialized fashion. The RN41 and RN42 modules do not currently support multi-point master mode. Incoming Connections For an incoming connection you use the port specified in your Bluetooth settings as incoming (refer back to Figure 1-6). The PC or host listens for an incoming connection from the remote Bluetooth device, in this case the RN-41-EK or RN-42-EK. Perform the following steps to make in incoming connection. 1. www.rovingnetworks.com You need the MAC address of the PC’s Bluetooth radio to connect from the RN-41-EK or RN-42-EK to the host PC. Open the PC’s Bluetooth advanced settings to find the MAC address. See Figure 1-7. Version 1.0 12/10/12 page 13 RN-4142-EK-UG FIGURE 1-9: 2. 3. 4. 5. 6. PC’S BLUETOOTH RADIO MAC ADDRESS Pair your evaluation board with the PC as described in “Pairing” on page 11. Open a terminal (called terminal A in this example) and connect it to the evaluation board’s outgoing COM port. You can run this terminal on the host PC or another computer. Open a second terminal (called terminal B in this example) on the host PC to listen for the incoming Bluetooth connection using the incoming COM port number. Type C,<MAC address> <cr> in terminal A to establish an SPP connection to the host PC. See Figure 1-8 for an example connection. Try the following commands: • $$$ to enter command mode • SO,% to enable status message to see connect/disconnect conditions • R,1 to reboot • $$$ to re-enter command mode • + to enable local echo • C,<MAC address> to attempt a connection with a remote device Characters you type in terminal B are sent over Bluetooth to the host PC and appear in terminal A. Any characters entered in terminal A are transmitted to terminal B. 7. www.rovingnetworks.com To kill the connection, type the K,1 <cr> command in terminal B. Version 1.0 12/10/12 page 14 RN-4142-EK-UG FIGURE 1-10: 4.7 TERMINALS A & B Security Modes The Bluetooth module supports authentication. If the local or remote Bluetooth device has authentication enabled, a pin code is required the first time a connection is attempted. The pin code is a series of numbers or characters from 1 to 16 characters in length. After you enter the pin code, the Bluetooth devices compare them. If they match, a link key is generated and stored. Usually, but not always, the remote device stores the link key. For subsequent connections, the devices compare link keys. If they are correct, you do not need to re-enter the pin code. If the remote device is a PC or PDA, the user generally is prompted to enter this pin code. To remove the stored link key on the remote device, you typically “unpair” or remove the device from the Bluetooth manager. You can change the pin code to remove the link key on the Bluetooth module, forcing a new pin code exchange to occur upon subsequent connection attempts. Note: www.rovingnetworks.com Only one master can connect to the Bluetooth module at a time. Version 1.0 12/10/12 page 15 RN-4142-EK-UG 5.0 RESOURCES & RELATED DOCUMENTS For more information, refer to the following sources: • RN41/RN41N Class 1 Bluetooth Module Data Sheet • RN42/RN42N Class 2 Bluetooth Module Data Sheet • Bluetooth Command Reference & Advanced Information User’s Guide 6.0 DOCUMENT REVISION HISTORY 6.1 Version 1.0 Initial release. 7.0 ORDERING INFORMATION Table 7-1 provides ordering information for the evaluation kits. TABLE 7-1: EVALUATION KIT ORDERING INFORMATION Part Number Description RN-41-EK Evaluation kit for the RN41 (Class 1) Bluetooth module. RN-42-EK Evaluation kit for the RN42 (Class 2) Bluetooth module. Go to http://www.rovingnetworks.com for current pricing and a list of distributors carrying Roving Networks products. www.rovingnetworks.com Version 1.0 12/10/12 page 16 RN-4142-EK-UG APPENDIX A: RN-41-EK & RN-42-EK SCHEMATIC Figure 1-9 shows the schematic for the RN-42-EK evaluation board. The RN41 and RN42 modules are pin compatible; therefore, the schematic applies to both boards. FIGURE 1-11: RN-41-EK & RN-42-EK SCHEMATIC M1 RN42 Module 3.3V 10 11 3.3V PCM_I N UART_CTS PCM_OUT UART_RTS VDD UART_TX GND UART_RX A IO1 35 0 SHIE L D 12 USB_D+ SPI _SS 22 PI O4 21 PI O5 20 PI O3 19 PI O2 Green LED 470 Connection Status D2 R3 PI O8 Red LED 470 18 17 Activity 16 CT S 15 RT S 14 TX D 13 RX D U1 TC1185 3.3V VBUS 5 C2 1uF 4 VOUT VI N GND PCM_OUT PCM_SYNC 23 D1 R2 PI O5 BYP SHDN 1 3 SHDN R1 C1 1uF 3k3 2 9 USB_D- SPI _MI SO A IO0 PCM_I N PCM_CL K GND 8 PI O2 24 30 7 PCM_SYNC SPI _SCK PIO8 PCM_CL K PI O3 28 6 PI O5 RESET PIO9 SPI _SCK PI O7 31 5 PI O4 PIO10 RESET _N PI O6 32 4 PIO11 3 PI O7 SPI _CS# 33 PI O6 SPI _MOSI GND 2 SPI _MI SO 34 SPI _MOSI GND 29 1 A IO0 100nF C5 100nF 100nF J1 J2 3.3V V B2 V B1 R10 R9 R8 R7 3k3 3k3 3k3 3k3 PI O4 PI O3 PI O6 PI O7 1 2 3 4 3k3 3k3 3k3 3k3 30 TXD 2 RXD 32 RTS 8 CTS 31 DTR 6 DSR 7 DCD 3 RI 22 CBUS0 21 CBUS1 10 CBUS2 11 CBUS3 9 CBUS4 U3 FT232RQ 1 3V 3OUT R12 R13 R11 R14 V CCIO RXD TXD CTS RTS VBUS USBDM USBDP RESET OSCI T E ST 3.3V 1 2 3 4 5 6 7 8 9 10 11 12 OSCO 15 D_N D_P 14 J4 1 VBUS 2 D3 D+ 5 18 MTAB 6 GND USB Mini B 27 28 26 VB2 SHDN PI O4 PI O3 PI O2 CT S RT S TX D RX D PI O11 PI O10 PI O9 PI O8 VB1 19 HEADER 2 PI O6 PI O7 RESET _N 1 2 3 4 5 6 7 8 9 10 11 12 16 VBUS V CC HEADER 1 C4 20 GND 17 GND 4 GND 24 A GND 33 T HPA D PIO8 PIO9 PIO10 PIO11 A IO1 C6 S1 R18 300k A IO1 A IO0 R17 100k R15 300k R16 100k J3 1 2 3 4 5 6 SPI _MI SO SPI _MOSI SPI _SCK SPI _SS 3.3V SPI MASTER www.rovingnetworks.com Version 1.0 12/10/12 page 17 RN-4142-EK-UG NOTES: www.rovingnetworks.com Version 1.0 12/10/12 page 18