Changes between Version 5 and Version 6 of expansion/on-board-wireless


Ignore:
Timestamp:
05/12/2020 10:30:20 PM (5 years ago)
Author:
Tim Harvey
Comment:

updated bluetooth hci configuration and kernel support

Legend:

Unmodified
Added
Removed
Modified
  • expansion/on-board-wireless

    v5 v6  
    2828== Board Specific Details
    2929 * GW5910
    30   * WL_REG_ON - PAD_GPIO_5__GPIO1_IO05 - driven high by reg_wl in Kernel to enable !WiFi functionality
    31   * BT_REG_ON - PAD_GPIO_2__GPIO1_IO02 - driven high by reg_bt in Kernel to enable Bluetooth functionality
     30  * WL_REG_ON - PAD_GPIO_5__GPIO1_IO05 - must be driven high to enable !WiFi functionality (handled by kernel)
     31  * BT_REG_ON - PAD_GPIO_2__GPIO1_IO02 - must be driven high to enable Bluetooth functionality (handled by kernel)
    3232  * UART4 (/dev/ttymxc3) is the Bluetooth UART
    3333  * SDHC2 (/dev/mmcblk0) is the SDIO !WiFi bus (Note that the microSD is on SDHC3 thus appears to the kernel as /dev/mmcblk1 - this must be taken into account if mounting the root filesystem from microSD)
     
    8787[=#bluetooth]
    8888=== Bluetooth
    89 You will need the {{{brcm_patchram_plus}}} utility to load a firmware at runtime.
     89Bluetooth functionality is provided by a UART based Bluetooth HCI (Host Controller Interface).
    9090
    91 Building:
    92  * Ubuntu (on target):
     91kernel drivers:
     92 * CONFIG_BT (bluetooth support; bt.ko if module)
     93 * CONFIG_BT_HCIUART (UART based HCI support; hci_uart.ko if module)
     94 * CONFIG_BT_HCIUART_BCM (Broadcom protocol support)
     95
     96If using a Linux 5.0+ kernel the HCI should be brought up {{{/sys/class/bluetooth/hci0}}} and configured via device-tree bindings if there is a node with a compatible string of 'brcm,bcm4330-bt'. If such bindings exist the kernel will attempt to load firmware patches from {{{/lib/firmware/brcm/BCM43430A1.hcd}}}. This looks like the following in kernel log:
     97{{{#!bash
     98[    8.123246] Bluetooth: Core ver 2.22
     99[    8.123338] Bluetooth: HCI device and connection manager initialized
     100[    8.123357] Bluetooth: HCI socket layer initialized
     101[    8.123373] Bluetooth: L2CAP socket layer initialized
     102[    8.123388] Bluetooth: SCO socket layer initialized
     103[    8.191235] Bluetooth: HCI UART driver ver 2.3
     104[    8.194993] Bluetooth: HCI UART protocol Broadcom registered
     105[    8.550960] Bluetooth: hci0: BCM: chip id 94
     106[    8.554052] Bluetooth: hci0: BCM: features 0x2e
     107[    8.577738] Bluetooth: hci0: BCM43430A1
     108[    8.577755] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000
     109[    8.577899] Bluetooth: hci0: BCM: btbcm_patchram
     110[   12.044095] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0182
     111}}}
     112
     113If you see messages regarding 'brcm/BCM43430A1.hcd' not found this means that the patchram firmware could not be located on your filesystem. Note that hci_uart should be compiled as a kernel module if you need to load this firmware:
     114{{{#!bash
     115[    8.577899] bluetooth hci0: Direct firmware load for brcm/BCM43430A1.hcd failed with error -2
     116[    8.577910] Bluetooth: hci0: BCM: Patch brcm/BCM43430A1.hcd not found
     117}}}
     118
     119It is not entirely clear what the benefits are of the BCM43430A1.hcd firmware over the firmware already inside the part. If the firmware is not found, the HCI interface is still registered with the kernel and appears to work.
     120
     121If you have an older kernel or are missing the 'brcm,bcm4330-bt' device-tree binding you can use the {{{brcm_patchram_plus}}} utility to load a firmware via Linux userspace and register the HCI device with the kernel:
     122 * Building:
     123  - Ubuntu (on target):
    93124{{{#!bash
    94125wget https://github.com/LairdCP/brcm_patchram/archive/brcm_patchram_plus_1.1.tar.gz
     
    98129# add '#include <unistd.h>' and '#include <sys/uio.h>' to the top of the two c files
    99130make
    100 cp brcm_patchram_plus brcm_patchram_plus_usb /usr/local/bin
     131cp brcm_patchram_plus /usr/local/bin
    101132cd ..
    102133}}}
    103  * !OpenWrt (cross-compile on host):
     134  - !OpenWrt (cross-compile on host):
    104135{{{#!bash
    105136# setup OpenWrt toolchain env
     
    110141arm-openwrt-linux-gcc -I$TOOLCHAIN_DIR/$TOOLCHAIN/ brcm_patchram_plus.c -o brcm_patchram_plus
    111142}}}
    112 
    113 
    114 Bringing up Bluetooth:
     143 * Bringing up Bluetooth:
    115144{{{#!bash
    116 # load firmware
     145# load firmware and enable the hci over /dev/ttymxc3
    117146brcm_patchram_plus -d \
    118147 --patchram lib/firmware/brcm/4343w.hcd \