Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Bring up of AIROC™ CYW54591 with Jetson Xavier NX from NVIDIA - KBA235062

lock attach
Attachments are accessible only for community members.

Bring up of AIROC™ CYW54591 with Jetson Xavier NX from NVIDIA - KBA235062

IFX_Publisher2
Community Manager
Community Manager
Community Manager
25 likes received 1000 replies posted First like given

Version: **

1  Introduction

This article explains the bring up of AIROC™ CYW54591 Wi-Fi & Bluetooth® combo chip with Jetson Xavier NX development kit from NVIDIA.

1.1      Prerequisites

Knowledge of Linux commands and Linux-based text editors like nano/Vim required.

1.2      Hardware requirements

  1. Jetson Xavier NX board from NVIDIA along with necessary adapters and USB cables
  2. AIROC™ CYW54591 Wi-Fi module
  3. PC (Ubuntu 16.04.3 LTS)
  4. HDMI display
  5. USB keyboard
  6. 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:
BinduPriya_G_0-1648194546618.png BinduPriya_G_2-1648194622247.png

3    Bring up CYW54591 with Jetson Xavier NX

  1. 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
  1. 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
    BinduPriya_G_16-1648198465895.png

     

  1. Download the sample root file system:
    $ wget
    https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/t186/tegra_linux_sample-root-filesystem_r...
    BinduPriya_G_17-1648199437196.png

     

  1. Install the prerequisites for L4T compilation:
    $ sudo apt-get --yes install git-core build-essential gcc-aarch64-linux-gnu
  1. Download the kernel and bootloader source:
    export L4T_BASE_DIR=`pwd`/Linux_for_Tegra
    export DEFAULT_TAG_NAME="tegra-l4t-r32.6.1"
    export TAG_NAME="$DEFAULT_TAG_NAME"
    $L4T_BASE_DIR/source_sync.sh -t $TAG_NAME
  1. Apply the following Wi-Fi FMAC patch to the kernel defconfig to disable the default BCMDHD driver and enable the other FMAC-related configuration:
    export XAVIER_KERNEL_DIR=$L4T_BASE_DIR/sources/kernel/kernel-4.9
    export XAVIER_FMAC_DEFCONFIG_PATCH="./patches/xavier_nx_fmac_defconfig.patch"
    $ patch -d$XAVIER_KERNEL_DIR -p1 -N < $XAVIER_FMAC_DEFCONFIG_PATCH
  1. Cross-compile the kernel sources against AARCH64:
    export ARCH=arm64
    export CROSS_COMPILE=aarch64-linux-gnu-
    export LOCALVERSION=-tegra
    export KERNEL_SRC_PATH=$L4T_BASE_DIR/sources/kernel/kernel-4.9
    export TEGRA_KERNEL_OUT=$L4T_BASE_DIR/my_bins
    $  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)
  1. Apply user libraries to rootfs provided with the L4T package:
    export L4T_ROOTFS_DIR=$L4T_BASE_DIR/rootfs
    $ sudo $L4T_BASE_DIR/apply_binaries.sh
    BinduPriya_G_18-1648199490278.png

     

    If you get an error, extract the sample rootfs downloaded in Step 2 from the Jetpack directory:
    $ sudo tar -xvf tegra_linux_sample-root-filesystem_r32.6.1_aarch64.tbz2 -C  $L4T_ROOTFS_DIR
    $ sudo $L4T_BASE_DIR/apply_binaries.sh
  1. 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/.
  1. 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
  1. 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
  1. 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:
    [keyfile]
    unmanaged-devices=interface-name:wlan0
    BinduPriya_G_20-1648199582304.png

     

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

  1. Ensure that the device is powered OFF and the power adapter is disconnected.
  2. Verify that the microSD Card is inserted in the Jetson Xavier NX [developer kit version] module.
  3. Place a jumper across the Force Recovery Mode pins. These are pins 9 [GND] and 10 [FC REC] of the button header [J14].
  4. Connect your host computer to the device's USB Micro-B connector.
  5. Connect the power adapter to the power jack [J16].
    The device will automatically power on in Force Recovery mode.
  1. 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.
  1. Remove the jumper from the Force Recovery Mode pins.
    BinduPriya_G_5-1648197043256.png

     

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.

  1. Click the following link:
    https://developer.nvidia.com/embedded/learn/get-started-jetson-xavier-nx-devkit#setup
  2. 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:
    BinduPriya_G_7-1648197487137.png

4.4     Compile the FMAC driver in Jetson Xavier board

  1. 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.
    https://community.infineon.com/t5/Wi-Fi-Bluetooth-for-Linux/Cypress-Linux-WiFi-Driver-Release-FMAC-2...
  1. 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:
    BinduPriya_G_6-1648197392649.png
  1. 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
  1. 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/
  1. Generate a configuration file (.config) from the FMAC driver configuration specified in defconfigs/brcmfmac:
    $ make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL defconfig-brcmfmac
  1. Compile and generate the kernel modules:
    $ make KLIB=$MY_KERNEL KLIB_BUILD=$MY_KERNEL modules
    The kernel modules are available at the following paths:
    BinduPriya_G_8-1648197529687.png
  1. Copy the kernel modules to a new directory and reboot.
    Typically, the new directory created is named “kernel_module”.
  1. Extract cypress-firmware-v5.10.9-2021_1020.tar.gz:
    $ tar -xvf cypress-firmware-v5.10.9-2021_1020.tar.gz
    BinduPriya_G_9-1648197578075.png

Note:       Ignore this step if the /lib/firmware/cypress directory is already present.

  1. 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
  1. Copy the following files to /lib/firmware/cypress:
  1. 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.
  1. Verify the loaded modules using the following command:
    $ lsmod
     
    BinduPriya_G_11-1648197896987.png

     

  1. 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.
  2. Verify the interface by using the following command:
    $ ifconfig
    BinduPriya_G_12-1648197985946.png

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.

  1. 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
    Example:
    BinduPriya_G_13-1648198055373.png
  1. 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.
  1. 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:34092329-1cad-400f-951e-f5599d4b6605.PNG

  1. See the /etc/wpa_supplicant.conf directory for various wpa_supplicant configurations:
    $ sudo vi /etc/wpa_supplicant1.conf
  1. Copy this wpa_supplicant example for open network.
  2. 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

Where,

-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

  1. Run the following command to check the status of the connection:
    $ sudo wpa_cli status
  1. If an error similar to the following occurs, run the following command to stop wpa_supplicant:
    $ sudo rm -r /var/run/wpa_supplicant/
    removing /var/run/wpa_supplicant/
BinduPriya_G_14-1648198322466.png

4.7       Ping the STA and SoftAP

Ping the STA and SoftAP to check whether they are connected.

  1. From the STA, run the following command:
    $ ping -I wlan0 <IP address of softAP>
  1. From the SoftAP, run the following command:
    $ ping -I wlan0 <IP address of STA>

5   Throughput tests

5.1   TCP throughput test

  1. 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
  1. 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

  1. Run the following command on the Device-1-UDP Server (hosted on the SoftAP interface):
    $ iperf -s -u -i 1
  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

 

Attachments
0 Likes
3816 Views