244 | | |
245 | | [=#sterling-lwb] |
246 | | = Laird Sterling-LWB 2.4GHz Wifi / Bluetooth module (450-0148) |
247 | | The Laird Connectivity Sterling-LWB 450-0148 is a Wifi4 (IEEE 802.11n) !WiFi radio with BT 2.1+EDR and BLE 4.2 connectivity module with a single external U.FL antenna port. |
248 | | |
249 | | == Module Details |
250 | | The Sterling-LWB 450-0148 module: |
251 | | * BCM43430 chip |
252 | | * 1x U.FL antenna shared between !WiFi and Bluetooth |
253 | | * WL_REG_ON pin must be driven high to enable !WiFi functionality |
254 | | * BT_REG_ON pin must be driven high to enable Bluetooth functionality |
255 | | * UART bus provides Bluetooth |
256 | | * SDIO bus provides !WiFi |
257 | | |
258 | | References: |
259 | | * [http://dev.gateworks.com/datasheets/sterling-lwb.pdf Datasheet] |
260 | | * https://www.lairdconnect.com/wireless-modules/wifi-modules-bluetooth/sterling-lwb |
261 | | |
262 | | == Module Certifications |
263 | | |
264 | | The module itself has some certifications, but often an 'entire' solution must be certified which includes the antenna, power supply, etc |
265 | | * [https://www.lairdconnect.com/wireless-modules/wifi-modules-bluetooth/sterling-lwb-24-ghz-wifi-module Sterling page] |
266 | | * [https://connectivity-staging.s3.us-east-2.amazonaws.com/2019-03/LWBCert.pdf Certification Guide] |
267 | | * [https://www.lairdconnect.com/wireless-modules/wifi-modules-bluetooth/sterling-lwb-24-ghz-wifi-module#certified-antennas Certified Antennas] |
268 | | |
269 | | |
270 | | == Board Specific Details |
271 | | |
272 | | The Sterling-LWB is installed on the following Gateworks boards: |
273 | | * GW7300-A/B/C (replaced with the Sterling LWB on revD+) |
274 | | * WL_REG_ON - GPIO1_IO05_GPIO1_IO5 - must be driven high to enable !WiFi functionality (handled by kernel) |
275 | | * BT_REG_ON - GPIO1_IO03_GPIO1_IO3 - must be driven high to enable Bluetooth functionality (handled by kernel) |
276 | | * UART3 (/dev/ttymxc2) is the Bluetooth UART |
277 | | * SDHC1 (/dev/mmc0) is the SDIO !WiFi bus |
278 | | * GW5910 |
279 | | * WL_REG_ON - PAD_GPIO_5__GPIO1_IO05 - must be driven high to enable !WiFi functionality (handled by kernel) |
280 | | * BT_REG_ON - PAD_GPIO_2__GPIO1_IO02 - must be driven high to enable Bluetooth functionality (handled by kernel) |
281 | | * UART4 (/dev/ttymxc3) is the Bluetooth UART |
282 | | * 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) |
283 | | |
284 | | == OS Support |
285 | | The following notes pertain to support in various OS BSPs (Note that in all cases firmware and drivers are needed as noted above): |
286 | | * Ubuntu with Gateworks kernel (should also work in mainline kernel): |
287 | | - Bluetooth HCI fully supported |
288 | | - !WiFi client and AP fully supported |
289 | | * Gateworks !OpenWrt 20.06 (Linux 5.4.45) |
290 | | - Bluetooth HCI fully supported |
291 | | - !WiFi client and AP fully supported |
292 | | * Gateworks !OpenWrt 16.02 (Linux 4.4) |
293 | | - Bluetooth HCI fully supported (need provide cross-compiled brcm_patchram_plus) |
294 | | - !WiFi: **does not work - brcmfmac from this kernel will crash** |
295 | | |
296 | | |
297 | | == Firmware |
298 | | Firmware is needed for !WiFi device functionality and it is loaded by the drivers. While firmware is not needed for Bluetooth functionality providing it will provide fixes and additional functionality over what is already programmed into the device. |
299 | | |
300 | | Note that there are different firmware releases depending on your regulatory domain and these are available from LAIRD at https://www.lairdconnect.com/wireless-modules/wi-fi-bt-modules/sterling-lwb |
301 | | |
302 | | Example Firmware Installation: |
303 | | {{{#!bash |
304 | | tar xvf firmware-7.0.0.326.tar.bz2 |
305 | | mkdir -p /lib/firmware/brcm |
306 | | cp -ra lib/firmware/brcm/* /lib/firmware/brcm |
307 | | }}} |
308 | | - 480-0079.zip - FCC firmware: |
309 | | - 480-0080.zip - ETSI firmware |
310 | | - 480-0116.zip - Giteki firmware |
311 | | |
312 | | **Note:** The script used in debootstrap for creating our Ubuntu prebuilt images installs the linux-firmware package before this driver is downloaded and extracted. When "apt-get update" is ran it will overwrite the 3rd party driver causing an error when the Laird modules are loaded. Reference [https://github.com/Gateworks/ubuntu-rootfs/blob/master/ubuntu-rootfs.sh this link]. |
313 | | |
314 | | == Drivers |
315 | | |
316 | | === !WiFi |
317 | | The SDIO !WiFi functionality is supported by the mainline {{{brcmfmac}}} (Full MAC) driver present in Linux 4.1+ |
318 | | |
319 | | kernel drivers: |
320 | | - CONFIG_CFG80211 / CONFIG_WLAN / CONFIG_NETDEVICES / CONFIG_WLAN_VENDOR_BROADCOM |
321 | | - CONFIG_BRCMUTIL (brcmutil.ko) (selected when you enable BRCMFMAC) |
322 | | - CONFIG_BRCMFMAC (brcmfmac.ko) |
323 | | - CONFIG_BRCMFMAC_SDIO=y (static; selects BRCMFMAC_PROTO_BCDC and FW_LOADER) |
324 | | |
325 | | On the Gateworks kernels these are all enabled and you see the following: |
326 | | {{{#!bash |
327 | | ~# dmesg | grep mmc0 |
328 | | [ 9.146576] mmc0: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA |
329 | | [ 9.184003] mmc0: queuing unknown CIS tuple 0x80 (2 bytes) |
330 | | [ 9.191715] mmc0: queuing unknown CIS tuple 0x80 (3 bytes) |
331 | | [ 9.199259] mmc0: queuing unknown CIS tuple 0x80 (3 bytes) |
332 | | [ 9.216072] mmc0: queuing unknown CIS tuple 0x80 (7 bytes) |
333 | | [ 9.345290] mmc0: new high speed SDIO card at address 0001 |
334 | | |
335 | | ~# dmesg | grep brcm |
336 | | ~# dmesg | grep brcm |
337 | | [ 16.537056] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1 |
338 | | [ 16.546999] usbcore: registered new interface driver brcmfmac |
339 | | [ 16.717595] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1 |
340 | | [ 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 |
341 | | }}} |
342 | | |
343 | | If you have the need for software support LAIRD has a driver package on their website that consists of a Linux backports driver with patches as well as patches for wpa_supplicant and hostapd. These are derived from periodic code-drops they get from Cypress and not all of these patches make it upstream. |
344 | | |
345 | | |
346 | | === Bluetooth |
347 | | Bluetooth functionality is provided by a UART based Bluetooth HCI (Host Controller Interface). |
348 | | |
349 | | kernel drivers: |
350 | | * CONFIG_BT (bluetooth support; bt.ko if module) |
351 | | * CONFIG_BT_HCIUART (UART based HCI support; hci_uart.ko if module) |
352 | | * CONFIG_BT_HCIUART_BCM (Broadcom protocol support) |
353 | | |
354 | | If 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: |
355 | | {{{#!bash |
356 | | [ 8.123246] Bluetooth: Core ver 2.22 |
357 | | [ 8.123338] Bluetooth: HCI device and connection manager initialized |
358 | | [ 8.123357] Bluetooth: HCI socket layer initialized |
359 | | [ 8.123373] Bluetooth: L2CAP socket layer initialized |
360 | | [ 8.123388] Bluetooth: SCO socket layer initialized |
361 | | [ 8.191235] Bluetooth: HCI UART driver ver 2.3 |
362 | | [ 8.194993] Bluetooth: HCI UART protocol Broadcom registered |
363 | | [ 8.550960] Bluetooth: hci0: BCM: chip id 94 |
364 | | [ 8.554052] Bluetooth: hci0: BCM: features 0x2e |
365 | | [ 8.577738] Bluetooth: hci0: BCM43430A1 |
366 | | [ 8.577755] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 |
367 | | [ 8.577899] Bluetooth: hci0: BCM: btbcm_patchram |
368 | | [ 12.044095] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0182 |
369 | | }}} |
370 | | |
371 | | If 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: |
372 | | {{{#!bash |
373 | | [ 8.577899] bluetooth hci0: Direct firmware load for brcm/BCM43430A1.hcd failed with error -2 |
374 | | [ 8.577910] Bluetooth: hci0: BCM: Patch brcm/BCM43430A1.hcd not found |
375 | | }}} |
376 | | |
377 | | The benefits of the BCM43430A1.hcd patchram firmware over the firmware already inside the part is that additionally functionality is added over time and security vulnerabilities are resolved. |
378 | | |
379 | | If 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: |
380 | | * Building: |
381 | | - Ubuntu (on target): |
382 | | {{{#!bash |
383 | | wget https://github.com/LairdCP/brcm_patchram/archive/brcm_patchram_plus_1.1.tar.gz |
384 | | tar xvf brcm_patchram_plus_1.1.tar.gz |
385 | | cd brcm_patchram-brcm_patchram_plus_1.1 |
386 | | apt install build-essential libbluetooth-dev |
387 | | # add '#include <unistd.h>' and '#include <sys/uio.h>' to the top of the two c files |
388 | | make |
389 | | cp brcm_patchram_plus /usr/local/bin |
390 | | cd .. |
391 | | }}} |
392 | | - !OpenWrt (cross-compile on host): |
393 | | {{{#!bash |
394 | | # setup OpenWrt toolchain env |
395 | | TOOLCHAIN_DIR=/opt/openwrt/16.02-imx6 |
396 | | TOOLCHAIN=toolchain-arm_cortex-a9+neon_gcc-5.2.0_musl-1.1.12_eabi |
397 | | PATH=$PATH:$TOOLCHAIN_DIR/$TOOLCHAIN/bin |
398 | | export STAGING_DIR=$TOOLCHAIN_DIR |
399 | | arm-openwrt-linux-gcc -I$TOOLCHAIN_DIR/$TOOLCHAIN/ brcm_patchram_plus.c -o brcm_patchram_plus |
400 | | }}} |
401 | | * Bringing up Bluetooth: |
402 | | {{{#!bash |
403 | | # load firmware and enable the hci over /dev/ttymxc3 |
404 | | brcm_patchram_plus -d \ |
405 | | --patchram lib/firmware/brcm/4343w.hcd \ |
406 | | --enable_hci --no2bytes --tosleep 1000 /dev/ttymxc3 & |
407 | | # hci should now be there |
408 | | hciconfig |
409 | | # bring up interface |
410 | | hciconfig hci0 up |
411 | | # scan |
412 | | hcitool scan |
413 | | # ping |
414 | | l2ping -c 3 <btmac from ping> |
415 | | }}} |
416 | | |
417 | | |
418 | | |