Bring up of AIROC™ CYW54591 with Jetson Xavier NX from NVIDIA - KBA235062
Knowledge of Linux commands and Linux-based text editors like nano/Vim required.
1.2 Hardware requirements
- Jetson Xavier NX board from NVIDIA along with necessary adapters and USB cables
- AIROC™ CYW54591 Wi-Fi module
- PC (Ubuntu 16.04.3 LTS)
- HDMI display
- USB keyboard
- USB mouse
Note: HDMI display, USB Keyboard, and mouse required only for creating a user name and password during the first bootup.
2 Set up the hardware
- Connect the AIROC™ CYW54591 Wi-Fi chip to the M.2 Key E Mini-PCIe slot (J10) on the Jetson Xavier NX platform carrier board as shown below:
3 Bring up CYW54591 with Jetson Xavier NX
- Download the Linux_for_Tegra (L4T) BSP package provided by NVIDIA into a new directory called “Jetpack” and extract it. Navigate to the Jetpack directory:
$ mkdir Jetpack && cd Jetpack
- Copy the patches.zip file attached with this article and extract it:
$ wget https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/t186/jetson_linux_r32.6.1_aarch64.tbz2
$ tar -xvf jetson_linux_r32.6.1_aarch64.tbz2
- Download the sample root file system:
- Install the prerequisites for L4T compilation:
$ sudo apt-get --yes install git-core build-essential gcc-aarch64-linux-gnu
- Download the kernel and bootloader source:
$ $L4T_BASE_DIR/source_sync.sh -t $TAG_NAME
- Apply the following Wi-Fi FMAC patch to the kernel defconfig to disable the default BCMDHD driver and enable the other FMAC-related configuration:
$ patch -d$XAVIER_KERNEL_DIR -p1 -N < $XAVIER_FMAC_DEFCONFIG_PATCH
- Cross-compile the kernel sources against AARCH64:
$ mkdir -p $TEGRA_KERNEL_OUT
$ make -C $KERNEL_SRC_PATH O=$TEGRA_KERNEL_OUT tegra_defconfig && make -C $KERNEL_SRC_PATH O=$TEGRA_KERNEL_OUT -j$(nproc)
- Apply user libraries to rootfs provided with the L4T package:
$ sudo $L4T_BASE_DIR/apply_binaries.sh
$ sudo tar -xvf tegra_linux_sample-root-filesystem_r32.6.1_aarch64.tbz2 -C $L4T_ROOTFS_DIR
$ sudo $L4T_BASE_DIR/apply_binaries.sh
- Replace with the generated kernel and DTBs:
$ cp $TEGRA_KERNEL_OUT/arch/arm64/boot/Image $L4T_BASE_DIR/kernel/.
$ cp $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/* $L4T_BASE_DIR/kernel/dtb/.
- Install the driver modules to the rootfs directory:
$ sudo make -C $KERNEL_SRC_PATH ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$L4T_ROOTFS_DIR modules_install
- Copy the kernel configuration file (.config) to the rootfs directory:
$ sudo cp $TEGRA_KERNEL_OUT/.config $L4T_ROOTFS_DIR/usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/.config
- Add the following line to disable the NetworkManager service controlling the wlan0 interface. Open the $L4T_ROOTFS_DIR/etc/NetworkManager/NetworkManager.conf file and append the following lines:
4 Flash the Jetson Xavier NX board
Before you can flash the Jetson board, you need to put the kit into Recovery mode. After that, you can flash the kit.
4.1 Put Jetson Xavier NX in Recovery mode
To put the Jetson Xavier NX board in Recovery mode, use one of the following options.
4.1.1 With console access and logged in to Jetson platform
- Run the following command to enter Recovery mode:
$ sudo reboot --force forced-recovery
4.1.2 Without console access
- Ensure that the device is powered OFF and the power adapter is disconnected.
- Verify that the microSD Card is inserted in the Jetson Xavier NX [developer kit version] module.
- Place a jumper across the Force Recovery Mode pins. These are pins 9 [GND] and 10 [FC REC] of the button header [J14].
- Connect your host computer to the device's USB Micro-B connector.
- Connect the power adapter to the power jack [J16].
The device will automatically power on in Force Recovery mode.
- On a terminal of your host PC, run the lsusb command.
You should see the following output to confirm that the Jetson board is in Recovery mode:
Bus 001 Device 010: ID 0955:7e19 NVidia Corp.
- Remove the jumper from the Force Recovery Mode pins.
4.2 Flash the board with the system image
- Run the following commands:
$ cd $L4T_BASE_DIR
$ sudo ./flash.sh jetson-xavier-nx-devkit mmcblk0p1
It may take several minutes to complete flashing the system image. Once completed, the Jetson Xavier NX kit will auto restart.
4.3 Create the user name and password
You will need an HDMI display, a USB keyboard, and a mouse for creating the user name and password.
- Click the following link:
- To verify that the AIROC™ CYW54591 chip is detected by the host PCIe controller of Jetson Xavier NX , run the lspci command on the target device:
4.4 Compile the FMAC driver in Jetson Xavier board
- Download the cypress-fmac-v5.10.9-2021_1020.zip file from the following link and copy it to a new directory in the Xavier NX board. Use WinSCP or any FTP-based software.
- Extract the zip file downloaded in the previous step:
$ unzip cypress-fmac-v5.10.9-2021_1020.zip
The following files are available in this archive:
- Extract the cypress-backports-v5.10.9-2021_1020-module-src.tar.gz file in the unzipped files:
$ tar -xvf cypress-backports-v5.10.9-2021_1020-module-src.tar.gz
- Navigate to the directory extracted in the previous step (v5.10.9-backports) and set the path to kernel headers:
$ export MY_KERNEL=/usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/
- Generate a configuration file (.config) from the FMAC driver configuration specified in defconfigs/brcmfmac:
$ make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL defconfig-brcmfmac
- Compile and generate the kernel modules:
$ make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL modules
The kernel modules are available at the following paths:
- Copy the kernel modules to a new directory and reboot.
Typically, the new directory created is named “kernel_module”.
- Extract cypress-firmware-v5.10.9-2021_1020.tar.gz:
$ tar -xvf cypress-firmware-v5.10.9-2021_1020.tar.gz
Note: Ignore this step if the /lib/firmware/cypress directory is already present.
- Create a directory named “firmware” inside the /lib directory and create another directory named “cypress” inside the /firmware directory:
$ sudo mkdir -p /lib/firmware/cypress
- Copy the following files to /lib/firmware/cypress:
Note: cyfmac54591-pcie.txt is the NVRAM file which is not available in the FMAC release package. You should obtain the NVRAM file from the module vendor. The NVRAM file for the 1XA (54591) module is available in the following Murata GitHub link: https://github.com/murata-wireless/cyw-fmac-nvram/blob/master/cyfmac54591-pcie.1XA.txt
- Go to the kernel_module directory created in Step 7 and load the kernel modules. If cfg80211.ko and compat.ko are already loaded, remove these modules first before loading all modules:
sudo rmmod cfg80211.ko
sudo rmmod compat.ko
$ sudo insmod compat.ko
$ sudo insmod cfg80211.ko
$ sudo insmod brcmutil.ko
$ sudo insmod brcmfmac.ko
Modules should be loaded strictly in this order. Follow the exact opposite order for removing the modules.
- Verify the loaded modules using the following command:
- Bring the interface up using a static IP address:
$ sudo ifconfig wlan0 192.168.1.2 up
Assign a static IP address corresponding to the AP’s subnet.
- Verify the interface by using the following command:
4.5 Configure the WLAN device as a SoftAP
hostapd is the recommended user-space Linux daemon to configure the WLAN device as a SoftAP. It implements IEEE 802.11 Access Point management, IEEE 802.1X/WPA/WPA2/WPA3/EAP Authenticators, RADIUS client, EAP server, and RADIUS authentication server. You can configure hostapd to function in any of those modes. Originally designed to be a daemon program, hostapd supports front-end programs like hostapd_cli.
- Install hostapd using the following command:
$ sudo apt-get install hostapd
The /etc/hostapd directory is created after installation.
$ cd /etc/hostapd
$ sudo vi hostapd.conf
- Use the following command to create an AP with the name “JETSON_XAVIER”:
$ sudo hostapd ./hostapd.conf -B -dd
-dd is used to enable debug prints.
- Check the status of the AP:
$ sudo hostapd_cli status
If an error similar to the following occurs, run the following command to stop hostapd:
$ sudo rm -r /var/run/hostapd
4.6 Configure the WLAN device as STA
wpa_supplicant is the recommended user-space Linux daemon to handle the WLAN authentication, association, disassociation, de-authentication processes for STAs. Like hostapd, it is important to understand how to pass configuration files for controlling the WPA supplicant.
wpa_supplicant is configured using a text file that lists all accepted networks and security policies, including pre-shared keys. All file paths in this configuration file should use full (absolute, not relative to working directory) path to allow the working directory to be changed.
The following is a sample wpa_supplicant for open network:
- See the /etc/wpa_supplicant.conf directory for various wpa_supplicant configurations:
$ sudo vi /etc/wpa_supplicant1.conf
- Copy this wpa_supplicant example for open network.
- After completing the configuration, start wpa_supplicant to connect to your office or home AP and start your application. Run the following command:
$ sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant1.conf
-B is used to run the wpa_supplicant daemon in the background.
-c option is used to provide the configuration file; in this case, wpa_supplicant1.conf
-i option is used to select the network interface to be used
- Run the following command to check the status of the connection:
$ sudo wpa_cli status
- If an error similar to the following occurs, run the following command to stop wpa_supplicant:
$ sudo rm -r /var/run/wpa_supplicant/
4.7 Ping the STA and SoftAP
Ping the STA and SoftAP to check whether they are connected.
- From the STA, run the following command:
$ ping -I wlan0 <IP address of softAP>
- From the SoftAP, run the following command:
$ ping -I wlan0 <IP address of STA>
5 Throughput tests
5.1 TCP throughput test
- Run the following command on the Device-1-TCP Server (hosted on the SoftAP interface):
$ iperf -s -f m -i 1 -w 8m -l 8k
- Run the following command on the Device-2-TCP Client (hosted on the STA interface):
$ iperf -c <TCP Server’s WLAN IP address> -i 1 -f m -t 30 -w 8m -l 8k
5.2 UDP throughput test
- Run the following command on the Device-1-UDP Server (hosted on the SoftAP interface):
$ iperf -s -u -i 1
- Run the following command on the Device-2-UDP Client (hosted on the STA interface):
$ iperf -c<UDP Server’s WLAN IP address> -u -i 1 -f m -t 30 -b 1200m