AM37x Wireless Connectivity NLCP Bluetooth Terminal

'''  Content is no longer maintained and is being kept for reference only! '''

Bluetooth Demo use-cases - Introduction
This section describes how to set the following Bluetooth profiles (after configuring the hardware and system-setup): A2DP, FTP, OPP, SPP, HID. The configuration includes the following phases: Step 4: Choose any (or all) of the following optional Bluetooth profiles:
 * 1)  Step 1: Start the Bluetooth menu
 * 2)  Step 2: Scan for Bluetooth Devices
 * 3)  Step 3: Pairing to Bluetooth Device (establish connection)
 * A2DP
 * FTP
 * OPP
 * SPP
 * HID
 * FTP Between Two EVMs

NOTE: the first three phases are common to all profiles.

Running Bluetooth Commands - Basic Information

 * NLCP Bluetooth HCI commands

Step 1: Start the Bluetooth Menu
To access the Bluetooth demo menu, run the BT_Demo.sh script under the Bluetooth_scripts folder: root@omap3evm:#cd /usr/share/wl1271-demos/bluetooth/scripts/ root@omap3evm:#./BT_Demo.sh Below is the screen capture after calling the BT_Demo.sh script:

Starting BT Demo ....... /* * ################################################# *                 Cleaning BT * ################################################# */

!!!!!!!!!!! Start from the MAIN MENU !!!!!!!!!!!!!!!!!

/* * ################################################# *                 Initialize BT * ################################################# */

Set BT_EN of WL1271

WL1271: Powering on

Found a Texas Instruments' chip!

Firmware file : /lib/firmware/TIInit_7.2.31.bts

Loaded BTS script version 1

texas: changing baud rate to 3000000, flow control to 1

Device setup complete

+++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====>

Step 2: Scan for Bluetooth Devices
From the BT_Demo.sh main menu, choose the option "1 - BT Scan Remote Devices": +++++++++++++++++++++++++++++++++++++++++++++++++++++                                                                MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++                                                     1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====> 1                                                                                               /*                                                                                                      * ########### BT-Scan ############# * Scan for the remote BT devices * #################################                                                                   */                                                                                                    Scanning ...         1C:65:9D:F8:93:F1       ILL137729 1C:65:9D:AD:99:99      ILL137419 1C:65:9D:F4:6E:C5      ILL137564 00:21:19:24:A4:43      Samsung SBH500 00:15:83:15:A3:41      Cambridge Silicon bluetooth 5C:AC:4C:CC:37:AC      ED0CF2C0A53C426 00:10:C6:D4:1F:3D      SBLNB336GHO

Step 3: Pairing to Bluetooth Device
To 'pair' between your EVM and the remote Bluetooth device (to establish connection): From the BT_Demo.sh Main menu, choose the option "8 - Pair Remote Device": +++++++++++++++++++++++++++++++++++++++++++++++++++++                                                                MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++                                                     1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====> 8       Help: Important: Ensure that the remote device is in pairing/scanning mode. Before running Pairing-Test, ensure that we have the following mandatory inputs a. BD Address of Remote BT-Device (Use Option-1 of MAIN MENU) 1. Continue...                                                                                        2. Goto MAIN MENU ====> 1                                                                                               /*                                                                                                      * ########## BT-Pair ######## * Pair to a remote BT device * ###########################                                                                         */                                                                                                    Enter the BD_Address of the device you want OMAP3EVM to pair with: /*                                                                                                     * ########## BT-Pair ######## * Pair to a remote BT device * ###########################                                                                         */                                                                                                    Enter the BD Addr of the remote Device to Pair ====> 00:21:19:24:A4:43 Pairing with 00:21:19:24:A4:43, Please wait.. Pairing success ...                                                                                   +++++++++++++++++++++++++++++++++++++++++++++++++++++ MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++                                                     1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down

Step 4: Select Desired Profile
The following sections provide detailed instructions corresponding to the selected profile(A2DP, FTP, etc.). NOTE: from the following sections, refer ONLY to the section corresponding to your desired profile.

