Scope

This document demonstrates how to integrate our 60-series Wi-Fi modules with a Raspberry Pi via SDIO interface for Wi-Fi and UART for Bluetooth.

Hardware

For this demonstration, we use the following:

https://www.lairdconnect.com/wireless-modules/wifi-modules-bluetooth/60-sipt-bluetooth-and-wifi-module/

Hardware setup

This is an example hardware setup. It is wired according to the Raspberry Pi’s SDIO overlay, also described below under “Preparation”.

pi@RPi4:\~ \$ raspi-gpio get 22-27

GPIO 22: level=0 fsel=7 alt=3 func=SD1_CLK pull=NONE

GPIO 23: level=1 fsel=7 alt=3 func=SD1_CMD pull=UP

GPIO 24: level=1 fsel=7 alt=3 func=SD1_DAT0 pull=UP

GPIO 25: level=1 fsel=7 alt=3 func=SD1_DAT1 pull=UP

GPIO 26: level=1 fsel=7 alt=3 func=SD1_DAT2 pull=UP

GPIO 27: level=1 fsel=7 alt=3 func=SD1_DAT3 pull=UP

Connect 3V3 and GND and GPIO 17 to the center tab of J11 on the ST60 DVK
(PMU_EN) to be able to enable the radio with that GPIO.

Note: This setup is a proof-of-concept, with the SDIO cabling being a functional but non-ideal implementation. This is why the SDIO speed is set only to 2MHz. Please refer to proper SDIO layout for your design.

Preparing SD Card to boot from

The following demonstrates how to flash a bootable SD card with rpi-imager with SSH enabled on a Ubuntu PC.

  1. Start rpi-imager. Expand

  2. Choose OS. Expand

  3. Choose SD card (must be inserted in your PC). Expand

  4. Enable SSH to be avaialable after boot. Expand

  5. Confirm choice Expand

  6. Authenticate to access the SD card for writing Expand

  7. Writing to SD card Expand

  8. Finished writing Expand

Remove the SD card from the PC and insert it into the Raspberry Pi’s SD card slot.

Preparation

The Raspberry Pi offers a neat way to disable and enable on board hardware with overlays.

To do so, edit the file /boot/config.txt on the SD card you just prepared and add this to the end of the file:

#to disable on-board Wifi

dtoverlay=disable-wifi

#to enable SDIO lines for Wifi module on GPIO pins 22-27 (default) at
low speed (2MHz) to accomodate for \"loose\" wiring

dtoverlay=sdio,sdio_overclock=2,poll_once=off

Important: Reboot the device for the changes to take effect.

For reference: https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

Result after reboot: Text Description automatically generated

To install required software and download kernel source follow:

https://www.raspberrypi.com/documentation/computers/linux_kernel.html

pi@RPi4:\~/Projects \$ sudo apt install git bc bison flex libssl-dev
make

Reading package lists\... Done

Building dependency tree\... Done

pi@RPi4:\~/Projects \$ git clone \--depth=1
https://github.com/raspberrypi/linux

Cloning into \'linux\'\...

remote: Enumerating objects: 78749, done.

remote: Counting objects: 100% (78749/78749), done.

remote: Compressing objects: 100% (75380/75380), done.

remote: Total 78749 (delta 6494), reused 15987 (delta 2550), pack-reused
0

Receiving objects: 100% (78749/78749), 212.13 MiB \| 5.94 MiB/s, done.

Resolving deltas: 100% (6494/6494), done.

Updating files: 100% (74226/74226), done.

pi@RPi4:\~/Projects \$ ls

linux

Place module firmware in filesystem:

pi@RPi4:\~/Projects \$ sudo wget
<https://github.com/LairdCP/Sterling-60-Release-Packages/releases/download/LRD-REL-10.4.0.10/laird-sterling60-firmware-sdio-uart-10.4.0.10.tar.bz2>

