Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

NLCP Bluetooth Command Lines

From Texas Instruments Wiki
Jump to: navigation, search

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:

  1. Step 1: Start the Bluetooth menu
  2. Step 2: Scan for Bluetooth Devices
  3. Step 3: Pairing to Bluetooth Device (establish connection)

Step 4: Choose any (or all) of the following optional Bluetooth profiles:

  1. A2DP
  2. FTP
  3. OPP
  4. SPP
  5. HID

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

Running Bluetooth Commands - Basic Information

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:


root@omap3evm:/usr/share/wl1271-demos/bluetooth/scripts# ./BT_Demo.sh
Starting BT Demo .......
[  593.523040] Bluetooth: Core ver 2.16
[  593.526885] NET: Registered protocol family 31
[  593.531524] Bluetooth: HCI device and connection manager initialized
[  593.538208] Bluetooth: HCI socket layer initialized
[  593.543304] Bluetooth: L2CAP socket layer initialized
[  593.548583] Bluetooth: SCO socket layer initialized

/*
 * #################################################
 *                  Cleaning BT
 * #################################################
 */



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

/*
 * #################################################
 *                  Initia[  593.616699] Bluetooth: Bluetooth Driver for TI WiLink - Version 1.0
lize BT
 * ####################[  593.626434] (stc): st_register(4) ################
[  593.630126] (stc):  chnl_id list empty :4 #############

[  593.635833] (stk) : st_kim_start*/


[  593.640533] plat_kim_chip_enable
[  593.767608] (stk) :ldisc_install = 1
[  593.828857] (stc): st_tty_open
[  593.832183] (stk) : line discipline installed
[  593.838439] (stk) :TIInit_12.8.32.bts
[  593.880126] (stk) :change remote baud rate command in firmware
[  593.886108] (stk) :skipping the wait event of change remote baud
[  593.895843] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  593.901397] Bluetooth: BNEP filters: protocol multicast
[  594.594238] (stc): add_channel_to_table: id 4
[  594.598785] (stc): st_register(2)
[  594.602172] (stc): add_channel_to_table: id 2
[  594.606903] (stc): st_register(3)
[  594.610260] (stc): add_channel_to_table: id 3
[  594.665985] Bluetooth: RFCOMM TTY layer initialized
[  594.671142] Bluetooth: RFCOMM socket layer initialized
[  594.676544] Bluetooth: RFCOMM ver 1.11

+++++++++++++++++++++++++++++++++++++++++++++++++++++
               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. Depending on a device you are pairing with the confirmation message might appear on the device requiring to approve the pair operation. After paring has been approved EVM can successfully finish the pairing procedure.