Hardware Setup
To run this demo, you need a set of stereo BT Headphones (such as the Motorola MOTOROKR S9-HD, or any other headset that supports the BT A2DP profile).

Running the Demo
Put your Bluetooth headset in a discoverable mode, according to the manufacturer's instructions that came with your headset. From the BT main menu choose the option: "1 -BT Scan Remote Devices" to start scanning ====> 1

/* * ########### BT-Scan ############# * Scan for the remote BT devices * ################################# */

Scanning ... 00:10:C6:C2:D3:7F      CN        00:12:1C:BB:05:46       Parrot MK6000v1.01c 00:13:FD:02:C0:5E      Nokia 62 00:0D:FD:30:65:B6      Motorola S9-HD +++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====>

Choose the option: "8 - Pair Remote Device", to pair with the BT headset In the example provided below, we will pair with Motorola S9-HD Bluetooth headset. ====> 8 Help: Important: Ensure that the remote device is in pairing/scanning mode. Before running Pairing-Test, ensure that we have the following mandatory inputs a. BD Address of Remote BT-Device (Use Option-1 of MAIN MENU) 1. Continue... 2. Goto MAIN MENU ====> 1

/* * ########## BT-Pair ######## * Pair to a remote BT device * ########################### */

Enter the BD Addr of the remote BT device with which you wish to pair. Enter the BD_Addr of the headset with which you wish to work. The BD_Addr of each found Bluetooth device is indicated in the first column of Scan-Results output, for example, BD_Addr of "Motorola S9-HD" headset is 00:0D:FD:30:65:B6 ====> 00:0D:FD:30:65:B6 Pairing with 00:0D:FD:30:65:B6, Please wait..

Pairing success ... +++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++  1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====> Now the OMAP3EVM and the BT headphones are paired, and you can start the A2DP test (testing the connection) by choosing the menu entry: "7 - A2DP Test" ====> 7

Help: Before running A2DP-Test, ensure that we have the following mandatory inputs a. BD Address of Remote BT-Device (Use Option-1 of MAIN MENU) b. The remote A2DP device is paired (Use Option-8 of MAIN MENU) 1. Start Audio... 2. Stop Audio... 3. Goto MAIN MENU enter 1 to continue, if you already have the Bluetooth device BD_Adrr ====> 1

/* * ################################# A2DP ################################### * Advanced Audio Distribution Profile (A2DP) defines how the high quality * audio can be streamed from one device to another over Bluetooth connection. * ########################################################################## */

Enter the BD Address of the A2DP device Enter the Bluetooth device BD_Addr (in the provided example: 00:0D:FD:30:65:B6 ) ====> 00:0D:FD:30:65:B6 '/etc/asound.conf' got updated, ensure that we will pair to the device 00:0D:FD:30:65:B6 for A2DP

/* * ################################# A2DP ################################### * Advanced Audio Distribution Profile (A2DP) defines how the high quality * audio can be streamed from one device to another over Bluetooth connection. * ########################################################################## */

Enter the stereo wav file name with the path ====> OMAP3EVM comes with following example files in the gallery: Document.jpg  Pop.wav WLAN_Bluetooth_demo.wmv Enter the audio .wav file name: ====> Pop.wav Playing WAVE '/home/root/DEMO/bluetooth_scripts/../gallery/Pop.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

2. Stop Audio... 3. Goto MAIN MENU

Enjoy the music playing on the Bluetooth headphones. The Pop.wav file in this example will play for about two minutes. You may choose the option: "2. Stop Audio" to stop the soundtrack and return to the Main menu. Do not press ^C or ^Z as this will result in a system crash. ====> Pop.wav Playing WAVE '/usr/share/wl1271-demos/bluetooth/gallery/Pop.wav' : Signed 16 bit Little Endian, Rate 4o 2. Stop Audio...                                                                                      3. Goto MAIN MENU ====> 2                                                                                              Aborted by signal Terminated...                                                                        +++++++++++++++++++++++++++++++++++++++++++++++++++++ MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++                                                     1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====>

