### Setup and Start IQ Capture on SDR Board Source: https://context7.com/open-sdr/openwifi/llms.txt This section details the steps to set up the SDR board and initiate IQ data capture. It includes commands for navigating directories, loading kernel modules, and controlling capture parameters like pre-trigger length. Dependencies include the 'side_ch.ko' kernel module and 'side_ch_ctl' utility. ```bash cd openwifi ./wgd.sh ./monitor_ch.sh sdr0 11 insmod side_ch.ko iq_len_init=8187 ./side_ch_ctl wh3h01 ./side_ch_ctl wh11d4094 ./side_ch_ctl g ``` -------------------------------- ### Prepare Kernel Source Code for OpenWIFI Source: https://github.com/open-sdr/openwifi/blob/master/README.md Installs necessary dependencies and prepares the Analog Devices Linux kernel source code for compilation. This is a one-time setup process. It requires specifying the Xilinx directory and the architecture bitness (32 for Zynq 7000, 64 for Zynq MPSoC). ```bash sudo apt install flex bison libssl-dev device-tree-compiler u-boot-tools -y cd openwifi/user_space; ./prepare_kernel.sh $XILINX_DIR ARCH_BIT ``` -------------------------------- ### Initialize and Start CSI Monitoring Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/csi.md Commands to initialize the SDR board, load the side channel kernel module, and start the CSI data collection process. ```bash ssh root@192.168.10.122 cd openwifi ./wgd.sh ./monitor_ch.sh sdr0 11 insmod side_ch.ko ./side_ch_ctl g ``` -------------------------------- ### Inject 802.11n Packets Example Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/inject_80211.md Example shell commands to set up monitor mode on a channel, inject 802.11n packets with specific parameters (rate, count, size), and optionally create a virtual monitor interface for injection. ```bash # Setup monitor mode ./wgd.sh ./monitor_ch.sh sdr0 11 # Inject packets via physical interface ./inject_80211/inject_80211 -m n -r 0 -n 10 -s 64 sdr0 # Inject packets via virtual monitor interface iw dev sdr0 interface add mon0 type monitor && ifconfig mon0 up ./inject_80211/inject_80211 -m n -r 0 -n 10 -s 64 mon0 ``` -------------------------------- ### Initialize OpenWIFI Runtime Source: https://github.com/open-sdr/openwifi/blob/master/doc/img_build_instruction/kuiper.md Executes the setup scripts and network interface commands to bring the OpenWIFI system online. This sequence should be performed after the initial build process. ```bash /root/openwifi/setup_once.sh cd /root/openwifi ./wgd.sh ifconfig sdr0 up iwlist sdr0 scan ./fosdem.sh ``` -------------------------------- ### 802.11 Packet Injection Examples Source: https://context7.com/open-sdr/openwifi/llms.txt Provides examples of using the 'inject_80211' tool with different parameters to inject various types of 802.11 packets. These examples demonstrate injection for different modulation and coding schemes (MCS) and packet sizes. ```bash ./inject_80211/inject_80211 -m n -r 7 -n 100 -s 1400 -d 1000 sdr0 ./inject_80211/inject_80211 -m a -r 4 -n 50 -s 100 sdr0 ``` -------------------------------- ### Start WiFi Access Point Source: https://context7.com/open-sdr/openwifi/llms.txt Configures the SDR as an Access Point, including IP assignment, DHCP server startup, and hostapd configuration. ```bash cd openwifi ./fosdem.sh cat /proc/interrupts | grep tx_itrpt1 ``` -------------------------------- ### Execute OpenWifi TX IQ Capture Setup Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/iq_2ant.md This snippet outlines the shell commands to configure and initiate TX IQ capture in free running mode. It involves changing directories, loading kernel modules with specific parameters, and executing control commands to set up the trigger conditions and I/Q source. The `iq_len_init` parameter determines the number of I/Q samples captured, and trigger condition 0 is essential for free running mode. ```bash cd openwifi ./fosdem.sh insmod side_ch.ko iq_len_init=511 ./side_ch_ctl wh11d1 ./side_ch_ctl wh8d0 ./side_ch_ctl wh5h3 ./side_ch_ctl wh3h11 ./side_ch_ctl g1 ``` -------------------------------- ### Install System Dependencies and Tools Source: https://github.com/open-sdr/openwifi/blob/master/doc/img_build_instruction/kuiper.md Installs necessary networking packages including DHCP server, hostapd, and diagnostic tools like iperf and tcpdump. These packages are required for the OpenWIFI environment to function correctly. ```bash sudo apt-get -y install isc-dhcp-server cp /root/openwifi/dhcpd.conf /etc/dhcp/dhcpd.conf sudo apt-get -y install hostapd sudo apt-get -y install tcpdump sudo apt-get -y install webfs sudo apt-get -y install iperf sudo apt-get -y install iperf3 sudo apt-get -y install libpcap-dev sudo apt-get -y install bridge-utils ``` -------------------------------- ### Build Onboard Source Tools Source: https://github.com/open-sdr/openwifi/blob/master/doc/img_build_instruction/kuiper.md Compiles the sdrctl, side_ch_ctl, and 802.11 injection tools from source. Requires development libraries like libnl-3-dev to be installed beforehand. ```bash sudo apt-get -y install libnl-3-dev sudo apt-get -y install libnl-genl-3-dev cd /root/openwifi/sdrctl_src make clean make cp sdrctl ../ cd /root/openwifi/side_ch_ctl_src/ gcc -o side_ch_ctl side_ch_ctl.c cp side_ch_ctl ../ cd /root/openwifi/inject_80211/ make clean make cd .. ``` -------------------------------- ### Example TX Log Output Source: https://github.com/open-sdr/openwifi/blob/master/doc/README.md A sample log entry generated by the openwifi_tx function, detailing packet size, rate, frame control, and addressing information. ```text sdr,sdr openwifi_tx: 70B RC0 10M FC0040 DI0000 ADDRffffffffffff/6655443322aa/ffffffffffff flag4001201e QoS00 SC20_1 retr1 ack0 prio0 q0 wr19 rd18 ``` -------------------------------- ### Example RX Log Output Source: https://github.com/open-sdr/openwifi/blob/master/doc/README.md A sample log entry from the openwifi_rx_interrupt function, detailing received packet size, rate, signal strength, and FCS status. ```text sdr,sdr openwifi_rx: 270B ht0aggr0/0 sgi0 240M FC0080 DI0000 ADDRffffffffffff/00c88b113f5f/00c88b113f5f SC2133 fcs1 buf_idx10 -78dBm ``` -------------------------------- ### Initialize and Enable IQ Capture on OpenWiFi SDR Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/iq.md Commands to initialize the side channel driver and enable IQ capture on the SDR board. These commands configure the data source and start the capture process. ```bash insmod side_ch.ko iq_len_init=8187 ./side_ch_ctl wh3h01 ./side_ch_ctl wh11d4094 ./side_ch_ctl g ``` -------------------------------- ### Get and Set Parameters using sdrctl Source: https://github.com/open-sdr/openwifi/blob/master/doc/README.md These commands allow users to retrieve or modify specific hardware and slicing parameters for the openwifi interface. The 'set' command requires a parameter name and a value, while 'get' requires only the parameter name. ```bash sdrctl dev sdr0 get para_name sdrctl dev sdr0 set para_name value ``` -------------------------------- ### Example TX Interrupt Log Output Source: https://github.com/open-sdr/openwifi/blob/master/doc/README.md A sample log entry from the openwifi_tx_interrupt function, showing transmission results, sequence numbers, and FPGA queue status. ```text sdr,sdr openwifi_tx_interrupt: tx_result [nof_retx 1 pass 1] SC20 prio0 q0 wr20 rd19 num_slot0 cw0 hwq len00000000 no_room_flag0 ``` -------------------------------- ### Run IQ Capture with Non-Monitor Modes Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/iq.md This section explains how to initiate IQ capture when OpenWifi is operating in modes other than monitor mode, such as AP-Client or ad-hoc. After establishing communication, use the provided commands to start IQ data extraction. ```bash insmod side_ch.ko ``` ```bash ./side_ch_ctl g ``` -------------------------------- ### Load OpenWifi Driver with Options Source: https://context7.com/open-sdr/openwifi/llms.txt Demonstrates how to load the openwifi driver module ('sdr.ko') with various configuration options. Options include enabling AMPDU aggregation ('test_mode=1') and setting initial transmit attenuation ('init_tx_att'). The 'wgd.sh' script can also be used to load modules with test mode enabled. ```bash insmod sdr.ko insmod sdr.ko test_mode=1 insmod sdr.ko init_tx_att=20000 insmod sdr.ko test_mode=1 init_tx_att=10000 ./wgd.sh 1 ``` -------------------------------- ### Connect as WiFi Client Source: https://context7.com/open-sdr/openwifi/llms.txt Connects the OpenWiFi board to an existing wireless network using wpa_supplicant and dhclient. ```bash cd openwifi ./wgd.sh ifconfig sdr0 up iwlist sdr0 scan wpa_supplicant -i sdr0 -c wpa-openwifi.conf & dhclient sdr0 ping 192.168.13.1 ``` -------------------------------- ### Configure Conditional CSI Capture Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/csi.md Examples of using side_ch_ctl to filter captured packets based on MAC addresses or Frame Control fields. ```bash # Capture only packets from specific MAC address ./side_ch_ctl wh1h4001 ./side_ch_ctl wh7h01ece28f ./side_ch_ctl g # Turn on FC only match ./side_ch_ctl wh1h1001 # Turn on both FC and addr1 match ./side_ch_ctl wh1h3001 # Set custom capture interval (N*1ms) ./side_ch_ctl gN ``` -------------------------------- ### Initialize OpenWiFi NIC Source: https://context7.com/open-sdr/openwifi/llms.txt Initializes the OpenWiFi network interface by loading the FPGA bitstream and kernel modules. This is a prerequisite for all other operations. ```bash ssh root@192.168.10.122 cd openwifi ./wgd.sh ./wgd.sh 1 ``` -------------------------------- ### Display IQ Samples on Host PC Source: https://context7.com/open-sdr/openwifi/llms.txt This snippet shows how to capture and display IQ samples on the host PC using a Python script. It requires the 'iq_capture.py' script from the 'openwifi/user_space/side_ch_ctl_src' directory. The script can optionally take an argument for smaller FPGAs. ```bash cd openwifi/user_space/side_ch_ctl_src python3 iq_capture.py ``` ```bash python3 iq_capture.py 4095 ``` -------------------------------- ### Setup Ad-hoc Mode Network Source: https://context7.com/open-sdr/openwifi/llms.txt This functionality configures peer-to-peer ad-hoc networking between two SDR boards. It involves running specific scripts on each board to create and join an ad-hoc network, enabling direct communication between them. ```bash cd openwifi ./wgd.sh ./sdr-ad-hoc-up.sh ``` ```bash cd openwifi ./wgd.sh ./sdr-ad-hoc-join.sh ``` -------------------------------- ### Initiate IQ Capture with Python Script Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/iq_2ant.md This snippet shows how to run a Python script on the computer to capture I/Q data. The script `iq_capture_2ant.py` is executed with the number of samples as an argument, which should correspond to the `iq_len_init` value set during module loading. This script is responsible for the actual data acquisition and processing. ```python openwifi/user_space/side_ch_ctl_src/python3 iq_capture_2ant.py 511 ``` -------------------------------- ### Compile OpenWifi Driver and User Space Program Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/iq.md These commands compile the side channel kernel module (side_ch.ko) and the user-space control utility (side_ch_ctl). ARCH_BIT should be set to 32 for Zynq 7000 and 64 for Zynq MPSoC. ```bash $OPENWIFI_DIR/driver/side_ch/make_driver.sh $OPENWIFI_DIR $XILINX_DIR ARCH_BIT ``` ```bash gcc -o side_ch_ctl side_ch_ctl.c ``` -------------------------------- ### Rebuild U-Boot for ADRV9361Z7035 Source: https://github.com/open-sdr/openwifi/blob/master/doc/known_issue/notter.md Steps to clone the Xilinx U-Boot repository, configure the build environment, and compile the U-Boot binary to fix memory size detection issues. ```bash git clone https://github.com/analogdevicesinc/u-boot-xlnx.git cd u-boot-xlnx source environment_setting.sh export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- make zynq_adrv9361_defconfig make -j8 make u-boot.elf ``` -------------------------------- ### Deploy and Test DMA Drivers on Hardware Source: https://github.com/open-sdr/openwifi/blob/master/driver/xilinx_dma/README.md A sequence of shell commands to remove existing modules, download updated drivers via FTP, and insert them into the kernel to verify functionality via dmesg. ```bash rm axidmatest.ko wget ftp://192.168.10.1/driver/xilinx_dma/axidmatest.ko rm ddc.ko wget ftp://192.168.10.1/driver/ddc/ddc.ko rm xilinx_dma.ko wget ftp://192.168.10.1/driver/xilinx_dma/xilinx_dma.ko rmmod axidmatest rmmod ddc rmmod xilinx_dma insmod xilinx_dma.ko insmod ddc.ko insmod axidmatest.ko dmesg -c ``` -------------------------------- ### Update FPGA and Driver using On-Board Scripts Source: https://github.com/open-sdr/openwifi/blob/master/README.md Provides scripts for updating FPGA and driver files directly on the board. This involves setting up an FTP server on the PC and using on-board scripts to download and apply the updates. A power cycle is recommended after updating boot files. ```bash # On board: # ./sdcard_boot_update.sh $BOARD_NAME # ./wgd.sh remote ``` -------------------------------- ### Access Board Disk/Rootfs via SFTP Source: https://github.com/open-sdr/openwifi/blob/master/README.md Explains how to access the target board's disk or root filesystem from a PC using SFTP (SSH File Transfer Protocol). This allows for file management similar to a local disk. ```bash # On PC: # File manager --> Connect to Server... # Input: sftp://root@192.168.10.122/root # Password: openwifi ``` -------------------------------- ### Compile OpenWIFI Driver Source: https://github.com/open-sdr/openwifi/blob/master/README.md Compiles the latest OpenWIFI driver. This script requires the Xilinx directory and architecture bitness as arguments. Additional arguments can be passed to define preprocessor macros for conditional compilation. ```bash cd openwifi/driver; ./make_all.sh $XILINX_DIR ARCH_BIT ``` -------------------------------- ### Generate Xilinx DMA Driver and Test Programs Source: https://github.com/open-sdr/openwifi/blob/master/driver/xilinx_dma/README.md Shell scripts used to build the customized Xilinx DMA driver and the associated test program for the OpenWiFi platform. ```bash ./make_xilinx_dma.sh ./make_xilinx_dma_test.sh ``` -------------------------------- ### Build inject_80211 Program Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/inject_80211.md Instructions to compile the inject_80211 userspace program, which allows for injecting 802.11 packets through mac80211 supported wireless devices. ```bash cd openwifi/inject_80211 make ``` -------------------------------- ### Inject Arbitrary IQ Samples Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/frequent_trick.md Procedure for injecting custom IQ data into the transmission interface for testing. Requires setting up loopback mode, configuring FPGA triggers, and using helper scripts to write data to the driver sysfs. ```bash insmod side_ch.ko iq_len_init=8187 ./sdrctl dev sdr0 set reg xpu 13 1 ./side_ch_ctl wh11d100 ./side_ch_ctl wh8d3 ./side_ch_ctl wh5h4 ./side_ch_ctl g0 python3 iq_capture.py 8187 ./tx_intf_iq_data_to_sysfs.sh ./tx_intf_iq_send.sh ``` -------------------------------- ### Switching to HLS branch for openofdm_rx Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/hls.md This snippet demonstrates how to checkout the HLS-enabled branch for the openofdm_rx module, which is necessary for using HLS-generated receiver components. ```bash cd ip/openofdm_rx git checkout dot11zynq_hls ``` -------------------------------- ### Build and Use 802.11 Packet Injection Tool Source: https://context7.com/open-sdr/openwifi/llms.txt This functionality allows for the injection of custom 802.11 frames for testing and fuzzing. It involves building the 'inject_80211' tool on the SDR board, setting up monitor mode, and then injecting packets with specified parameters. The tool supports various hardware modes, rates, packet types, and sizes. ```bash cd openwifi/inject_80211 make cd ~/openwifi ./wgd.sh ./monitor_ch.sh sdr0 11 ./inject_80211/inject_80211 -m n -r 0 -n 10 -s 64 sdr0 ``` -------------------------------- ### Capture TX IQ Data in Trigger Mode Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/iq_2ant.md This section outlines the process for capturing Transmit (TX) I/Q data using OpenWiFi in a trigger mode. It requires setting up a scenario where OpenWiFi performs transmission, such as AP mode or packet injection. The commands configure the side channel module and initiate the capture process. ```bash cd openwifi ./fosdem.sh insmod side_ch.ko iq_len_init=511 ./side_ch_ctl wh11d1 ./side_ch_ctl wh8d16 ./side_ch_ctl wh5h2 ./side_ch_ctl wh3h11 ./side_ch_ctl g1 ``` ```python openwifi/user_space/side_ch_ctl_src/python3 iq_capture_2ant.py 511 ``` -------------------------------- ### Update Drivers .ko Files to Board Source: https://github.com/open-sdr/openwifi/blob/master/README.md Updates the driver .ko files to the target board. This involves compiling the drivers on the host PC and then transferring them using a provided script. On-board scripts are then used to populate these drivers. ```bash # On host PC: # ./make_all.sh (in the driver directory) # ./transfer_driver_userspace_to_board.sh # On board (in /root/): # ./populate_driver_userspace.sh ``` -------------------------------- ### Transfer OpenWIFI Driver Files to Board Source: https://github.com/open-sdr/openwifi/blob/master/README.md Copies the compiled OpenWIFI driver files (.ko) from the host PC to the target board using SSH (SCP). The destination directory on the board is 'openwifi/'. ```bash cd openwifi/driver; scp `find ./ -name \*.ko` root@192.168.10.122:openwifi/ ``` -------------------------------- ### Load OpenWiFi Driver with Test Mode Source: https://github.com/open-sdr/openwifi/blob/master/doc/README.md Configures the OpenWiFi kernel driver during module insertion to enable experimental features like AMPDU aggregation. The test_mode parameter is defined as a global static variable in sdr.c. ```bash insmod sdr.ko test_mode=value ``` -------------------------------- ### Use Helper Script for Time Slicing Configuration Source: https://context7.com/open-sdr/openwifi/llms.txt This command utilizes a helper script to simplify the configuration of time slicing parameters. The 'slice_cfg.sh' script likely automates the process of setting up multiple slices and their associated parameters. ```bash ./slice_cfg.sh ``` -------------------------------- ### Inject 802.11n Packets with Varying Rates and Sizes (Bash) Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/inject_80211.md This bash script automates the injection of 100 802.11n packets. It iterates through different bitrates and payload sizes, sending packets using the 'inject_80211' tool. The script requires the 'inject_80211' utility and configures the monitor interface 'mon0'. ```bash #!/bin/bash HW_MODE='n' COUNT=100 DELAY=1000 RATE=( 0 1 2 3 4 5 6 7 ) SIZE=( $(seq -s' ' 50 100 1450) ) # paload size in bytes IF="mon0" for (( i = 0 ; i < ${#PAYLOAD[@]} ; i++ )) do for (( j = 0 ; j < ${#RATE[@]} ; j++ )) do inject_80211 -m $HW_MODE -n $COUNT -d $DELAY -r ${RATE[$j]} -s ${SIZE[$i]} $IF sleep 1 done done ``` -------------------------------- ### FPGA Dynamic Reloading Process Source: https://context7.com/open-sdr/openwifi/llms.txt This section outlines the process for dynamically reloading the FPGA bitstream without rebooting the SDR board. It involves generating a '.bit.bin' file from an '.xsa' file on the host PC, transferring it to the board, and then reloading the FPGA image using provided scripts. ```bash export XILINX_DIR=/opt/Xilinx export BOARD_NAME=zc706_fmcs2 cd openwifi/user_space ./boot_bin_gen.sh $XILINX_DIR $BOARD_NAME /path/to/system_top.xsa scp system_top.bit.bin root@192.168.10.122:openwifi/ cd openwifi ./wgd.sh ./load_fpga_img.sh system_top.bit.bin ``` -------------------------------- ### Visualize CSI Data with Python Source: https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/csi.md Command to run the Python script for real-time visualization of frequency offset, channel state, and constellation diagrams. ```python cd openwifi/user_space/side_ch_ctl_src python3 side_info_display.py ``` -------------------------------- ### Configure CCA and LBT Thresholds Source: https://context7.com/open-sdr/openwifi/llms.txt Manages Clear Channel Assessment and Listen Before Talk sensitivity thresholds to control channel access behavior. ```bash # Override LBT threshold to -70dBm ./set_lbt_th.sh 70 # Disable CCA ./set_lbt_th.sh 1 # Return to automatic driver control ./set_lbt_th.sh 0 ```