Changes

How to setup Marvell bluetooth

3,067 bytes added, 18:40, 1 October 2015
m
no edit summary
=== Overview of How-To ===
This How-To is meant to be a starting point for people to learn how to setup the bluetooth on IGEP v2 Technology 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 === Bluetooth Classes (information) === Some IGEP v2 Technology boards has built-in a Class 2 Bluetooth 2.0 + EDR device.
{| border=1 class="simple"
|}
=== Setup bluetooth internal parameters ===
By default the WIFI-BT module is not configured for single antenna, so you need to configure this, set registers settings as follows:
You need to be root to do this - sudo won't do!
<pre>
# mount -t debugfs none /sys/kernel/debug
# cd echo "0xa58c 0x40865" > /sys/kernel/debug/lbs_wireless/eth1wlan0/registers/ wrmac echo "0xa5a0 0xd24d" > /sys/kernel/debug/lbs_wireless/wlan0/registers/wrmac echo "0xa5f0 0xa027181c" > /sys/kernel/debug/lbs_wireless/wlan0/registers/wrmac</pre>
# echo "0xa58c 0x40865" > wrmac === Validate serial comunication to CSR bluetooth xip ===Configure ttyO1  # echo "0xa5a0 0xd24d" <pre> wrmac # echo "0xa5f0 0xa027181c" > wrmacstty -F /dev/ttyO1 ispeed 115200 ospeed 115200 cs8 -cstopb clocal -crtscts -parodd
</pre>
Next, you will need to load some bluetooth modulesTo read CSR chip version
<pre>
# modprobe bluetoothbccmd -t bcsp -d /dev/ttyO1 chiprev# modprobe hci_uart# modprobe l2cap# modprobe rfcomm# dmesgBluetoothChip revision: Core ver 2.13NET: Registered protocol family 31Bluetooth: HCI device and connection manager initializedBluetooth: HCI socket layer initializedBluetooth: L2CAP ver 2.11Bluetooth: L2CAP socket layer initializedBluetooth: BNEP 0x0030 (Ethernet EmulationBC4-ROM) ver 1.3Bluetooth: BNEP filters: protocol multicastBluetooth: RFCOMM socket layer initializedBluetooth: RFCOMM TTY layer initializedBluetooth: RFCOMM ver 1.10
</pre>
  === Load PSKEY parameters ===With your preferred editor create a 'bluez.psr ' file like this:
<pre>
// PSKEY Parameters for Bluetooth RF
And send the file using the bccmd tool.
<pre>
# bccmd -t bcsp -d /dev/ttyS1 ttyO1 psload -r bluez.psr
Loading PSKEY_LC_ENHANCED_POWER_TABLE ... done
</pre>
----
 
== Setup HCI device ==
 
=== Load Linux kernel modules ===
 
Next, you will need to load some bluetooth modules. Prompt:
<pre>
modprobe bluetooth
modprobe hci_uart
modprobe hidp
modprobe l2cap
modprobe rfcomm
</pre>
 
You shoud get these logs ( using [[IGEP_firmware_Yocto|IGEP Firmware Yocto 1.2.2-3]] ):
<pre>
root@igep00x0:~# modprobe bluetooth
[ 1183.967773] Bluetooth: Core ver 2.15
[ 1183.971588] NET: Registered protocol family 31
[ 1183.976226] Bluetooth: HCI device and connection manager initialized
[ 1183.982849] Bluetooth: HCI socket layer initialized
root@igep00x0:~# modprobe hci_uart
[ 1184.013031] Bluetooth: HCI UART driver ver 2.2
[ 1184.017669] Bluetooth: HCI H4 protocol initialized
[ 1184.022674] Bluetooth: HCI BCSP protocol initialized
[ 1184.027832] Bluetooth: HCILL protocol initialized
root@igep00x0:~# modprobe hidp
[ 1184.067993] Bluetooth: L2CAP ver 2.15
[ 1184.071807] Bluetooth: L2CAP socket layer initialized
[ 1184.087188] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
root@igep00x0:~# modprobe l2cap
root@igep00x0:~# modprobe rfcomm
[ 1184.147399] Bluetooth: RFCOMM TTY layer initialized
[ 1184.152526] Bluetooth: RFCOMM socket layer initialized
[ 1184.157867] Bluetooth: RFCOMM ver 1.11
</pre>
 