Bluetooth FTP Profile
There is no standard procedure to perform FTP over Bluetooth using Windows OS. Our verified procedure is using Linux OS. For execution of the FTP demo, refer to: the description of FTP profile demo for Linux.

Hardware Setup
To run this demo, you need a mobile phone that supports the BT OPP Profile, or a Laptop with BT connection, that support OPP profile.

File transfer from mobile phone to OMAP3EVM
This test is performed using the BT_Demo.sh script. Run the following commands: am37x-evm:# cd /usr/share/wl1271-demos/bluetooth/scripts/ am37x-evm:# ./BT_Demo.sh Step 1 is to find out the BD Address of a remote mobile-phone from which you wish to transfer files to OMAP3EVM. To do so, choose the option 1 from the Main Menu, to perform the Scan Remote Devices procedure +++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down

====> 1

/* * ########### BT-Scan ############# * Scan for the remote BT devices * ################################# */

Scanning ... 1C:65:9D:AD:99:99      ILL137419 C4:17:FE:F4:B9:34      ILL102951 FF:FF:F7:45:22:03 1C:65:9D:F8:95:C1      Vista's Laptop 1C:65:9D:AD:40:6B      ILL137367 1C:65:9D:F4:6E:C5      ILL137564 00:15:83:45:BF:59      Ubuntu Desktop 00:21:FE:90:66:4E      Nokia E71 00:15:83:15:A3:41      Cambridge Silicon bluetooth

Step 2 - choose option "3 - OPP Test" and option 1 to continue to OPP test sub menu:

+++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====> 3       Help: Before running OPP-Test, ensure that we have the following mandatory inputs a. BD Address of Remote BT-Device (Use Option-1 of MAIN MENU) b. Channel Number of the OPP service of that device (Use Option-2 of MAIN MENU) 1. Continue... 2. Goto MAIN MENU ====> 1

Step 3 - pair your mobile phone with OMAP3EVM. To do so, enter Bluetooth menu on your phone, find OMAP3EVM device and pair. When you are asked to enter PIN code, enter '0000'. Upon pairing accomplishment choose option 1 from OPP test menu:

Options for OPP test
1 - Object Push from Remote-Device to WL1271-Host 2 - Object push from WL1271-Host to Remote-Device 3 - Goto MAIN MENU ====> 1 The test will run OPP server and wait for incoming file transfer: /* * ############################### BT-OPP ################################## * Object Push Profile (OPP) is for sending objects such as pictures, * virtual business cards etc. It is called push because the transfers * are always instigated by the sender (client), not the receiver (server). * ######################################################################### */ --- Object Push from Remote-Device to WL1271-Host --- Ignore the following debug messages if you get it; "Unknown event!" /     "Link broken (this does not have to be an error)! " / "OBEX_HandleInput returned!! "

Received files will be copied to pwd -     /usr/share/wl1271-demos/bluetooth/scripts Waiting for connection... Press "Enter" to stop the OPP server:

Pay attention to the directory where received files will be stored. At this point send a file from your phone to OMAP3EVM. Once the file has arrived you will see the following output: Unknown event! ............................................................................................... put_done Skipped header 42 put_done Skipped header 44 Filename = 06032011058.jpg Wrote 06032011058.jpg (206508 bytes)

Press Enter to return to the Main Menu and choose option "10 - Exit Without BT Shut Down". Go to the specified directory and check the arrived file.

Send a File from EVM to a Remote Device, using OPP Profile
To transfer a file from OPEN3EVM to a mobile phone, besides the BD address of the remote device, you also need to know the channel of the OPP Profile on the remote device. Run BT_Demo.sh again and choose option "2 - BT Get capabilities of Remote Device". The script will ask you to enter the BD address of a device. Enter the BD address of the phone you are working with and press the Enter key (Refer to section Scan for Bluetooth devices to learn how to find the BD address of bluetooth devices): +++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down

====>; 2 /* * #################### BT-Browse ################## * Browse the Device and get the device capabilities * ################################################# */

Note: Capture the following LOG for further reference

Enter the BD Addr of remote Device for browsing ====> 00:21:FE:90:66:4E

