world leader in high performance signal processing
Trace: » bluetooth_ez-extender

Bluetooth EZ-Extender

DESCRIPTION

 ADZS-BFBLUET-EZEXT v1.0 Click to enlarge

The ADZS-BFBLUET-EZEXT card is equipped with a WT12 module from Bluegiga Technologies http://www.bluegiga.com.

The Card connects to Blackfin STAMP and EZKit boards featuring the 10 Pin 100mil UART Connector as well as to the ADSP-BF526 and ADSP-BF518 EZ-BOARD.

WT12 is a class 2, Bluetooth® 2.0+EDR (Enhanced Data Rates) Module, featuring CSRs BlueCore4 single chip Bluetooth solution. The WT12 is a highly integrated Bluetooth® module, containing all the necessary elements from Bluetooth® radio to antenna and a fully implemented protocol stack. Therefore WT12 provides an solution for developers who want to integrate Bluetooth® wireless technology into their design with limited knowledge of Bluetooth® and RF technologies.

By default WT12 module on the ADZS-BFBLUET-EZEXT is equipped with powerful and easy-to-use iWRAP firmware. iWRAP enables users to access Bluetooth® functionality with simple ASCII commands delivered to the module over serial interface - it's just like a Bluetooth® modem.

Linux users may bypass the iWRAP firmware and connect to the UART HCI interface directly.(BCSP and H4 protocols are supported) This way Linux Bluetooth Protocol Stacks, Libraries and Utilities such as bluez-libs and bluez-utils can be used.

Linux Kernel Configuration

The Bluegiga WT12 Bluetooth Module

The Bluegiga WT12 Bluetooth module on the BFBLUET-EZEXT has two firmware options iWRAP and HCI. iWRAP is a AT-command based “high-level” firmware and it implements the Bluetooth stack and profiles. HCI firmware on the other hand gives you access to standard Bluetooth HCI interface. The firmware is “unified” so both options are available in the same firmware image.

Typical Linux+BlueZ user are probably interested in HCI BCSP mode. From the iWRAP firmware you can switch “on the fly” to HCI BCSP mode by giving an AT command “BOOT 1”. This causes the module to boot in HCI-BCSP mode.

For Linux users it's NOT necessary and NOT recommended changing the iWARP firmware baud rate.
In case someone still wants to do that, it’s recommendable to set an GPIO binding allowing to revert/reset the baudrate.

With SET CONTROL BIND, it is possible to bind iWRAP commands to GPIO pins:

Following command binds JP5 (PIO4) to “SET CONTROL BAUD 115200,8n1”

SET CONTROL BIND 0 10 RISE SET CONTROL BAUD 115200,8n1

UART BCSP HCI Mode

  • In buildroot with Bluz Utility 4.x

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

root:/> bluetoothd
[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

root:/> iwrap_boot -b /dev/ttyBF1
root:/> hciattach -n /dev/ttyBF1 bcsp &
[3] 210 hciattach -n /dev/ttyBF1 bcsp
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:/> 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


root:/> hciconfig
hci0:   Type: BR/EDR  Bus: UART
        BD Address: 00:07:80:89:8F:0E  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING PSCAN 
        RX bytes:1363 acl:0 sco:0 events:33 errors:0
        TX bytes:1154 acl:0 sco:0 commands:32 errors:0

root:/> hcitool scan
Scanning ...
        00:15:83:44:C2:E7       linux58-mmc-usblan-btuart
        50:63:13:89:77:B0       Dell Wireless 365 Bluetooth Module
        78:DD:08:AF:F4:AF       JJIANG-L01
        00:24:2B:FD:F2:00       Dell Wireless 365 Bluetooth Module
        68:A3:C4:4A:C4:E8       RFENG2-L01
        60:D8:19:AB:60:66       ELIU-L02
root:/> 
root:/> agent 0000 &

  • In uClinux with Bluz Utility 2.x

root:/> hcid -n &
hcid[203]: Bluetooth HCI daemon
203
root:/> iwrap_boot -b /dev/ttyBF1
root:/> hciattach -n /dev/ttyBF1 bcsp &
205
root:/> hcid[203]: HCI dev 0 registered
hcid[203]: HCI dev 0 up
hcid[203]: Starting security manager 0

root:/>
root:/> hciconfig
hci0:   Type: UART
        BD Address: 00:07:80:87:D4:D6 ACL MTU: 310:10 SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:679 acl:0 sco:0 events:17 errors:0
        TX bytes:598 acl:0 sco:0 commands:17 errors:0

  • Instead of using the iwrap_boot utility - you can also setup the tty and cat 'boot 1' into the serial tty device

root:/> stty -F /dev/ttyBF1 ispeed 115200 ospeed 115200 cs8 -cstopb clocal -crtscts -parodd
root:/> echo ”boot 1” > /dev/ttyBF1

Using UART HCI with custom baud rates

In the uClinux-dist user config enable besides the Bluez-utils also bccmd and the BFBLUET-EZEXT Boot Mode Utility

--- Blackfin app programs ---
[*] Bluez-utils
[*]   Bluez bccmd util
[*] BFBLUET-EZEXT Boot Mode Utility
Baudrate Decimal Hex
1200 5 0x5
2400 10 0xA
4800 20 0x14
9600 39 0x27
19200 79 0x4F
38400 157 0x9D
57600 236 0xEC
115200 472 0x1D8
230400 944 0x3B0
460800 1887 0x75F
921600 3775 0xEBF
1382400 5662 0x161E
1843200 7550 0x1d7E
2765800 11325 0x2C3D

It's calculated by the following formula:

divisor = (baudrate * 64 + 7812) / 15625

Example: Change UART HCI BAUD to 921600 baud

In your rootfs create or add pskey file:

root:/> cat /etc/file.psr
#PSKEY_UART_BAUDRATE
&01be = 0ebf

root:/> export BCSP_USE_B115200

root:/> bccmd -t BCSP -d /dev/ttyBF1 psload -r file.psr
Loading PSKEY_UART_BAUDRATE ... done

root:/> iwrap_boot -?
Usage: iwrap_boot [-?vbhu] serial-device
        -b             Serial BCSP HCI
        -h             Serial H4 HCI
        -u             USB HCI
        -h?            this help
        -v             print version info

root:/> iwrap_boot -b /dev/ttyBF1

root:/> hcid -n &
hcid[392]: Bluetooth HCI daemon
392

root:/> hciattach -n -s 921600 /dev/ttyBF1 bcsp 921600 noflow &
393
root:/> hcid[392]: HCI dev 0 registered
hdev=0b
hcid[392]: HCI dev 0 up
hcid[392]: Starting security manager 0

root:/> hciconfig
hci0:   Type: UART
        BD Address: 00:07:80:87:CD:E2 ACL MTU: 310:10 SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:722 acl:0 sco:0 events:19 errors:0
        TX bytes:620 acl:0 sco:0 commands:18 errors:0

root:/> hcitool scan
Scanning ...
        00:1E:DC:93:87:B9       W890i

ADSP-BF526 EZ-BOARD Hardware Configuration Example

Connect the BFBLUET-EZEXTonto P2

Disconnect SW-7: 3,4

  • SW7: X, X, OFF, OFF

ADSP-BF537 STAMP-BOARD Hardware Configuration Example

Connect the BFBLUET-EZEXT onto UART1 P12 Header

On the ADSP-BF537 STAMP-BOARD:

Disconnect SW-5: 1,2

  • SW5: OFF, OFF, X, X