\--2022-09-21 13:49:59\--
https://github.com/LairdCP/Sterling-60-Release-Packages/releases/download/LRD-REL-10.4.0.10/laird-sterling60-firmware-sdio-uart-10.4.0.10.tar.bz2

\... (cut by the author)

Length: 257134 (251K) \[application/octet-stream\]

Saving to: 'laird-sterling60-firmware-sdio-uart-10.4.0.10.tar.bz2'

laird-sterling60-firmware-sdio-uart-10.4.0.1
100%\[===========================================================================================\>\]
251.11K \--.-KB/s in 0.03s

2022-09-21 13:49:59 (7.44 MB/s) -
'laird-sterling60-firmware-sdio-uart-10.4.0.10.tar.bz2' saved
\[257134/257134\]

pi@RPi4:\~/Projects \$ ls

laird-sterling60-firmware-sdio-uart-10.4.0.10.tar linux

pi@RPi4:\~/Projects \$ bunzip2
laird-sterling60-firmware-sdio-uart-10.4.0.10.tar.bz2

pi@RPi4:\~/Projects \$ sudo tar xvf
laird-sterling60-firmware-sdio-uart-10.4.0.10.tar -C /

lib/firmware/lrdmwl/88W8997_sdio.bin

lib/firmware/lrdmwl/88W8997_ST_sdio_uart_v5.5.46.5.bin

lib/firmware/lrdmwl/regpwr.db

lib/firmware/regulatory_sterling60.db

lib/firmware/regulatory.db

pi@RPi4:\~/Projects \$ ls /lib/firmware/lrdmwl/

88W8997_sdio.bin 88W8997_ST_sdio_uart_v5.5.46.5.bin regpwr.db

Download Backports for driver (kernel module) compilation and extract them:

\$ mkdir Projects

pi@RPi4:\~ \$ cd Projects/

pi@RPi4:\~/Projects \$ sudo wget
<https://github.com/LairdCP/Sterling-LWB-and-LWB5-Release-Packages/releases/download/LRD-REL-10.4.0.10/backports-laird-10.4.0.10.tar.bz2>

\--2022-09-21 13:40:15\--
<https://github.com/LairdCP/Sterling-LWB-and-LWB5-Release-Packages/releases/download/LRD-REL-10.4.0.10/backports-laird-10.4.0.10.tar.bz2>

\... (cut by the author)

Length: 9208248 (8.8M) \[application/octet-stream\]

Saving to: 'backports-laird-10.4.0.10.tar.bz2'

backports-laird-10.4.0.10.tar.bz2
100%\[===========================================================================================\>\]
8.78M 7.67MB/s in 1.1s

2022-09-21 13:40:17 (7.67 MB/s) - 'backports-laird-10.4.0.10.tar.bz2'
saved \[9208248/9208248\]

pi@RPi4:\~/Projects \$ bunzip2 backports-laird-10.4.0.10.tar.bz2

pi@RPi4:\~/Projects \$ tar xf backports-laird-10.4.0.10.tar -C .

pi@RPi4:\~/Projects \$ ls

backports-laird-10.4.0.10.tar laird-backport-10.4.0.10
laird-sterling60-firmware-sdio-uart-10.4.0.10.tar linux

Note: this tutorial uses the latest software that was available at the time of its creation. Please adapt the download links to a possibly newer version available at: https://github.com/LairdCP/Sterling-60-Release-Packages/releases

Configuring the kernel

In order for the ST60 module to function correctly, our software package must be used. The ST60 release package is necessary to replace the wireless and the Bluetooth framework that is built in to the Raspberry Pi kernel with our backports and wireless drivers. Additionally, the Raspberry Pi’s Bluetooth configuration needs to be taken out of the kernel configuration and the kernel needs to be rebuilt.

As described in the Raspberry Pi documentation linked above, execute the following commands to generate the default .config file.

Note: do not build yet!

cd linux
KERNEL=kernel7l
make bcm2711_defconfig

Expand

