xref: /openwifi/doc/app_notes/radar-self-csi.md (revision a4eb20013ddf8dbd45101a9bef191ae7b3c4f3be)
1*a4eb2001SXianjun Jiao<!--
2*a4eb2001SXianjun JiaoAuthor: Xianjun jiao
3*a4eb2001SXianjun JiaoSPDX-FileCopyrightText: 2019 UGent
4*a4eb2001SXianjun JiaoSPDX-License-Identifier: AGPL-3.0-or-later
5*a4eb2001SXianjun Jiao-->
6*a4eb2001SXianjun Jiao
7*a4eb2001SXianjun JiaoOne 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.
8*a4eb2001SXianjun Jiao ![](./openwifi-radar.jpg)
9*a4eb2001SXianjun Jiao
10*a4eb2001SXianjun Jiao## Quick start
11*a4eb2001SXianjun Jiao- Power on the SDR board.
12*a4eb2001SXianjun 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:
13*a4eb2001SXianjun Jiao  ```
14*a4eb2001SXianjun Jiao  ssh [email protected]
15*a4eb2001SXianjun Jiao  (password: openwifi)
16*a4eb2001SXianjun Jiao  cd openwifi
17*a4eb2001SXianjun Jiao  ./fosdem.sh
18*a4eb2001SXianjun Jiao  (After the AP started by above command, you can connect a WiFi client to this openwifi AP)
19*a4eb2001SXianjun Jiao  (Or setup other scenario according to your requirement)
20*a4eb2001SXianjun Jiao  ./ifconfig
21*a4eb2001SXianjun Jiao  (Write down the openwifi AP MAC address. For example 66:55:44:33:22:5a)
22*a4eb2001SXianjun Jiao  insmod side_ch.ko num_eq_init=0
23*a4eb2001SXianjun Jiao  ./side_ch_ctl wh1h4001
24*a4eb2001SXianjun Jiao  ./side_ch_ctl wh7h4433225a
25*a4eb2001SXianjun Jiao  (Above two commands ensure receiving CSI only from XX:XX:44:33:22:5a. In this case, it is the openwifi self-TX)
26*a4eb2001SXianjun Jiao  ./sdrctl dev sdr0 set reg xpu 1 1
27*a4eb2001SXianjun Jiao  (Above unmute the baseband self-receiving to receive openwifi own TX signal/packet)
28*a4eb2001SXianjun Jiao  ./side_ch_ctl g0
29*a4eb2001SXianjun Jiao  ```
30*a4eb2001SXianjun Jiao  You should see on board outputs like:
31*a4eb2001SXianjun Jiao  ```
32*a4eb2001SXianjun Jiao  loop 64 side info count 4
33*a4eb2001SXianjun Jiao  loop 128 side info count 5
34*a4eb2001SXianjun Jiao  ...
35*a4eb2001SXianjun Jiao  ```
36*a4eb2001SXianjun Jiao  If the second number (4, 5, ...) keeps increasing, that means the CSI is going to the computer smoothly.
37*a4eb2001SXianjun Jiao
38*a4eb2001SXianjun Jiao- On your computer (NOT ssh onboard!), run:
39*a4eb2001SXianjun Jiao  ```
40*a4eb2001SXianjun Jiao  cd openwifi/user_space/side_ch_ctl_src
41*a4eb2001SXianjun Jiao  python3 side_info_display.py 0
42*a4eb2001SXianjun Jiao  ```
43*a4eb2001SXianjun Jiao  The python script needs "matplotlib.pyplot" and "numpy" packages installed. Now you should see figures showing run-time **CSI** and **frequency offset**. Meanwhile the python script prints the **timestamp**.
44*a4eb2001SXianjun Jiao  ![](./csi-screen-shot-radar.jpg)
45*a4eb2001SXianjun Jiao
46*a4eb2001SXianjun 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(0) in Matlab.
47*a4eb2001SXianjun Jiao  ![](./csi-screen-shot-radar-matlab.jpg)
48*a4eb2001SXianjun Jiao
49*a4eb2001SXianjun JiaoPlease learn the python and Matlab script for CSI data structure per packet according to your requirement.
50*a4eb2001SXianjun Jiao
51*a4eb2001SXianjun JiaoDo read the [normal CSI app note](csi.md) to understand the basic implementation architecture.
52