Skip to content

Compute Module 4🔗

Introduction🔗

The PAN9019A requires a fairly powerful host processor that executes the low-level Wi-Fi® and Bluetooth® drivers as well as some high-level Wi-Fi application software and a Bluetooth stack.

As an evaluation platform you can use the Compute Module 4 on the IO Board.

It does not have an on-board M.2 Key E slot for the PAN9019A M.2 device, but an additional SDIO interface and other peripherals can be enabled on the 40-pin expansion header.

To bring the PAN9019A M.2 device and the Compute Module 4 on the IO Board together, you can use the M.2 to Raspberry Pi Adapter.

This guide shows you how to evaluate a Panasonic PAN9019A M.2 device on a Compute Module 4 on the IO Board with the help of the M.2 to Raspberry Pi Adapter. But you have to be aware that only the basic bring-up is explained, not any advanced usage.

Hardware Modifications🔗

The interfaces on the 40-pin expansion header of the IO Board usually operate with 3.3 V signal level, while the PAN9019A M.2 device operates with 1.8 V instead.

However, the Compute Module 4 also supports 1.8 V signal levels, so you have to modify the IO Board to configure this.

You have to follow the instructions in the Compute Module 4 IO Board documentation that you can find on the IO Board homepage.

Refer to chapter 2.14. Jumpers (R4/R5 Vref voltage selection) and move R5 to R4 on the IO Board to set the IO voltage to 1.8 V. These resistors are located below the Compute Module 4.

IO Voltage

This modification changes the IO voltage for all GPIOs to 1.8 V.

Beware if you have other peripherals attached to any of the GPIOs.

Host System Assembly🔗

The following requirements must be met:

You have to do the following steps to assemble the system.

  1. Mount the PAN9019A M.2 device 3 onto the M.2 to Raspberry Pi Adapter 2 as explained in First Steps.

  2. Mount the M.2 to Raspberry Pi Adapter 2 onto the 40-pin expansion header of the Compute Module 4 on the IO Board 1.

  3. Power the M.2 to Raspberry Pi Adapter through the USB-C connector 4, otherwise the adapter is non-functional.

Host System Setup🔗

Initial Bring-Up🔗

You have to follow the Getting Started guide to bring up your Compute Module 4 on the IO Board.

The guide assumes that you use a recent version of Raspberry Pi OS based on Debian version 12 ("bookworm").

Network Connectivity🔗

You have to make sure that the Compute Module 4 on the IO Board is on the same network as your development system, because you need to interact with your host system and maybe transfer files to it in later steps.

You have to check and remember the IP address of your host system for later use.

  1. On your host system, retrieve the current network configuration for the on-board Ethernet port in a Terminal window.

    ip addr show eth0
    

    The output should look something like this:

    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
      link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
      inet 192.168.187.100/24 brd 192.168.187.255 scope global dynamic noprefixroute eth0
        valid_lft 86089sec preferred_lft 86089sec
      inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link noprefixroute
        valid_lft forever preferred_lft forever
    

    The IP address of your host system is 192.168.187.100

Host System IP Address

For this host system the IP address is 192.168.187.100, but it may be different for yours.

In any case you have to use this IP address to communicate with your host system for the remainder of this document.

To check if your Compute Module 4 on the IO Board has Internet connectivity execute the following steps.

  1. Use the ping command.

    ping -n -c 2 8.8.8.8
    

    The output should look something like this:

    Pinging 8.8.8.8 with 32 bytes of data:
    Reply from 8.8.8.8: bytes=32 time=19ms TTL=116
    Reply from 8.8.8.8: bytes=32 time=17ms TTL=116
    [...]
    

    Your Compute Module 4 on the IO Board has Internet connectivity.

Host System Remote Access

If you do not have any application for the SSH protocol yet, you can try the OpenSSH protocol suite.

It also includes tools for remote file operations like ssh and scp.

At the end of this process you should have a fully working system you can remotely log into.

Host System Configuration🔗

The following requirements must be met:

Install Additional Package🔗

You have to install the cmake package that provides the cmake tool on your host system for later use.

  1. Update the package index on the host system.

    sudo apt update
    
  2. Install the additional package.

    sudo apt install cmake
    