=
======= 00:21:FE:90:66:4E ======================

Browsing 00:21:FE:90:66:4E ... The list of Bluetooth capabilities of the chosen remote device will be print on a terminal. Scroll up to find OBEX Object Push service. For example: ...

Service Name: OBEX Object Push Service RecHandle: 0x1000e Service Class ID List: "OBEX Object Push" (0x1105) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 9 "OBEX" (0x0008) Language Base Attr List: code_ISO639: 0x454e encoding:   0x6a base_offset: 0x100 Profile Descriptor List: "OBEX Object Push" (0x1105) Version: 0x0100

... For each Service among other information you will find the channel id of the service. In our case it is Channel: 9. Now Choose option "3 - OPP Test" from the Main Menu of BT_Demo.sh: +++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down ====> 3       Help: Before running OPP-Test, ensure that we have the following mandatory inputs a. BD Address of Remote BT-Device (Use Option-1 of MAIN MENU) b. Channel Number of the OPP service of that device (Use Option-2 of MAIN MENU) 1. Continue... 2. Goto MAIN MENU ====> 1 Choose option 2 from the OPP test menu and follow instructions of the test:

Options for OPP test
1 - Object Push from Remote-Device to WL1271-Host 2 - Object push from WL1271-Host to Remote-Device 3 - Goto MAIN MENU ====> 2 /* * ############################### BT-OPP ################################### * Object Push Profile (OPP) is for sending objects such as pictures, * virtual business cards etc. It is called push because the transfers * are always instigated by the sender (client), not the receiver (server). * ########################################################################## */ --- Object push from WL1271-Host to Remote-Device --- Enter the BD_ADDR of the remote Device for OPP test ====> 00:21:FE:90:66:4E Enter the channel number of OPP service for the 00:21:FE:90:66:4E ====> 9

Local File Available ...

Document.jpg            WLAN_Bluetooth_demo.wmv  kuku.jpg Pop.wav                 ch00.pdf                 paring_next.bmp Enter the Local file to be transferred ====> Pop.wav name=/usr/share/wl1271-demos/bluetooth/gallery//Pop.wav, size=20878894 Local device 00:23:D4:E8:F2:C8 Remote device 00:21:FE:90:66:4E (9) Connection established

+++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down

====>;

Upon transfer completion, the script returns to the Main Menu. Choose option 10 to exit the test.

Introduction
In this test we will demonstrate the Bluetooth Serial Port Profile (SPP). It emulates a serial cable to provide a simple substitute for existing RS-232, including the familiar control signals. We will demonstrate the SPP capabilities between the EVM and a PC where the PC is connected via Bluetooth to the EVM.

Hardware Setup
To perform this demo, you need a PC with bluetooth support or with Bluetooth dongle. Also, make sure that Bluetooth in your laptop is configured to be discoverable or "available to be searched". This may require changing the security level settings on the PC Bluetooth Connection Manager.

Transferring Characters from a PC Terminal to the EVM
Open a serial terminal and login to the OMAP3EVM. Run BT_Init.sh to initialize the Bluetooth on OMAP3EVM's termianl: root@am37x-evm:cd /usr/share/wl1271-demos/bluetooth/scripts root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# ./BT_Init.sh

/* * ################################################# *                 Initialize BT * ################################################# */

Found a Texas Instruments' chip! Firmware file : /lib/firmware/TIInit_7.2.31.bts Loaded BTS script version 1 texas: changing baud rate to 3000000, flow control to 1 Device setup complete Add SPP service to the OMAP3EVM's device with sdptool: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# sdptool add SP Serial Port service registered Verify that the serial-port was added as an avaiable service: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# sdptool browse local Browsing FF:FF:FF:00:00:00 ... ... Service Name: Serial Port Service Description: COM Port Service Provider: BlueZ Service RecHandle: 0x10006 Service Class ID List: "Serial Port" (0x1101) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1 Language Base Attr List: code_ISO639: 0x656e encoding:   0x6a base_offset: 0x100 Profile Descriptor List: "Serial Port" (0x1101) Version: 0x0100 ... In our example the Serial Port service has channel 1. The next step is to run rfcomm command to listen for transfered characters rfcomm listen /dev/rfcomm0 channel number. For example: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# rfcomm listen /dev/rfcomm0 1 &amp; Waiting for connection on channel 1 At this point, OMAP3EVM is waiting for input from another Bluetooth device, in our example it is a second laptop with Bluetooth. On the Laptop with Bluetooth device installed on open Serial Terminal (TerTerm for example) and setup it to connect to Outgoing Serial Port of OMAP3EVM. If you do not know which COM port OMAP3EVM got on the laptop, go to Contol Panel and open Bluetooth Devices: Choose COM Ports tab and look at the list of ports connected to OMAP3EVM. Set up your serial terminal with the Outgoing COM port (COM9 in our example):

