Project

General

Profile

Bluetooth Configuration and Usage

The TiWi-BLE Bluetooth radio/interface comes with a pre-configured (burned-in) MAC address from LSR. As long as the Bluetooth Kernel options are enabled in your kernel build and the necessary firmware is present you can use the hci tools to access the Bluetooth and communicate with devices.

Sample Bluetooth 2.1 Usage

The following example will enable the Bluetooth module, show how to check the configuration information of the module, scan for a device and ping a device.

Enable Bluetooth via GPIO 64 (GPIO_20)

root@mitysom-335x ~ $ echo 1 > /sys/class/gpio/gpio64/value

Attach the Bluetooth radio to HCI
root@mitysom-335x ~ $ hciattach /dev/ttyO1 texas 3000000
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/TIInit_7.6.15.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
[  205.059326] Bluetooth: Core ver 2.16
[  205.063232] NET: Registered protocol family 31
[  205.067871] Bluetooth: HCI device and connection manager initialized
[  205.074523] Bluetooth: HCI socket layer initialized
[  205.079620] Bluetooth: L2CAP socket layer initialized
[  205.084930] Bluetooth: SCO socket layer initialized
[  205.134124] Bluetooth: HCI UART driver ver 2.2
[  205.138793] Bluetooth: HCI H4 protocol initialized
[  205.143859] Bluetooth: HCILL protocol initialized
[  205.266021] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  205.271667] Bluetooth: BNEP filters: protocol multicast
[  205.340911] Bluetooth: RFCOMM TTY layer initialized
[  205.346130] Bluetooth: RFCOMM socket layer initialized
[  205.351501] Bluetooth: RFCOMM ver 1.11
Device setup complete

Confirm that it has been detected
root@mitysom-335x ~ $ hciconfig -a
hci0:   Type: BR/EDR  Bus: UART
        BD Address: 84:DD:20:69:8D:F8  ACL MTU: 1021:4  SCO MTU: 180:4
        UP RUNNING PSCAN
        RX bytes:1147 acl:0 sco:0 events:37 errors:0
        TX bytes:934 acl:0 sco:0 commands:37 errors:0
        Features: 0xff 0xfe 0x2d 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF
        Link mode: SLAVE ACCEPT
        Name: 'mitysom-335x-0'
        Class: 0x480100
        Service Classes: Capturing, Telephony
        Device Class: Computer, Uncategorized
        HCI Version: 4.0 (0x6)  Revision: 0x0
        LMP Version: 4.0 (0x6)  Subversion: 0x1f40
        Manufacturer: Texas Instruments Inc. (13)

Scan for 2.1 devices
root@mitysom-335x ~ $ hcitool scan
Scanning ...
        2C:54:CF:91:36:7E       LG_Phone
        3C:77:E6:F2:A8:2B       Device

Ping a 2.1 device
root@mitysom-335x ~ $ l2ping 2C:54:CF:91:36:7E
Ping: 2C:54:CF:91:36:7E from 84:DD:20:69:8D:F8 (data size 44) ...
0 bytes from 2C:54:CF:91:36:7E id 0 time 4.49ms
0 bytes from 2C:54:CF:91:36:7E id 1 time 7.26ms
0 bytes from 2C:54:CF:91:36:7E id 2 time 28.35ms
0 bytes from 2C:54:CF:91:36:7E id 3 time 31.10ms

Bluetooth Low Energy (BLE 4.0) Scanning

root@mitysom-335x ~ $ hcitool lescan
LE Scan ...
EA:26:B3:16:6C:CC

TI Script location on Dev Kit SD card: /usr/share/wl1271-demos/bluetooth/scripts/

Go to top
Add picture from clipboard (Maximum size: 1 GB)