Enable Peripheral Interfaces🔗

You have to modify the boot configuration of your system in order to enable additional peripheral interfaces on the 40-pin expansion header.

  1. Download an additional overlay file that enable RTS and CTS flow control signals on the 40-pin expansion header.

    Note

    You can check out this post on the Raspberry Pi Forums for further information.

    sudo wget -O /boot/firmware/overlays/uart-ctsrts.dtbo \
      https://github.com/HiassofT/AtariSIO/raw/master/contrib/rpi/uart-ctsrts.dtbo
    
  2. Add the following entries to the end of the configuration file config.txt using the nano editor.

    sudo nano /boot/firmware/config.txt
    
    config.txt
    dtoverlay=disable-wifi
    dtoverlay=disable-bt
    dtoverlay=uart-ctsrts
    dtoverlay=sdio,poll_once=off
    dtoverlay=i2c1
    dtoverlay=spi0-1cs,cs0_pin=8
    dtoverlay=pca953x,tca6408
    gpio=7=op,dh
    

    The on-board Wi-Fi and Bluetooth are disabled, a UART interface is enabled on the expansion header with flow-control enabled, additional SDIO, I2C and SPI interfaces on the expansion header and support for I2C GPIO expanders is enabled, a GPIO is configured for application control.

Disable System Services🔗

The Raspberry Pi OS runs some system services that integrate the on-board Wi-Fi and Bluetooth connectivity into the system and also automate certain tasks and behaviors.

During the evaluation of the PAN9019A module this is can create problems, so you have to change your system configuration to avoid this.

  1. Mask certain system services to prevent them from running.

    sudo systemctl mask wpa_supplicant
    sudo systemctl mask hciuart
    sudo systemctl mask ModemManager
    

Change UART Handling🔗

The Raspberry Pi OS provides a login shell on the built-in UART of the Compute Module 4 on the IO Board by default.

Because this built-in UART is the only UART that is capable to fully communicate with the Bluetooth portion of the PAN9019A module, you have to disable the existing functionality. By doing this, the UART is automatically enabled on the 40-pin expansion header.

Warning

If you use the login shell on the built-in UART to interact with the Compute Module 4 on the IO Board you have to switch to a different method.

You can either use a network login via ssh or use the graphical user interface instead.

  1. Enable the UART for sure.

    sudo raspi-config nonint do_serial_hw 0
    
  2. Disable shell and kernel messages on the UART.

    sudo raspi-config nonint do_serial_cons 1
    

System Reboot

You have to reboot the host system for these changes to take effect.

sudo reboot

rgpower Files🔗

Before you can fully operate the PAN9019A, a set of so-called rgpower files is required. These files contain channel tables and regulatory parameters of the PAN9019A for a specific region it operates in.

For further information on this topic refer to rgpower Files in the Software Guide for the PAN9019A.

Since these files are provided by Panasonic you need to transfer them to the system manually in a later step.

To gain access to the rgpower files you have to go through an uncomplicated approval process that you can find directly on the following pages.

Warning

The PAN9019A is a radio certified module. There are conditions on hardware and software which must be met for the modular approval to be valid.

For detailed information please refer to the PAN9019A Module Integration Guide at

However, if you want to continue right away you can also start with the single world-wide (WW) rgpower file, which is the fall-back regulatory file for all regions the module is certified for.

The world-wide rgpower file has a couple restrictions compared to the region-specific rgpower files:

  • Support for channels 1 to 11 in 2.4 GHz band only
  • No support for 5 GHz band
  • Overall reduced output power

For the initial evaluation of the PAN9019A module the world-wide rgpower file is available from the Downloads section.

You can download it directly when you setup your host system as explained in Install rgpower Files in a later step.

Host System Software Installation🔗

Compile the Device Driver🔗