When you open a Serial Terminal with the correct COM port, you will see the following output on OMAP3EVM's terminal: Connection from 1C:65:9D:AD:40:6B to /dev/rfcomm0 Press CTRL-C for hangup This output is received from the rfcomm command which was run earlier. To accomplish the test, run: cat /dev/rfcomm0 on OMAP3EVM's terminal to read the incoming characters: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# cat /dev/rfcomm0 At the same time, type some text on the serial terminal: The same text will appear on the OMAP3EVM's terminal. Hello am37x-evm!

Transferring Characters from OMAP3EVM to PC Terminal
Initialize Bluetooth device on OMAP3EVM: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# ./BT_Init.sh

/* * ################################################# *                 Initialize BT * ################################################# */

Found a Texas Instruments' chip! Firmware file : /lib/firmware/TIInit_7.2.31.bts Loaded BTS script version 1 texas: changing baud rate to 3000000, flow control to 1 Device setup complete Add Serial Port service to the list of services provided by the OMAP3EVM's device: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# sdptool add SP Serial Port service registered Verify that the Serial port was added as available service and remember the channel number which will be used later: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# sdptool browse local Browsing FF:FF:FF:00:00:00 ...

Service Name: Serial Port Service Description: COM Port Service Provider: BlueZ Service RecHandle: 0x10006 Service Class ID List: "Serial Port" (0x1101) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 1 Language Base Attr List: code_ISO639: 0x656e encoding:   0x6a base_offset: 0x100 Profile Descriptor List: "Serial Port" (0x1101) Version: 0x0100 Run rfcomm utility to listen on a specified RFCOMM channel for incoming  connections: rfcomm listen   where the device is of form /dev/rfcomm0 and channel is the same channel number given at the time of service registration with sdptool: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# rfcomm listen /dev/rfcomm0 1 & Expected results: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# Waiting for connection on channel 1 Open serial terminal on your PC Laptop and setup its serial port. Please refer to the previous section to learn how to check COM ports of connected Bluetooth devices. Ones serial terminal is connected to the COM port the SDP profile on OMAP3EVM will be activated and the following output will be printed on EVM's terminal: Connection from 1C:65:9D:AD:40:6B to /dev/rfcomm0 Press CTRL-C for hangup where 1C:65:9D:AD:40:6B is BD address of the laptop we are working with Echo some text to rfcomm0 device root@omap3evm:~/1271/bluetooth# echo "writing to the PC terminal via SPP profile" > /dev/rfcomm0 the same text should be seen on the PC serial terminal:

Hardware Setup
To run this demo you need a Bluetooth HID device like Bluetooth mouse or Bluetooth keyboard that support the BT HID profile

Run BT_init.sh script to enable the BT stack am37x-evm login: root root@am37x-evm:~# cd /usr/share/wl1271-demos/bluetooth/scripts/ root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# ./BT_Init.sh

/* * ################################################# *                 Initialize BT * ################################################# */

