wiki:expansion/sterling-lwb

Laird Sterling-LWB 2.4GHz Wifi / Bluetooth module (450-0148)

The Laird Connectivity Sterling-LWB 450-0148 is a IEEE 802.11 b/g/n WiFi radio with BT 2.1+EDR and BLE 4.2 connectivity module with a single external U.FL antenna port.

Module Details

The Sterling-LWB 450-0148 module:

  • BCM43430 - for SDIO based WiFi
  • 1x U.FL antenna shared between WiFi and Bluetooth
  • WL_REG_ON pin must be driven high to enable WiFi functionality
  • BT_REG_ON pin must be driven high to enable Bluetooth functionality
  • UART bus provides Bluetooth
  • SDIO bus provides WiFi

References:

Module Certifications

The module itself has some certifications, but often an 'entire' solution must be certified which includes the antenna, power supply, etc

Board Specific Details

  • GW5910
    • WL_REG_ON - PAD_GPIO_5GPIO1_IO05 - driven high by reg_wl in Kernel to enable WiFi functionality
    • BT_REG_ON - PAD_GPIO_2GPIO1_IO02 - driven high by reg_bt in Kernel to enable Bluetooth functionality
    • UART4 (/dev/ttymxc3) is the Bluetooth UART
    • 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)

Firmware

Firmware is needed for device functionality and it is loaded by the drivers. Several files are needed and depend on your regulatory domain:

apt install unzip
wget http://dev.gateworks.com/images/firmware/sterling-lwb/480-0079.zip
unzip 480-0079.zip
unzip 480-0079-6.0.0.121.zip
tar xvf 480-0079.tar.bz2
mkdir -p /lib/firmware/brcm
cp -ra lib/firmware/brcm/* /lib/firmware/brcm
  • 480-0079.zip - FCC firmware:
  • 480-0080.zip - ETSI firmware
  • 480-0116.zip - Giteki firmware

Drivers

WiFi

Mainline kernel

The SDIO WiFi functionality is supported by the mainline brcmfmac (Full MAC) driveri n Linux 4.1+

kernel drivers:

  • CONFIG_CFG80211 / CONFIG_WLAN / CONFIG_NETDEVICES / CONFIG_WLAN_VENDOR_BROADCOM
  • CONFIG_BRCMUTIL (brcmutil.ko) (selected when you enable BRCMFMAC)
  • CONFIG_BRCMFMAC (brcmfmac.ko)
  • CONFIG_BRCMFMAC_SDIO=y (static; selects BRCMFMAC_PROTO_BCDC and FW_LOADER)

On the Gateworks 4.20 kernel these are all enabled and you see the following:

root@bionic-armhf:~# dmesg | grep mmc0
[    9.146576] mmc0: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
[    9.184003] mmc0: queuing unknown CIS tuple 0x80 (2 bytes)
[    9.191715] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
[    9.199259] mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
[    9.216072] mmc0: queuing unknown CIS tuple 0x80 (7 bytes)
[    9.345290] mmc0: new high speed SDIO card at address 0001

root@bionic-armhf:~# dmesg | grep brcm
root@bionic-armhf:~# dmesg | grep brcm 
[   16.537056] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   16.546999] usbcore: registered new interface driver brcmfmac
[   16.717595] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   16.742359] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Sep 11 2018 09:22:09 version 7.45.98.65 (r707797 CY) FWID 01-b54727f

LSR out-of-tree Linux backports driver

LSR has driver downloads in the form of linux backports as well as firmware binaries on the Product Page

They have a linux backports driver with source tarballs on their site. I'm not clear what kernels it supports but it appears that 930-0075.zip which I used here supports up to 4.14.

It appears they have a github account with more up-to-date driver backport releases:

Building out-of-tree LAIRD Linux backports WiFi drivers (930-0075.zip):

wget http://dev.gateworks.com/images/firmware/sterling-lwb/930-0075.zip
unzip 930-0075.zip 
tar xvf backports-laird-6.0.0.121.tar.bz2
cd laird-backport-6.0.0.121/
export CROSS_COMPILE=<prefix of cross toolchain in path>
export KLIB_BUILD=<directory of kernel build>
export ARCH="arm"
#make defconfig-lwb-etsi # config for ETSI
#make defconfig-lwb-jp # config for Giteki
make defconfig-lwb-fcc # conifg for FCC
make
  • results in brcmfmac.ko brcmutil.ko cfg80211.ko
  • these likely only work when used with a kernel that has support for brcmfmac disabled

Bluetooth

You will need the brcm_patchram_plus utility to load a firmware at runtime.

Building:

  • Ubuntu (on target):
    wget https://github.com/LairdCP/brcm_patchram/archive/brcm_patchram_plus_1.1.tar.gz
    tar xvf brcm_patchram_plus_1.1.tar.gz
    cd brcm_patchram-brcm_patchram_plus_1.1
    apt install build-essential libbluetooth-dev
    # add '#include <unistd.h>' and '#include <sys/uio.h>' to the top of the two c files
    make
    cp brcm_patchram_plus brcm_patchram_plus_usb /usr/local/bin
    cd ..
    
  • OpenWrt (cross-compile on host):
    # setup OpenWrt toolchain env
    TOOLCHAIN_DIR=/opt/openwrt/16.02-imx6
    TOOLCHAIN=toolchain-arm_cortex-a9+neon_gcc-5.2.0_musl-1.1.12_eabi
    PATH=$PATH:$TOOLCHAIN_DIR/$TOOLCHAIN/bin
    export STAGING_DIR=$TOOLCHAIN_DIR
    arm-openwrt-linux-gcc -I$TOOLCHAIN_DIR/$TOOLCHAIN/ brcm_patchram_plus.c -o brcm_patchram_plus
    

Bringing up Bluetooth:

# load firmware
brcm_patchram_plus -d \
 --patchram lib/firmware/brcm/4343w.hcd \
 --enable_hci --no2bytes --tosleep 1000 /dev/ttymxc3 &
# hci should now be there
hciconfig
# bring up interface
hciconfig hci0 up
# scan
hcitool scan
# ping
l2ping -c 3 <btmac from ping>

OS Support

The following notes pertain to support in various OS BSPs (Note that in all cases firmware and drivers are needed as noted above):

  • Ubuntu with Gateworks 4.20 kernel (should also work in mainline kernel):
    • BT HCI: works
    • WiFi: client mode works, AP untested
  • OpenWrt master (Linux 4.19)
    • BT HCI: works
    • WiFi: works
  • OpenWrt 16.02 (Linux 4.4)
    • BT HCI: works (need provide cross-compiled brcm_patchram_plus)
    • WiFi: does not work - brcmfmac from this kernel will crash
Last modified 3 weeks ago Last modified on 03/11/2020 04:11:19 PM