1a4eb2001SXianjun Jiao<!-- 2a4eb2001SXianjun JiaoAuthor: Xianjun jiao 3a4eb2001SXianjun JiaoSPDX-FileCopyrightText: 2019 UGent 4a4eb2001SXianjun JiaoSPDX-License-Identifier: AGPL-3.0-or-later 5a4eb2001SXianjun Jiao--> 6a4eb2001SXianjun Jiao 756ab2d85SJiao XianjunOne super power of the openwifi platform is "**Full Duplex**" which means that openwifi baseband can receive its own TX signal. Just like a radar! This brings a unique capability of "**joint radar and communication**" to openwifi. For instance, put two directional antennas to openwifi TX and RX, and the **CSI** (Channel State Information) of the self-TX signal will refect the change of the target object. 8a4eb2001SXianjun Jiao  94559bdd1SXianjun Jiao  10a4eb2001SXianjun Jiao 11*8db64318SJiao Xianjun(See this https://github.com/open-sdr/openwifi/discussions/344 to understand how to map the collected data to the packet via the TSF timestamp) 12*8db64318SJiao Xianjun 13a4eb2001SXianjun Jiao## Quick start 14a4eb2001SXianjun Jiao- Power on the SDR board. 15a4eb2001SXianjun Jiao- Connect a computer to the SDR board via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal: 16a4eb2001SXianjun Jiao ``` 17a4eb2001SXianjun Jiao ssh [email protected] 18a4eb2001SXianjun Jiao (password: openwifi) 193712d8b7SXianjun Jiao ``` 203712d8b7SXianjun Jiao- On computer, build the latest driver and FPGA package after clone/update openwifi and openwifi-hw-img repository: 213712d8b7SXianjun Jiao ``` 223712d8b7SXianjun Jiao export XILINX_DIR=your_Xilinx_install_directory 233712d8b7SXianjun Jiao (Example: export XILINX_DIR=/opt/Xilinx. The Xilinx directory should include sth like: Downloads, Vitis, etc.) 243712d8b7SXianjun Jiao export OPENWIFI_HW_IMG_DIR=your_openwifi-hw-img_directory 253712d8b7SXianjun Jiao (The directory where you get the open-sdr/openwifi-hw-img repo via git clone) 263712d8b7SXianjun Jiao export BOARD_NAME=your_board_name 273712d8b7SXianjun Jiao (Check the BOARD_NAME definitions in README) 283712d8b7SXianjun Jiao 293712d8b7SXianjun Jiao cd openwifi/user_space 303712d8b7SXianjun Jiao ./drv_and_fpga_package_gen.sh $OPENWIFI_HW_IMG_DIR $XILINX_DIR $BOARD_NAME 313712d8b7SXianjun Jiao scp drv_and_fpga.tar.gz [email protected]:openwifi/ 323712d8b7SXianjun Jiao scp ./side_ch_ctl_src/side_ch_ctl.c [email protected]:openwifi/ 333712d8b7SXianjun Jiao scp ./inject_80211/* [email protected]:openwifi/inject_80211/ 343712d8b7SXianjun Jiao ``` 353712d8b7SXianjun Jiao- On SDR board (/root/openwifi directory): 363712d8b7SXianjun Jiao ``` 373712d8b7SXianjun Jiao cd /root/openwifi/ 383712d8b7SXianjun Jiao ./wgd.sh drv_and_fpga.tar.gz 393712d8b7SXianjun Jiao ./monitor_ch.sh sdr0 1 403712d8b7SXianjun Jiao insmod ./drv_and_fpga/side_ch.ko 413712d8b7SXianjun Jiao gcc -o side_ch_ctl side_ch_ctl.c 42a4eb2001SXianjun Jiao ./side_ch_ctl wh1h4001 43a4eb2001SXianjun Jiao ./side_ch_ctl wh7h4433225a 443712d8b7SXianjun Jiao (Above two commands ensure receiving CSI only from XX:XX:44:33:22:5a, which will be set by our own packet injector later) 45a4eb2001SXianjun Jiao ./sdrctl dev sdr0 set reg xpu 1 1 46a4eb2001SXianjun Jiao (Above unmute the baseband self-receiving to receive openwifi own TX signal/packet) 47a4eb2001SXianjun Jiao ./side_ch_ctl g0 48a4eb2001SXianjun Jiao ``` 493712d8b7SXianjun Jiao- Open another ssh session on SDR board: 50a4eb2001SXianjun Jiao ``` 513712d8b7SXianjun Jiao cd /root/openwifi/inject_80211 523712d8b7SXianjun Jiao make 533712d8b7SXianjun Jiao ./inject_80211 -m g -r 4 -t d -e 0 -b 5a -n 99999999 -s 20 -d 1000 sdr0 54a4eb2001SXianjun Jiao 553712d8b7SXianjun Jiao (Above command injects the 802.11a/g packet, for 802.11n packet please use: 563712d8b7SXianjun Jiao ./inject_80211 -m n -r 4 -t d -e 8 -b 5a -n 99999999 -s 20 -d 1000 sdr0) 573712d8b7SXianjun Jiao ``` 583712d8b7SXianjun Jiao- Now you should see the increasing numbers in the previous ssh terminal of the SDR board. 593712d8b7SXianjun Jiao- On your computer (NOT ssh session!), run: 60a4eb2001SXianjun Jiao ``` 61a4eb2001SXianjun Jiao cd openwifi/user_space/side_ch_ctl_src 623712d8b7SXianjun Jiao python3 side_info_display.py 8 waterfall 63a4eb2001SXianjun Jiao ``` 643712d8b7SXianjun Jiao The python script needs "matplotlib.pyplot" and "numpy" packages installed. Now you should see figures showing run-time **CSI**, **CSI waterfall**, **Equalizer out** and **frequency offset**. The following photo shows the CSI change in the waterfall plot when I left my seat in front of two directional antennas (Tx/Rx antenna). 6590a96182SXianjun Jiao  6690a96182SXianjun Jiao 673712d8b7SXianjun Jiao While running, all CSI data is also stored into a file **side_info.txt**. A matlab script **test_side_info_file_display.m** is offered to help you do CSI analysis offline. In this case, run **test_side_info_file_display** in Matlab. 683712d8b7SXianjun Jiao  693712d8b7SXianjun Jiao 70a4eb2001SXianjun JiaoPlease learn the python and Matlab script for CSI data structure per packet according to your requirement. 71a4eb2001SXianjun Jiao 72a4eb2001SXianjun JiaoDo read the [normal CSI app note](csi.md) to understand the basic implementation architecture. 73