Found a Texas Instruments' chip! Firmware file : /lib/firmware/TIInit_7.2.31.bts Loaded BTS script version 1 texas: changing baud rate to 3000000, flow control to 1 Device setup complete Exit from the Menue keeping the Bluetooth working, by pressing the option: 10 Use hcitool to search for Bluetooth devices (some manufacturers print BD address on device's label, if so, skip this step): root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# hcitool -i hci0 scan Scanning ...                                                                                                  1C:65:9D:AD:40:6B       ILL137367 00:1F:20:15:FB:37      Logitech MX Revolution Mouse 90:00:4E:EC:F4:67      ILL137717 00:24:EF:95:9B:96      Ghadir For each device hcitool prints BD address of the device and its name. Run Bluetooth HID daemon hidd to connect OMAP3EVM to a mouse. In our example we connect to the mouse with BD address 00:1F:20:15:FB:37      Logitech MX Revolution Mouse : root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# hidd --connect 00:1F:20:15:FB:37 Connect command receives BD address of the mouse as argument. Now to check if a mouse is connected list current HID connections: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# hidd --list 00:1F:20:15:FB:37 Logitech MX Revolution Mouse                               [046d:b007] connected The mouse is connected and can be used. To proceed with demo list all input devices that are currently active: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# cat /proc/bus/input/devices I: Bus=0019 Vendor=0001 Product=0001 Version=0003 N: Name="TWL4030 Keypad" P: Phys=twl4030_keypad/input0 S: Sysfs=/devices/platform/omap/omap_i2c.1/i2c-1/1-004a/twl4030_keypad/input/inp ut0 U: Uniq= H: Handlers=sysrq kbd event0 B: EV=100013 B: KEY=1680 0 70032 53840000 B: MSC=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000 N: Name="ADS7846 Touchscreen" P: Phys=spi1.0/input0 S: Sysfs=/devices/platform/omap2_mcspi.1/spi1.0/input/input1 U: Uniq= H: Handlers=mouse0 event1 B: EV=b B: KEY=400 0 0 0 0 0 0 0 0 0 0 B: ABS=1000003

I: Bus=0000 Vendor=0000 Product=0000 Version=0000 N: Name="twl4030_pwrbutton" P: Phys=twl4030_pwrbutton/input0 S: Sysfs=/devices/platform/omap/omap_i2c.1/i2c-1/1-0049/twl4030_pwrbutton/input/input2 U: Uniq= H: Handlers=kbd event2 B: EV=3 B: KEY=100000 0 0 0

I: Bus=0005 Vendor=046d Product=b007 Version=0019 N: Name="Logitech MX Revolution Mouse                              " P: Phys=00:23:D4:E8:F2:C8 S: Sysfs=/devices/virtual/bluetooth/hci0/hci0:1/input6 U: Uniq=00:1F:20:15:FB:37 H: Handlers=kbd mouse1 event3 B: EV=1f B: KEY=837fff 2c3027 bf004444 0 0 ffff0001 f84 8b27c000 667bfa d9415fed 8e0000 0 0 0 B: REL=1c3 B: ABS=1 0 B: MSC=10 Find the section with the line "N: Name=" where the name is of the connected mouse: N: Name="Logitech MX Revolution Mouse" In the found section look at the "H: Handlers=" line: H: Handlers=kbd mouse1 event3 These are names of the handler drivers associated with the connected mouse. Each movement of the mouse can be seen by reading device file /dev/input/mouse1: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# cat /dev/input/mouse1 | hexdump Now move the mouse, the output like this will be printed: 0000940 12ef 4dd1 662e 000a 0002 0000 0002 0000 0000950 12ef 4dd1 668a 000a 0000 0000 0000 0000 0000960 12ef 4dd1 6741 000a 0002 0000 0001 0000 0000970 12ef 4dd1 679c 000a 0000 0000 0000 0000 0000980 12ef 4dd1 a2dc 000a 0002 0000 0017 0000 0000990 12ef 4dd1 a319 000a 0002 0001 fffe ffff 00009a0 12ef 4dd1 a356 000a 0000 0000 0000 0000 00009b0 12ef 4dd1 c142 000a 0002 0000 0008 0000 00009c0 12ef 4dd1 c19d 000a 0002 0001 fffe ffff 00009d0 12ef 4dd1 c1da 000a 0000 0000 0000 0000 00009e0 12ef 4dd1 1cb0 000b 0002 0000 0012 0000 00009f0 12ef 4dd1 1ced 000b 0002 0001 fff8 ffff 0000a00 12ef 4dd1 1d2b 000b 0000 0000 0000 0000 0000a10 12ef 4dd1 1112 000c 0002 0000 0012 0000 0000a20 12ef 4dd1 114f 000c 0002 0001 ffef ffff 0000a30 12ef 4dd1 118c 000c 0000 0000 0000 0000