You have to retrieve and compile the driver for the PAN9019A module.

  1. Clone the driver repository from NXP's GitHub space.

    cd ~
    git clone https://github.com/nxp-imx/mwifiex.git
    
  2. Check out the specific branch that matches the running kernel most closely.

    cd ~/mwifiex/
    git checkout lf-6.6.23_2.0.0
    
  3. Compile the driver.

    cd ~/mwifiex
    make CROSS_COMPILE= KERNELDIR=/lib/modules/$(uname -r)/build -j4 build
    
  4. Create a global driver directory and copy the driver.

    sudo mkdir -p /lib/modules/$(uname -r)/extra
    cd ~/mwifiex
    sudo cp mlan.ko moal.ko /lib/modules/$(uname -r)/extra 
    

Install the Firmware🔗

You have to download and install the firmware for the PAN9019A module.

  1. Create the destination directory for the firmware and configuration files.

    sudo mkdir -p /lib/firmware/nxp/
    
  2. Clone the firmware repository from NXP's GitHub space.

    cd ~
    git clone https://github.com/nxp-imx/imx-firmware.git
    cd imx-firmware/
    git checkout lf-6.6.23_2.0.0
    
  3. Copy the firmware to the global firmware directory.

    cd ~/imx-firmware
    sudo cp nxp/FwImage_IW612_SD/sduart_nw61x_v1.bin.se /lib/firmware/nxp/
    
  4. Copy the configuration file wifi_mod_para.conf to the global firmware directory.

    cd ~/imx-firmware
    sudo cp nxp/wifi_mod_para.conf /lib/firmware/nxp/
    
  5. Edit the SDIW612 section in the file wifi_mod_para.conf using the nano editor to contain the following settings.

    sudo nano /lib/firmware/nxp/wifi_mod_para.conf
    
    wifi_mod_para.conf
    SDIW612 = {
        cal_data_cfg=none
        fw_name=nxp/sduart_nw61x_v1.bin.se
        cntry_txpwr=2
    }
    

Install rgpower Files🔗

As explained in rgpower Files the PAN9019A module needs proper rgpower files to operate.

If you already have your set of rgpower files, you have to copy them to the /lib/firmware/nxp/ directory on your host system.

If you do not have your set of rgpower files yet and want to use the single world-wide (WW) rgpower file instead, you can download it directly to the host system.

  1. Download the rgpower file to the global firmware directory.

    sudo wget -O /lib/firmware/nxp/rgpower_WW.bin \
      https://pideu.panasonic.de/development-hub/pan9019/downloads/rgpower_WW.bin
    

Wi-Fi🔗

Bring Up🔗

The newly compiled device drivers are not loaded into the Linux kernel automatically, you have to manually load them into the kernel prior to operation.

  1. Make sure that Linux kernel module dependency database is up-to-date.

    sudo depmod -a
    
  2. Load the modules into the Linux kernel.

    sudo modprobe mlan
    sudo modprobe moal mod_para=nxp/wifi_mod_para.conf 
    
  3. Check the Linux kernel log.

    sudo dmesg
    

    The output should look something like this:

    [  263.436351] Request firmware: nxp/sduart_nw61x_v1.bin.se
    [  263.852847] Wlan: FW download over, firmwarelen=1038668 downloaded 936668
    [  264.256233] WLAN FW is active
    [  264.300156] on_time is 264296058797
    [  264.374828] VDLL image: len=102000
    [  264.376130] fw_cap_info=0x487cff03, dev_cap_mask=0xffffffff
    [  264.376158] uuid: 068bfcc4ba1d528786ce818360ed4555
    [  264.376162] max_p2p_conn = 8, max_sta_conn = 16
    [  264.389119] Trying download country_power_tble: nxp/rgpower_WW.bin
    [  264.463300] Request firmware: nxp/rgpower_WW.bin
    [  264.629607] call regulatory_set_wiphy_regd WW
    [  264.663429] Register NXP 802.11 Adapter mlan0
    [  264.767939] wlan: uap%d set max_mtu 2000
    [  264.819529] Register NXP 802.11 Adapter uap0
    [  264.884398] call regulatory_set_wiphy_regd WW
    [  264.896841] Register NXP 802.11 Adapter wfd0
    [  265.000308] wlan: version = SDIW612---18.99.3.p10.1-MM6X18437.p21-GPL-(FP92) 
    [  265.125657] uap0: Skip change virtual intf type on uap: from 3 to 2
    

