world leader in high performance signal processing
Trace: » bluetooth_over_uart

Kernel Configuration

Enable Bluetooth Support and HCI UART driver

[*] Networking support
      Networking options  --->
[ ]   Amateur Radio support  --->
< >   IrDA (infrared) subsystem support  --->
<*>   Bluetooth subsystem support  --->
< >   Generic IEEE 802.11 Networking Stack

--- Bluetooth subsystem support
<*>   L2CAP protocol support
<*>   SCO links support
<*>   RFCOMM protocol support
[*]     RFCOMM TTY support
<*>   BNEP protocol support
[*]     Multicast filter support
[*]     Protocol filter support
<*>   HIDP protocol support
      Bluetooth device drivers  --->

<*> HCI UART driver
[*]   UART (H4) protocol support
[*]   BCSP protocol support
< > HCI VHCI (Virtual HCI device) driver (NEW)

In case you are using a CSR based chipset module you also want to enable the BCSP protocol support - if unsure simply enable both

UART (H4) is serial protocol for communication between Bluetooth device and host. This protocol is required for most Bluetooth devices with UART interface, including PCMCIA and CF cards.

BCSP (BlueCore Serial Protocol) is serial protocol for communication between Bluetooth device and host. This protocol is required for non USB Bluetooth devices based on CSR BlueCore chip, including PCMCIA and CF cards.

Buildroot Configuration

  1. Install Blackfin GNU toolchain packages with full uClibc built-in.
  2. make bf609-ezkit_defconfig
  3. make menuconfig
Toolchain  --->
[*] Toolchain has IPv6 support?
[*] Toolchain has WCHAR support?
Package Selection for the target  --->
    Library  --->
        XML  --->
        [*] expat
    Hardware handling  --->
        [*] dbus
        XML library to use (Expat)  --->
    Networking applications  --->
        [*] bluez_utils

Hardware settings

On the BF537-STAMP for UART1 make sure sw5.1 and sw5.2 are set OFF

SW5

PF pin switch Pos
PF2 sw5.1 OFF
PF3 sw5.2 OFF
PF4 sw5.3 X
PF5 sw5.4 X

see also here:bf537-stamp

On the BF609-EZKIT for UART1, nothing need to be changed.

Attaching a UART based Bluetooth HCI

  • Start hcid daemon

Bluez Utility 2.x:

 
root:~> hcid -n &
114
root:~> hcid[114]: Bluetooth HCI daemon

Bluez Utility 4.x:

 
root:/> dbus-daemon --system --nofork &
[1] 205 dbus-daemon --system --nofork

root:/> bluetoothd -n &
[2] 207 bluetoothd -n
root:/> bluetoothd[207]: Bluetooth deamon 4.87
bluetoothd[207]: Starting SDP server
bluetoothd[207]: Parsing /etc/bluetooth/input.conf failed: No such file or directory
bluetoothd[207]: Parsing /etc/bluetooth/audio.conf failed: No such file or directory
bluetoothd[207]: Failed to open RFKILL control device
  • Initialize / attach Bluetooth HCI
hciattach - HCI UART driver initialization utility
Usage:
        hciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow]
        hciattach -l

Bluez Utility 2.x:

root:~> hciattach -n -s 115200 /dev/ttyBF1 any 115200 noflow &
hcid[114]: HCI dev 0 registered
hdev=0
hcid[114]: HCI dev 0 up
hcid[114]: Starting security manager 0
root:~> 

Bluez Utility 4.x:

root:/> Device setup complete
bluetoothd[207]: HCI dev 0 registered
bluetoothd[207]: Listening for HCI events on hcB0
luetooth: Out-of-order packet arrived, got 1 expected 0

root:/> 
root:/> bluetoothd[207]: HCI dev 0 up
bluetoothd[207]: Parsing /etc/bluetooth/serial.conf failed: No such file or directory
bluetoothd[207]: Could not get the contents of DMI chassis type
bluetoothd[207]: Adapter /org/bluez/207/hci0 has been enabled

Almost any Bluetooth chipset can be attached using type=any. Initial speed may vary form chipset to chipset. Most modules use 57600 baud a few others use 115200 baud.

During operation all should support 115200.

For higher baud rates see below:

CSR based Modules

Pretty common and well supported are CSR based chipsets

CSR using BCSP protocol:

root:~> hciattach -n /dev/ttyBF1 bcsp  &

CSR using H4 protocol:

root:~> hciattach -n /dev/ttyBF1 csr  &

Infineon based Modules

To attach a Infineon Singlestone PBA31307 or Unistone PBA31308 use following command.

root:~>hciattach -n /dev/ttyBF1 bfin-unistone &
129
root:~> Got response after reset... gobbling
Trying baud rate 115200...
Got response after reset... gobbling
Reading response: Success
Trying baud rate 921600...
Got response after reset... gobbling
Detected bluetooth module at 921600 baud
Got: status=0x00, hci_ver=0x03, hci_rev=0x62b9, lmp_ver=0x03, manuf=0x0009, lmp_subver=0x62b9
hcid[128]: HCI dev 0 registered
hdev=0
hcid[128]: HCI dev 0 up
hcid[128]: Starting security manager 0
root:~>

Other Chipsets

A complete list of supported chipsets:

root:~> hciattach -l
any       0x0000,0x0000
bfin-unistone 0x0000,0x0000
ericsson  0x0000,0x0000
digi      0x0000,0x0000
texas     0x0000,0x0000
bcsp      0x0000,0x0000
xircom    0x0105,0x080a
csr       0x0000,0x0000
bboxes    0x0160,0x0002
swave     0x0000,0x0000
st        0x0000,0x0000
picocard  0x025e,0x1000
inventel  0x0000,0x0000
comone    0xffff,0x0101
tdk       0x0105,0x4254
socket    0x0104,0x0096
3com      0x0101,0x0041
bt2000c   0x022d,0x2000
zoom      0x0279,0x950b
sitecom   0x0279,0x950b
billionton0x0279,0x950b
root:~>

Open and initialize the HCI device

root:~> hciconfig hci0 up
root:~> hciconfig
hci0:   Type: UART
        BD Address: 00:80:37:24:34:6A ACL MTU: 339:7 SCO MTU: 120:6
        UP RUNNING PSCAN ISCAN
        RX bytes:94 acl:0 sco:0 events:9 errors:0
        TX bytes:43 acl:0 sco:0 commands:9 errors:0

root:~>

Complete Table of Contents/Topics