Changes

How to setup Marvell bluetooth

3,884 bytes added, 15:26, 24 May 2010
Created page with '== How to setup Marvell bluetooth == === Overview of How-To === This How-To is meant to be a starting point for people to learn setup the bluetooth on IGEP v2 devices as quickly…'
== How to setup Marvell bluetooth ==

=== Overview of How-To ===
This How-To is meant to be a starting point for people to learn setup the bluetooth on IGEP v2 devices as quickly and easily as possible.

=== Feedback and Contributing ===
At any point, if you see a mistake you can contribute to this How-To.

=== Setup basics ===

The IGEP v2 has built-in a Class 2 Bluetooth 2.0 + EDR device.

{| border=1 class="simple"
!Class
!Maximum Permitted Power<br> [http://en.wikipedia.org/wiki/Milliwatt mW] ([http://en.wikipedia.org/wiki/DBm dBm])
!Range<br> (approximate)
|-
| Class 1
| 100 mW (20 dBm)
| ~100 meters
|-
| Class 2
| 2.5 mW (4 dBm)
| ~10 meters
|-
| Class 3
| 1 mW (0 dBm)
| ~1 meter
|}


By default the WIFI-BT module is not configured for single antenna, so you need to configure this, set registers settings as follows:
{| border=1 class="simple"
!'''Register offset'''
!'''Register Name'''
!'''8686 Bx'''
|-
| 0x8000_A58C
| BT Switch Control
| 0x40865
|-
| 0x8000_A5A0
| 3/4W BCA mode config
| 0xD24D
|-
| 0x8000_A5F0
| BCA WLAN modes
| 0xA027181C
|}

<pre>
# mount -t debugfs none /sys/kernel/debug

# cd /sys/kernel/debug/lbs_wireless/eth1/registers/

# echo "0xa58c 0x40865" > wrmac
# echo "0xa5a0 0xd24d" > wrmac
# echo "0xa5f0 0xa027181c" > wrmac
</pre>
Next, you will need to load some bluetooth modules
<pre>
# modprobe bluetooth
# modprobe hci_uart
# modprobe l2cap
# modprobe rfcomm
# dmesg
Bluetooth: Core ver 2.13
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP ver 2.11
Bluetooth: L2CAP socket layer initialized
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM ver 1.10
</pre>
With your preferred editor create a bluez.psr file like this
<pre>
// PSKEY Parameters for Bluetooth RF
// (1) 0x0031 (PSKEY_LC_ENHANCED_POWER_TABLE)
&0031 = 0900 0000 3f00 4700 ec00 0f00 0000 3f00 4a00 f000 1600 0000 3f00 4d00 f400 1e00 0000 \
3f00 5000 f800 2600 0000 3f00 5500 fc00 2e00 0000 3f00 5b00 0000 3800 0000 3f00 6900 0400
// (2) 0x01f6 (PSKEY_ANA_FTRIM)
&01f6 = 001d
// (3) 0x01fe (PSKEY_ANA_FREQ)
&01fe = 6590 // 26MHz reference clock
// (4) 0x01be (PSKEY_UART_BAUDRATE)
&01be = 0x1d8 // 115200
// (5) 0x0028 (PSKEY_LC_COMBO_DISABLE_PIO_MASK)
&0028 = 0200 0000 0000
// (6) 0x002a (PSKEY_LC_COMBO_DOT11_CHANNEL_PIO_BASE)
&002a = 0011
</pre>
And send the file using the bccmd tool.
<pre>
# bccmd -t bcsp -d /dev/ttyS1 psload -r bluez.psr

Loading PSKEY_LC_ENHANCED_POWER_TABLE ... done
Loading PSKEY_ANA_FTRIM ... done
Loading PSKEY_ANA_FREQ ... done
Loading PSKEY_UART_BAUDRATE...done
Loading PSKEY_LC_COMBO_DISABLE_PIO_MASK ... done
Loading PSKEY_LC_COMBO_DOT11_CHANNEL_PIO_BASE ... done
</pre>

Finally you can attach to device an scan for other bluetooth devices.

<pre>
# hciattach -s 115200 /dev/ttyS1 bcsp 115200 noflow
# hciconfig hci0 up
# hciconfig hci0 piscan
# hciconfig -a hci0
hci0: Type: UART
BD Address: 00:02:5B:00:A5:A5 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:1376 acl:0 sco:0 events:25 errors:0
TX bytes:740 acl:0 sco:0 commands:24 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'igep0020b (0)'
Class: 0x120112
Service Classes: Networking, Object Transfer
Device Class: Computer, Handheld
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)
# hcitool -i hci0 scan
Scanning ...
00:1E:A4:FC:EC:2E Phone
</pre>

For best performance you need to disable WIFI, you can do this
<pre>
# echo 0 > /sys/class/gpio/gpio94/value
</pre>

--- That's all folks ---
0
edits