Note

If you can't see that the PAN9019A M.2 device was detected, press the reset button 6 button of the M.2 to Raspberry Pi Adapter briefly once.

This resets the PAN9019A module, but also triggers the detection in the Linux kernel again.

You can now check the functionality of the driver.

  1. Use the ip command to verify that the mlan0 network interface for the PAN9019A is now available.

    ip addr show mlan0
    

    The output should look something like this:

    3: mlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
      link/ether 34:32:e6:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    

Usage🔗

You have to follow these steps to check if Wi-Fi is functional.

  1. Bring up the Wi-Fi interface.

    sudo ip link set dev mlan0 up
    
  2. Execute a Wi-Fi scan.

    sudo iw dev mlan0 scan
    

    You can see that nearby Wi-Fi networks are discovered successfully.

Bluetooth🔗

The following requirements must be met:

  • You have successfully brought up the Wi-Fi portion as explained in Wi-Fi.

Bring Up🔗

You have to follow these steps to bring up the Bluetooth interface.

  1. Initialize the Bluetooth interface.

    sudo hciattach /dev/ttyAMA0 any 115200 flow
    

    The output should look something like this:

    Device setup complete
    

  2. Bring up the Bluetooth interface.

    sudo hciconfig hci0 up
    

Usage🔗

You have to follow these steps to check if Bluetooth is functional.

  1. Execute a Bluetooth scan.

    bluetoothctl scan on
    

    You can see that nearby Bluetooth devices that are advertising are discovered successfully.

802.15.4🔗

The following requirements must be met:

  • You have successfully brought up the Wi-Fi portion as explained in Wi-Fi.

Software Setup🔗

In the Raspberry Pi OS there is no integrated support for OpenThread using the 802.15.4 radio portion of the PAN9019A, but you can compile the necessary software directly on the Compute Module 4 on the IO Board.

  1. Navigate to the base of your working environment.

    cd ~
    
  2. Clone the official OpenThread repository and checkout a version that matches the driver version.

    git clone https://github.com/openthread/openthread.git
    cd openthread
    git checkout 5beae143700db54c6e9bd4b15a568abe2f305723
    cd ..
    
  3. Clone NXP's meta-matter repository and checkout a version that matches the driver version, too.

    git clone https://github.com/nxp-imx/meta-matter.git
    cd meta-matter
    git checkout imx_matter_2024_q1
    cd ..
    
  4. The official OpenThread stack does not work out-of-the-box with the PAN9019A module yet.

    Apply an NXP-specific patch from the meta-matter repository to make the OpenThread stack fully work.

    cd openthread
    patch -p1 < ../meta-matter/recipes-openthread/openthread/files/0001-Apply-IW612-change-to-openthread.patch
    
  5. Compile the OpenThread stack.

    ./script/cmake-build posix -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DOT_COMPILE_WARNING_AS_ERROR=OFF -DOT_PLATFORM=posix -DOT_SLAAC=ON \
        -DOT_BORDER_AGENT=ON -DOT_BORDER_ROUTER=ON -DOT_COAP=ON -DOT_COAP_BLOCK=ON \
        -DOT_COAP_OBSERVE=ON -DOT_COAPS=ON -DOT_COMMISSIONER=ON -DOT_CHANNEL_MANAGER=ON \
        -DOT_CHANNEL_MONITOR=ON -DOT_CHILD_SUPERVISION=ON -DOT_DATASET_UPDATER=ON \
        -DOT_DHCP6_CLIENT=ON -DOT_DHCP6_SERVER=ON -DOT_DIAGNOSTIC=ON -DOT_DNS_CLIENT=ON \
        -DOT_ECDSA=ON -DOT_IP6_FRAGM=ON -DOT_JAM_DETECTION=ON -DOT_JOINER=ON \
        -DOT_LEGACY=ON -DOT_MAC_FILTER=ON -DOT_NETDIAG_CLIENT=ON \
        -DOT_NEIGHBOR_DISCOVERY_AGENT=ON -DOT_PING_SENDER=ON -DOT_REFERENCE_DEVICE=ON \
        -DOT_SERVICE=ON -DOT_SNTP_CLIENT=ON -DOT_SRP_CLIENT=ON -DOT_COVERAGE=OFF \
        -DOT_LOG_LEVEL_DYNAMIC=ON -DOT_RCP_RESTORATION_MAX_COUNT=2 \
        -DOT_LOG_OUTPUT=PLATFORM_DEFINED -DOT_POSIX_MAX_POWER_TABLE=ON -DOT_DAEMON=ON \
        -DOT_THREAD_VERSION=1.3 -DCMAKE_BUILD_TYPE=Release -DOT_POSIX_CONFIG_RCP_BUS=SPI
    

