adding bluetooth to an embedded system has never been...
TRANSCRIPT
Lab Manual for Bluetooth Evaluation Kit (RN
MASTERs 2012 Lab Manual for RN
Lab 1 Instructions Lab 2 Instructions Lab 3 Instructions
Adding Bluetooth to an ESystem
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
RN-42-SM Evaluation Board
Table of Contents 3 7 11
Adding Bluetooth to an Embedded ystem Has Never Been Easier
Page | 1
mbedded asier
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 2
Lab Equipment
For this lab, you need the following hardware and software. Hardware
• RN-42-SM evaluation kit • Personal computer with a USB port and Bluetooth
Software
• Tera Term software (http://sourceforge.jp/projects/ttssh2/releases/) • Prolific and FTDI chipset drivers
Software utilities are available on the Support page of the Roving Networks web site at http://www.rovingnetworks.com.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 3
Lab 1: Command Mode
Purpose:
This lab will teach you how to:
• Connect the evaluation kit hardware to your PC. • Switch between command mode and data mode. • View the current settings on the module. • Check firmware version running on the module. • Configure the module for master and slave modes.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 4
Overview: In this procedure, you will set up hardware and put the module into command mode. Procedure:
1. Connect the evaluation board. a. Connect the board to your computer (the green LED blinks at 1 Hz). b. Use the device manager to find the COM port to which the board is
connected. Look under Ports (COM & LPT) for the Prolific USB-to-Serial Comm Port driver.
c. The default serial port settings are: • Baud rate: 115,200 • Data: 8 bits • Stop bit: 1 bit • Parity: None • Flow control: None
2. Send an escape sequence to enter command mode. a. $$$ // Notice the Green LED blinks faster b. D // Displays module basic settings c. E // Displays extended settings d. O // Displays other settings e. V // Displays firmware version on module f. SF,1 // Resets module to factory default settings g. H // Displays help: list of all commands
TIP: Enable local echo by sending the plus sign (+)
3. To exit command mode, send the sequence of three minus signs (---). Notice that the green LED blinks more slowly.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 5
4. Change device’s Bluetooth name. The module advertises the Bluetooth device name during the device discovery process. The default name is RN42-ABCD, where ABCD is the last 2 bytes of MAC address.
a. To change the device name, the commands are i. SN,my_device_name //sets device name ii. R,1 //reboot the module
b. Verify the change by: i. Going into command mode. ii. Displaying the basic settings.
5. The module supports master and slave modes. The default mode is slave mode and discoverable. In master mode, the module is not discoverable. To put the module in master mode:
a. Go into command mode. b. SM,1 // Enables master mode c. D // Verify that mode = Mstr d. R,1 // Reboot the module for settings to take effect
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 6
Lab 1 Conclusion You have completed Lab 1. You have:
• Explored the ASCII command set. • Configured the module parameters. • Switched the module between master and slave mode.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 7
Lab 2: Discovering & Connecting from a PC
Purpose:
This lab will teach you how to:
• Discover the module from a PC. • Establish a Bluetooth connection from the PC to the module. • Send data over the Bluetooth link between PC and module.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 8
Procedure:
1. Connect the evaluation kit to your PC’s USB port. 2. Go into command mode. 3. Factory reset the module. 4. Exit command mode. 5. On your PC, open the Bluetooth manager. 6. Click Add new device. The device displays as RN42-ABCD. 7. When prompted, enter the default pin code 1234. Windows creates a virtual
COM port.
8. Check the COM port created in the device manager. 9. Navigate to Ports (COM & LPT). 10. Look for Standard Serial over Bluetooth Link. Note: Sometimes Windows creates two COM ports and labels them incoming and outgoing. In this case, use the outgoing port.
Lab Manual for Bluetooth Evaluation Kit (RN
11. Connect from the PC to the module
a. In Tera Term, open up a new connectionb. Click Serial. c. Choose the Bluetooth COM port
You now have two Tera Term Windows open
• Serial Window • Bluetooth Window
12. Type data in the serial window and it will appear in the Bluetooth window and
vice versa.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
PC to the module. Tera Term, open up a new connection.
Choose the Bluetooth COM port you found previously.
You now have two Tera Term Windows open:
serial window and it will appear in the Bluetooth window and
Page | 9
serial window and it will appear in the Bluetooth window and
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 10
Lab 2 Conclusion You have completed Lab 2. You have:
• Seen the process of discovering the RN-42 module from the PC. • Established a Bluetooth connection to the module form the PC. • Sent data over the Bluetooth connection between the PC and the RN-42 module.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 11
Lab 3: Connect to a Device
Purpose:
This lab will teach you how to:
• Perform a scan from the module to discover other Bluetooth devices. • Establish a Bluetooth to another Bluetooth device from the module. • Establish a connection to another Roving Bluetooth device and send data.
Lab Manual for Bluetooth Evaluation Kit (RN
Procedure:
1. Discover Bluetooth devices from
scanning (inquiry). The module returns a list of devices found with COD. It finds a maximum
2. To disconnect from a connected devicea. Go into command modeb. Issue K,1 command
3. Enable status strings a. Go into command modeb. Issue the SO,% andc. Connect to your partner’s module
Notice the %connect string when you connectNotice the %disconnect 4. Make a connection using
a. Get the Bluetoothlabel.
b. c,000666123456 The module returns successfully, the neighbors module.
c. Once connected, d. Observe the data t
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Discover Bluetooth devices from the module by issuing the I,10 command to start
The module returns a list of devices found with the Bluetooth address, nameimum of 9 devices per scan.
To disconnect from a connected device Go into command mode
command ings to connect/disconnect.
o command mode. and R,1 commands.
Connect to your partner’s module.
string when you connect. string when you disconnect.
sing the connect command. Bluetooth address of your neighbors Bluetooth module from the
c,000666123456 // Second parameter is the Bluetooth // address
odule returns the status TRYING. When the module connects the green LED goes on solid. You are now connecte
neighbors module.
onnected, send data by typing in the terminal window.the data that appears on your partner’s terminal window
Page | 12
command to start
address, name, and
module from the
econd parameter is the Bluetooth
module connects now connected to our
window. indow.
Lab Manual for Bluetooth Evaluation Kit (RN-42-SM)
Page | 13
Lab 3 Conclusion You have completed Lab 3. You have learned that:
• The module can scab for Bluetooth devices in its environment. • A maximum of 9 devices are found per inquiry. • You can connect to the devices using the connect command. • The module only supports one active connection at a time. • Connection status strings print text over the UART for every connect/disconnect.