=== Create HCI device ===
Finally you can attach to device an scan for other bluetooth devices.
<pre>
# hciattach -s 115200 /dev/ttyS1 ttyO1 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
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)
# </pre> === Scan for HCI bluetooth peer devices ===<pre>hcitool -i hci0 scan
Scanning ...
00:1E:A4:FC:EC:2E Phone
</pre>
=== Ping bluetooth peer device ===<pre>root@igep00x0:/etc/bluetooth# l2ping -c 4 00:1E:A4:FC:EC:2EPing: 00:1E:A4:FC:EC:2E from 00:02:5B:00:A5:A5 (data size 44) ...44 bytes from 00:1E:A4:FC:EC:2E id 0 time 38.79ms44 bytes from 00:1E:A4:FC:EC:2E id 1 time 38.60ms44 bytes from 00:1E:A4:FC:EC:2E id 2 time 38.66ms44 bytes from 00:1E:A4:FC:EC:2E id 3 time 538.79ms4 sent, 4 received, 0% loss</pre> == Others == === Switch-off wifi to get better bluetooth performance ===For best performance you need to disable WIFI, you can do this:<br><br>Disable wlan0 interface<pre>ifconfig wlan0 down</pre> Switch-off "power down" line of wifi* For IGEPv2 RevC ('''IGEP0020-RC''') and IGEP COM MODULE ('''IGEP0030-RE''') series
<pre>
# echo 0 > /sys/class/gpio/gpio94gpio138/value
</pre>
* For older IGEPv2 RevB ('''IGEP0020-RB''') series
<pre>
echo 0 > /sys/class/gpio/gpio94/value
</pre>
To read CSR chip version=== Ensure uart2 gpio/mux configuration ===In IGEPv2 you should configure uart2_XXX pins like:
<pre>
root@igep0020igep00x0:~# bccmd mount -t bcsp -d debugfs none /sys/kernel/debug root@igep00x0:~# cat /sys/kernel/debug/omap_mux/uart2_*name: uart2_cts.uart2_cts (0x48002174/0x144 = 0x0118), b ab26, t NAmode: OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0signals: uart2_cts | mcbsp3_dx | gpt9_pwm_evt | NA | gpio_144 | NA | NA | safe_mode name: uart2_rts.uart2_rts (0x48002176/dev0x146 = 0x0000), b ab25, t NAmode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE0signals: uart2_rts | mcbsp3_dr | gpt10_pwm_evt | NA | gpio_145 | NA | NA | safe_mode name: uart2_rx.uart2_rx (0x4800217a/ttyS1 chiprev0x14a = 0x0100), b ad25, t NAmode: OMAP_PIN_INPUT | OMAP_MUX_MODE0Chip revisionsignals: 0x0030 uart2_rx | mcbsp3_fsx | gpt8_pwm_evt | NA | gpio_147 | NA | NA | safe_mode name: uart2_tx.uart2_tx (BC4-ROM0x48002178/0x148 = 0x0000), b aa25, t NAmode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE0signals: uart2_tx | mcbsp3_clkx | gpt11_pwm_evt | NA | gpio_146 | NA | NA | safe_mode
</pre>
== External References ==[http://www.bluez.org/ BlueZ (Official Linux Bluetooth protocol stack)]<br>[http://web.inter.nl.net/users/hanscees/bluezhowto.html#up BlueZ user howto --- That's all folks ---6.0 Get your bluetooth device up!]<br>
= See also =
*[[How to setup Marvell 88w8686 SDIO wifi]]
[[Category:How to forge|Bluetooth]]
4,199
edits