/*                                                                                                     
 * ########## 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.


Bluetooth A2DP Profile


Refer to Bluetooth demo usecases conntrolled by windows PC Terminal to learn about A2DP Profile demo.

Bluetooth FTP Profile

Hardware Setup

BT FTP setup.jpg
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.

Getting files from remote Linux PC via FTP

Before using OBEX FTP, both devices must first be paired. The following instructions refer to Ubuntu distribution.
Run bluetooth-properties on command line or System->Preferences->Bluetooth menu on main panel.


Bluetooth Preferences.png


Click the<Setup new device...> button.

When the New device setup dialog appears (see screenshot below), click the <Forward> button.


Screenshot-Bluetooth New Device Setup.png

The Device Search dialog appears, listing all the found devices. Choose OMAP3EVM device from the list:


Bluetooth New Device Setup choosed.png

Click the <PIN options...> button to set up the PIN code. To pair with OMAP3EVM, choose the '0000' option and close the dialog (click the Close button).


Screenshot-PIN Options.png

Click the <Forward> button on the Device search dialog (see above) to complete the pairing. The Setup Complete confirmation dialog appears:


Bluetooth New Device Setup completed.png

Now that the two devices are paired, you can transfer files between them. On your Linux PC run:
obexftpd -c [some directory with files] -b & '&' is to run obexftpd in the background.
For example:

bash$sudo obexftpd -c /home/user/Public -b &
[1] 3306
bash$ Waiting for connection...

Now OBEX FTP server is ready to accept connections.

On OMAP3EVM run:
obexftp -b [BD address] -g file
For example:

root@am37x-evm:~# obexftp -b 00:15:83:45:BF:59 -g examples.desktop                                                      
Browsing 00:15:83:45:BF:59 ...                                                  
Connecting..\done                                                               
Tried to connect for 9ms                                                        
Receiving "examples.desktop"...|done                                            
Disconnecting../done                                                            

Run ls command to check the file.

Sending Files from Remote Linux PC to OMAP3EVM via FTP

On OMAP3EVM run:
obexftp [-c directory to store files] -b &
For example:

root@am37x-evm:# obexftpd -c /home/root -b 
Waiting for connection...

Here obexftpd server is run to serve bluetooth connections and all the arriving files will be stored under /home/root directory.
On a Linux PC, run obexftp client to send a file to OMAP3EVM:
obexftp -b BD address -p some file
For example:

bash$ obexftp -b 00:23:D4:E8:F2:C8 -p ./Example.txt
Browsing 00:23:D4:E8:F2:C8 ...
Connecting..\done
Tried to connect for 12ms
Sending "Example".../done
Disconnecting..-done

Run ls command on OMAP3EVM (/home/root in our example) to see the file.

FTP from OMAP3EVM to Remote Device


To send files from OMAP3EVM to the Linux PC, first start OBEX FTP server to accept the files. To do this, run:
obexftpd -c directory -b &
For example:

bash$ obexftpd -c /home/user/Public -b &
[1] 25280
bash$ Waiting for connection...

In this example, all the accepted files will be stored under /home/user/Public directory. To do file transfer from the OMAP3EVM to a Linux PC, you need to know the BD address of your Bluetooth device installed on your PC.
To do this, run:
hcitool scan on OMAP3EVM
For example:

root@am37x-evm:~# hcitool scan
Scanning ...
        0C:DD:EF:F3:79:30       Nokia 5800 XpressMusic
        00:15:83:45:BF:59       Ubuntu, Linux
        00:15:83:15:A3:41       ILL137599

Now run the following command to send a file to the remote Linux:
obexftp -b BD address -p file
For example:

root@am37x-evm:~# obexftp -b 00:15:83:45
:BF:59 -p Picture.jpg
Browsing 00:15:83:45:BF:59 ...
Connecting..\done
Tried to connect for 14ms
Sending "Picture.jpg".../done
Disconnecting..-done
  • Note that OMAP3EVM and a remote device should be paired, if not, obexftp will try to pair with the PC automatically. In this case, a dialog will pop up on your PC, asking you to enter a PIN code. Enter '0000' code and click OK.

You should see the accepted file in the directory given in -c option of obexftpd server (/home/user/Public in our example).

Bluetooth OPP Profile


Hardware Setup


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

File transfer from mobile phone to OMAP3EVM


This test is performed with 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 you want to transfer files from to OMAP3EVM. To do this choose option 1 from Main Menu to perform 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 file from EVM to Remote Device using OPP profile

To transfer file from OPEN3EVM to a mobile phone besides BD address of the remote device you need to know the channel of 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 to enter BD address of a device. Enter BD address of the phone you work with and press Enter key (Refer to section Scan for Bluetooth devices to learn how to find 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

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

At this stage the phone should show confirmation message asking to approve to reception of the file. Due to short timeout pres OK right at the moment the message appeared. Upon approval on the remote device OMAP3EVM will start file transfer:

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 will return to the Main Menu. Choose option 10 to exit from the test.

Scan for Bluetooth devices

The easiest way to scan bluetooth devices is with hcitool command:
hcitool scan

root@am37x-evm:~# hcitool scan
Scanning ...
        1C:65:9D:AD:40:6B       ILL137367
        1C:65:9D:AD:99:99       ILL137419
        1C:65:9D:F8:95:C1       Nir's Laptop
        00:15:83:15:A3:41       Cambridge Silicon bluetooth
        00:15:83:45:BF:59       Ubuntu Desktop
        FF:FF:F7:45:22:03

For each found Bluetooth device hcitool will print its BD address and name.

Pairing to Bluetooth Device

You can pair OPEN3EVM device with other devices via the BT_Demo.sh script. Run the BT_Demo.sh script and choose option 8 - Pair Remote Device. Then, when asked, enter the BD address of the remote device you want to pair with:

+++++++++++++++++++++++++++++++++++++++++++++++++++++
               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 Addr of remote Device to Pair
====> 00:21:FE:90:66:4E
Pairing with 00:21:FE:90:66:4E, Please wait..


Pairing success ...

  • Note that it is implementation dependent if OMAP3EVM will be in the list of paired devices of a remote device.

Serial Port Profile (SPP)

Hardware Setup

BT FTP setup.jpg
to perform that Demo you need a PC with Bluetooth support or with Bluetooth dongle. Please make sure that Bluetooth on 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 PC terminal to EVM

1. Open serial terminal and login to OMAP3EVM. Run BT_Init.sh to initialize 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

2. 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 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.
3. 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 &
Waiting for connection on channel 1

At this point OMAP3EVM is waiting for input from other Bluetooth device, in our example it is second laptop with Bluetooth and running Ubuntu Linux distribution. 4. To work with serial console, please ensure minicom serial console is installed and install it if necessary:

bash:~$ apt-cache show minicom
W: Unable to locate package minicom
E: No packages found
bash$ apt-get install minicom

5. Now create /dev/rfcomm0 device on Linux PC and bind it to OMAP3EVM:

bash:~$ hcitool scan
Scanning ...
	1C:65:9D:F8:93:F1	ILL137729
	00:15:83:15:A3:41	Cambridge Silicon bluetooth
	00:16:41:B4:A8:C7	Shlomi_PC
	00:23:D4:E8:F2:C8	am37x-evm
bash:~$ sudo rfcomm bind 0 00:23:D4:E8:F2:C8 1

The last parameter is channel number of Serial Port service as shown by sdptool browse local ran on OMAP3EVM.
6. Run Minicom communication program and to setup its serial port to /dev/rfcomm0:

minicom -D /dev/rfcomm0

Minicom will start to initialize:

               +--------------------+
               | Initializing modem |
               +--------------------+

Minicom initialized screen.png

  • Note: ignore some garbage characters Minicom flashes at the beginning.

Minicom is ready to receive and send characters and the following output will be seen on OMAP3EVM's terminal:

Connection from 1C:65:9D:AD:40:6B to /dev/rfcomm0
Press CTRL-C for hangup

This output is from rfcomm command run earlier meaning that our Linux PC is connected to OMAP3EVM's serial port.
7. To accomplish the test run cat /dev/rfcomm0 on OMAP3EVM's terminal to read incoming characters:

root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# cat /dev/rfcomm0

A the same time type some text in the Minicom communication program:
Minicom sending from linux.png
The same text will appear on the OMAP3EVM's terminal.

root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# cat /dev/rfcomm0

Sending characters Sending characters from Linux to OMAP3EVM!

To exit Minicom press Ctrl-a + q combination. Once you have exited communication program, rfcomm will stop to run on OMAP3EVM:

root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# Disconnected

[1] + Done                       rfcomm listen /dev/rfcomm0 1

Transferring characters from OMAP3EVM to PC terminal

1. If you have just booted to OMAP3EVM system, please perform 1-6 steps in Transferring characters from PC terminal to EVM .
2. After step 6 you have Minicom communication program running on Linux PC and waiting for incoming from OMAP3EVM characters:

Minicom initialized screen.png

Enter following command on OMAP3EVM's terminal:

root@am37x-evm:/usr/share/wl1271-demos/bluetooth/scripts# echo "Sending characters from OMAP3EVM to Linux" > /dev/rfcomm0

The same output will appear on Minicom communication program's screen:

Minicom sending from OMAP3EVM.png

Human Interface Device Profile (HID)

Hardware Setup

Please refer to Bluetooth demo use-cases controlled by windows PC Terminal to learn about this profile.


HomepageIcon.jpgHOME