Next, disable Wifi, Bluetooth, RFKILL and Wi-Fi drivers in the kernel, and change the kernel name to distinguish between your build and the default build. Use make menuconfig for that.

Note: libncurses is required by menuconfig. Install that once prior to running make menuconfig.

pi@RPi4:\~/Projects/linux \$ sudo apt-get install libncurses5-dev libncursesw5-dev

\... (cut by the author)

pi@RPi4:\~/Projects/linux \$ make menuconfig

The first page appears as follows:

Expand

Note: you can hit ‘/’ to activate the search function

Disable Wireless (cfg80211) as shown:

Expand

Disable Bluetooth as shown:

Expand

Disable RFKILL as shown:

Expand

Disable all stock wireless module drivers as shown:

Expand

Change LOCALVERSION to reflect the changes made as shown:

Expand

Expand

Expand

Note: Do not forget to save your changes!

Note: If you run ‘make bcm2711_defconfig’ again, the above changes will all be reverted.

Now you are ready to build and install the kernel (32-bit).

Building the kernel

Build the kernel and install it using the commands described on this page: https://www.raspberrypi.com/documentation/computers/linux_kernel.html

Expand

Note: Remember to use the instructions for the 32-bit kernel

make -j4 zImage modules dtbs

sudo make modules_install

sudo cp arch/arm/boot/dts/\*.dtb /boot/

sudo cp arch/arm/boot/dts/overlays/\*.dtb\* /boot/overlays/

sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/

sudo cp arch/arm/boot/zImage /boot/\$KERNEL.img

Note: Remember to REBOOT after copying the kernel image over.

After reboot and issuing “uname -a” you can see the newly generated kernel has been loaded:

Expand

Note: kernel version 5.15.68-v7l_wo_wirless_bt_rfkill

Building and installing Backports

Navigate to the ackport directory and issue the following commands:

make defconfig-sterling60

make -j4

sudo make install

pi@RPi4:\~ \$ make defconfig-sterling60

Expand

Next, issue the following:

pi@RPi4:\~ \$ make -j4

Expand

Expand

pi@RPi4:\~ \$ sudo make install

Expand

Expand

Reboot the Raspberry Pi.

Bringing Up the Wi-Fi Interface

Enable GPIO17 as an output by issuing the following:

pi@RPi4:\~ \$ echo 17 \> /sys/class/gpio/export

pi@RPi4:\~ \$ echo out \> /sys/class/gpio/gpio17/direction

Next, set GPIO high (1) to enable the Wi-Fi module by issuing the following:

pi@RPi4:\~ \$ echo 1 \> /sys/class/gpio/gpio17/value

Expand

Complete the following to configure and enable the ST60 module:

pi@RPi4:\~ \$ dmesg

Expand

pi@RPi4:\~ \$ iw dev

Expand

pi@RPi4:\~ \$ ip addr

Expand

pi@RPi4:\~ \$ sudo iw wlan0 scan \| grep SSID

Expand

The ST60 module is now running on the Raspberry Pi.

Bringing up Bluetooth

Connect the ST60 DVK to the Raspberry Pi using a micro-USB to USB-A cable:

Expand

Issue the following commands to bring up Bluetooth on the ST60 within the Raspberry Pi:

pi@RPi4:\~ \$ dmesg

Expand

pi@RPi4:\~ \$ sudo btattach -B /dev/ttyUSB0 -P h4 -S3000000 &

Expand

Note: You might have to hit enter for the prompt to re-appear after “hciconfig” finishes.

pi@RPi4:\~ \$ bluetoothctl

Expand

Note: Issue “scan on” and “scan off” inside of Bluetoothctl CLI

In the GUI

We now disconnect the Ethernet cable from the Raspberry Pi, to ensure we’re only communicating over Wi-Fi.

Wireless networks are displayed in the GUI as shown:

Expand

Send a test ping as shown:

Expand

Connected to the internet (lairdconnect.com):

Expand