...

to complete the test use hidd --kill  command to terminate HID connection: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# hidd --kill 00:1F:20:15:FB:37

Introduction
This test demonstrates the FTP over Bluetooth capability where one EVM sends a file to second EVM using the FTP Profile.

Hardware Setup
This test is performed using the BT_Demo.sh script. Run the following commands on both EVMs: am37x-evm:# cd /usr/share/wl1271-demos/bluetooth/scripts/ am37x-evm:# ./BT_Demo.sh You will get: +++++++++++++++++++++++++++++++++++++++++++++++++++++              MAIN NENU +++++++++++++++++++++++++++++++++++++++++++++++++++++   1 - BT Scan Remote Devices 2 - BT Get capabilities of Remote Device 3 - OPP Test 4 - FTP Test 5 - HID Test 6 - HSP Test 7 - A2DP Test 8 - Pair Remote Device 9 - Unpair Remote Device 10 - Exit Without BT Shut Down 11 - Exit With BT Shut Down Now that we activated the Bluetooth devices on both EVMs, we would like to change their names in order to be able to distinguish between them. On both EVMs type 10 in order to exit the demo without shutting down the Bluetooth devices. On one EVM enter the command: hciconfig hci0 name ECS1 and on the other EVM enter the command: hciconfig hci0 name ECS2 These commands change the Bluetooth devices name to ECS1 and ECS2. Now that target is to transfer file from one EVM to the second EVM so let’s create one file on EVM1 to be later sent to EVM2 over the Bluetooth media, that file should be located inside gallery directory: vi /usr/share/wl1271-demos/bluetooth/gallery/bt_test_file VI editor will be opened, type i in order to start inserting characters, then enter any text you want, for example: This is a Bluetooth FTP demo!! In order to save the file press escape button then type: wq:. this will save the file. Now that we changed the Bluetooth device name and created a file, let's go back to first EVM (ECS1) and reactivate the Bluetooth demo: am37x-evm:# ./BT_Demo.sh Then, type 1 in order to scan for remote Bluetooth devices. You will get a result as follows: /* * ########### BT-Scan ############# * Scan for the remote BT devices * ################################# */

Scanning ... 1C:65:9D:AD:99:99      n/a 00:15:83:15:A3:41      Cambridge Silicon bluetooth 0C:DD:EF:F3:79:30      Nokia 5800 XpressMusic 00:26:08:C7:59:36      yotamr-MacBookPro-0 00:23:D4:E8:F2:C8      ECS2. D4:88:90:E0:E3:6F      orange S5620 1C:65:9D:AD:40:6B      ILL137367 00:16:41:B4:A8:C7      Shlomi_PC Here, you can see the ECS2 with its MAC address (00:23:D4:E8:F2:C8). Save the MAC address somewhere since we will use it later on. We need to know what is the channel for the file transfer protocol. In order to do that, type 2 to get the capabilities of Bluetooth device. You will be prompted for the BD Address (MAC Address). Type the ECS2 MAC Address. You will get a list of all Bluetooth capabilities of ECS2: /* * #################### BT-Browse ################## * Browse the Device and get the device capabilities * ################################################# */

Note: Capture the following LOG for further reference

Enter the BD Addr of remote Device for browsing ====> 00:23:D4:E8:F2:C8

=
======= 00:23:D4:E8:F2:C8 ======================

Browsing 00:23:D4:E8:F2:C8 ... Service Name: Headset Audio Gateway Service RecHandle: 0x10000 Service Class ID List: "Headset Audio Gateway" (0x1112) "Generic Audio" (0x1203) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 12 Profile Descriptor List: "Headset" (0x1108) Version: 0x0102

