Contents |
Connection
| QSK Name | QSK Pin | GPIO | Bluetooth Name | Bluetooth Pin |
|---|---|---|---|---|
| GND | 17 | N/A | DGND | 12 |
| 3V3 | 18 | N/A | BT_3V3 | 8 |
| TXD0 | 19 | PB4 | BT_TXD | 3 |
| RXD0 | 21 | PB5 | BT_RXD | 1 |
| RTS0 | 23 | PB26 | BT_RTS | 7 |
| CTS0 | 25 | PB27 | BT_CTS | 5 |
Configuration
echo set > /proc/gpio/GPIOB21 echo clear > /proc/gpio/GPIOB26 echo in > /proc/gpio/GPIOB27 hciattach /dev/ttyS1 csr 115200 noflow
If, as in our example, the Bluetooth module does not come up with a valid MAC address, just take it down and up again:
hciconfig hci0 down hciconfig hci0 up
This appears to be a bug in the Linux HCI system: http://linuxgazette.net/109/oregan3.html
Example
root@snapper:~$ echo set > /proc/gpio/GPIOB21
root@snapper:~$ echo clear > /proc/gpio/GPIOB26
root@snapper:~$ echo in > /proc/gpio/GPIOB27
root@snapper:~$ hciattach /dev/ttyS1 csr 115200 noflow
CSR build ID 0x07-0x7B
root@snapper:~$ hciconfig
hci0: Type: UART
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:0 acl:0 sco:0 commands:0 errors:0
root@snapper:~$ hciconfig hci0 down
root@snapper:~$ hciconfig hci0 up
root@snapper:~$ hciconfig
hci0: Type: UART
BD Address: 00:A0:96:13:BB:C1 ACL MTU: 384:8 SCO MTU: 64:8
UP RUNNING
RX bytes:87 acl:0 sco:0 events:8 errors:0
TX bytes:38 acl:0 sco:0 commands:8 errors:0
root@snapper:~$ hcitool scan
Scanning ...
00:10:C6:8A:1A:5D Nicko's Laptop
00:12:37:79:96:DE i-mate SP5
00:16:41:62:10:BA NC8430
File transfers
Bluetooth supports a protocol called OBEX for transferring files over Bluetooth. To use this, you need to have the following packages installed on the Snapper:
- bluez-utils
- bluez-utils-compat
- obexftp
Once these packages are installed, start up the hci session:
root@snapper:~$ hciattach /dev/ttyS2 csr 115200 noflow CSR build ID 0x07-0x7B root@snapper:~$ hciconfig hci0 down root@snapper:~$ hciconfig hci0 up
Make a note of the HCI MAC address
root@snapper:~$ hciconfig hci0
hci0: Type: UART
BD Address: 00:A0:96:13:BB:DA ACL MTU: 384:8 SCO MTU: 64:8
UP RUNNING
RX bytes:87 acl:0 sco:0 events:8 errors:0
TX bytes:38 acl:0 sco:0 commands:8 errors:0
Start up the D-Bus IPC service:
root@snapper:~$ /etc/init.d/dbus-1 start
Start up the HCI daemon:
root@snapper:~$ /etc/init.d/bluetooth start
Run the obexftp daemon in bluetooth mode
root@snapper:~$ obexftpd -b
This is quite verbose, it is useful to redirect it, and background it. ie:
root@snapper:~$ obexftpd -b >/dev/null 2>&1 &
On the host PC, download a file, use the MAC address from above
andre@tutira:~$ obexftp -b 00:A0:96:13:BB:DA -g /test.ppm
OBEX is a supported protocol by many different filemanagers - for instance it is possible to browse to the Snapper device from the Ubuntu file manager by putting the following URL into the location bar:
obex://[00:A0:96:13:BB:DA]/