Bring Up🔗

The reset function of the 802.15.4 subsystem of the PAN9019A module is controlled using the I2C GPIO Expander on the PAN9019A M.2 device.

It is important that the I2C GPIO Expander is correctly recognized by the Compute Module 4 on the IO Board during boot, otherwise it cannot be used by the OpenThread stack later.

You have to follow these steps to verify that the I2C GPIO Expander is really available.

  1. Reboot the host system.

    sudo reboot
    
  2. Check if an additional I2C GPIO Expander with the signature [1-0020] is present.

    gpiodetect
    

    The output should look something like this:

    [...]
    gpiochip2 [1-0020] (8 lines)
    [...]
    

    The I2C GPIO Expander gpiochip2 is present in the host system.

You can verify that the OpenThread stack starts correctly as follows.

  1. Start the OpenThread daemon ot-daemon with the following configuration to run in the background.

    cd ~/openthread/build/posix/src/posix/
    sudo ./ot-daemon -v "spinel+spi:///dev/spidev0.0?gpio-int-device=/dev/gpiochip0&gpio-int-line=7&gpio-reset-device=/dev/gpiochip2&gpio-reset-line=1&spi-mode=0&spi-speed=500000&spi-reset-delay=500" &
    

    The output should look something like this:

    ./ot-daemon[608]: Running OPENTHREAD/thread-reference-20230706-12-g5beae1437-dirty; POSIX; May 22 2024 13:50:08
    ./ot-daemon[608]: Thread version: 4
    ./ot-daemon[608]: Thread interface: wpan0
    ./ot-daemon[608]: RCP version: OPENTHREAD/thread-reference-20180926-4730-gad808304f; IWX12; Dec 15 2023 12:28:58
    

    The version information of the OpenThread stack is shown correctly.

Note

Due to whatever reasons, the first start after a fresh reboot sometimes fails. If you have this problem, simply try this step again.

Usage🔗

You can verify that the OpenThread stack operates correctly as follows.

  1. Perform a factory reset to verify the communication.

    sudo ./ot-ctl factoryreset
    

    The output should look something like this:

    ./ot-daemon[608]: Running OPENTHREAD/thread-reference-20230706-12-g5beae1437-dirty; POSIX; May 22 2024 13:50:08
    ./ot-daemon[608]: Thread version: 4
    ./ot-daemon[608]: Thread interface: wpan0
    ./ot-daemon[608]: RCP version: OPENTHREAD/thread-reference-20180926-4730-gad808304f; IWX12; Dec 15 2023 12:28:58
    

    The version information of the OpenThread stack is shown correctly.

Appendix🔗

The PAN9019A module has a couple of special function pins that are routed to the 40-pin expansion header as follows.

Raspberry Pi M.2 Specification PAN9019A Description
GPIO 5 W_DISABLE1# PDn Power Down
GPIO 6 W_DISABLE#2 IND_RST_BT Bluetooth reset
GPIO 4 SDIO_RST# IND_RST_WL Wi-Fi reset

You can manually control the special function pins using the pinctrl tool. For example:

  1. Apply GND to GPIO 5 to signal power down to the module.

    pinctrl set 5 op pu dl
    
  2. Apply VCC to GPIO 5 to enable the module again.

    pinctrl set 5 op pu dh
    

Some more special function pins of the PAN9019A module are routed to the I2C GPIO Expander as follows.

I2C GPIO Expander PAN9019A Description
3 IND_RST_14.4 802.15.4 reset
7 RST_IND Reset indicator