Service Name: Hands-Free Audio Gateway Service RecHandle: 0x10001 Service Class ID List: "Handsfree Audio Gateway" (0x111f) "Generic Audio" (0x1203) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 13 Profile Descriptor List: "Handsfree" (0x111e) Version: 0x0105

Service Name: Audio Source Service RecHandle: 0x10002 Service Class ID List: "Audio Source" (0x110a) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 25 "AVDTP" (0x0019) uint16: 0x102 Profile Descriptor List: "Advanced Audio" (0x110d) Version: 0x0102

Service Name: AVRCP TG Service RecHandle: 0x10003 Service Class ID List: "AV Remote Target" (0x110c) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 23 "AVCTP" (0x0017) uint16: 0x103 Profile Descriptor List: "AV Remote" (0x110e) Version: 0x0100

Service Name: AVRCP CT Service RecHandle: 0x10004 Service Class ID List: "AV Remote" (0x110e) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 23 "AVCTP" (0x0017) uint16: 0x103 Profile Descriptor List: "AV Remote" (0x110e) Version: 0x0100

Service Name: OBEX Object Push Service RecHandle: 0x10005 Service Class ID List: "OBEX Object Push" (0x1105) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 9 "OBEX" (0x0008) Profile Descriptor List: "OBEX Object Push" (0x1105) Version: 0x0100

Service Name: OBEX File Transfer Service RecHandle: 0x10006 Service Class ID List: "OBEX File Transfer" (0x1106) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 10 "OBEX" (0x0008) Profile Descriptor List: "OBEX File Transfer" (0x1106) Version: 0x0100 Here we see that the OBEX file transfer is on channel 10. Now, we would like to send the file we created earlier on ECS1 EVM to ECS2. We do that by typing 4 in Bluetooth menu.

Options for FTP tests
1 - FTP from Remote Device to OMAP3EVM 2 - FTP from OMAP3EVM to remote device 3 - Goto MAIN MENU Type 2 in order to send data from the EVM to remote device: ====> 2

Help: Before running FTP-Test, ensure that we have the following mandatory inputs a. BD Address of Remote BT-Device (Use Option-1 of MAIN MENU) b. Channel Number of the FTP service of that device. (Use Option-2 of MAIN MENU) 1. Continue... 2. Goto MAIN MENU Type 1 to continue. ====> 1

/* * ########################## BT-FTP ################################ * File Transfer Profile (FTP) provides capability to transfer files * and folders in an object store (file system) of another system. * ################################################################## */

FTP from OMAP3EVM to remote device

Note: For this test ensure that we have BD_ADDR of remote device and CH_NUM of   this remote device for FTP service

Enter the BD_ADDR of the remote Device for FTP test Enter the ECS2 MAC address here. You will be prompted for the channel. Type the FTP channel you found earlier. Enter the BD_ADDR of the remote Device for FTP test ====> 00:23:D4:E8:F2:C8 Enter the channel number of FTP service ====> 10

Local File Available under "/usr/share/wl1271-demos/bluetooth/gallery"

Document.jpg            WLAN_Bluetooth_demo.wmv  demo_for_BT Pop.wav                 bt_test_file

Enter the local file name to be sent over FTP Now type the file name you want to send over the FTP. In our example it is bt_test_file ====> bt_test_file Connecting..\done Tried to connect for 497ms Sending "/usr/share/wl1271-demos/bluetooth/gallery/bt_test_file"...|done Disconnecting../done Now we may go to second EVM (ECS2) and go to tge gallery directory in there. If we type ls we should be able to find our file: root@am37x-evm:/# cd /usr/share/wl1271-demos/bluetooth/gallery root@am37x-evm:/usr/share/wl1271-demos/bluetooth/gallery# ls Document.jpg            WLAN_Bluetooth_demo.wmv Pop.wav                 bt_test_file Let's view the file content: root@am37x-evm:/usr/share/wl1271-demos/bluetooth/gallery# cat bt_test_file This is a Bluetooth FTP demo!! We can see that this is the file we typed in first EVM. HOME