这是用户在 2024-11-19 16:33 为 https://github.com/open-sdr/openwifi/blob/master/doc/app_notes/csi.md 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
set 限制解除
Skip to content
Open in github.dev Open in a new github.dev tab Open in codespace

Files

Latest commit

c95ab58 · Oct 8, 2023

History

History
137 lines (116 loc) · 6.67 KB

csi.md

File metadata and controls

137 lines (116 loc) · 6.67 KB

We extend the CSI (Channel State Information) to CSI (Chip State Information)!
我们将CSI(信道状态信息)扩展到CSI(芯片状态信息)!

(This app note shows general CSI collection. To use self-Tx CSI in full duplex mode as RADAR, please refer to WiFi CSI radar via self CSI capturing)
(此应用说明显示一般的 CSI 收集。要在全双工模式下使用自我 Tx CSI 作为RADAR,请参考通过自我 CSI 捕获的 WiFi CSI 雷达

Quick start 快速入门

  • Power on the SDR board.
    打开 SDR 板。

  • 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:
    通过以太网电缆将计算机连接到 SDR 板。计算机应具有静态 IP 192.168.10.1。在计算机上打开终端,然后在终端中:

    ssh root@192.168.10.122
    (password: openwifi)
    cd openwifi
    ./wgd.sh
    (Wait for the script completed)
    ./monitor_ch.sh sdr0 11
    (Monitor on channel 11. You can change 11 to other channel that is busy)
    insmod side_ch.ko
    ./side_ch_ctl g
    

    You should see on board outputs like:
    您应该在板上看到如下输出:

    loop 64 side info count 61
    loop 128 side info count 99
    ...
    

    If the second number (61, 99, ...) is not zero and keeps increasing, that means the CSI (Chip State Information) is going to the computer smoothly.
    如果第二个数字(61,99,...)不是零并且持续增加,这意味着 CSI(芯片状态信息)正在顺利传输到计算机。

  • On your computer (NOT in ssh!), run:
    在你的电脑上(不是在 ssh 中!),运行:

    cd openwifi/user_space/side_ch_ctl_src
    python3 side_info_display.py
    

    The python script needs "matplotlib.pyplot" and "numpy" packages installed. Now you should see 3 figures showing run-time frequency offset, channel state/response and constellation form equalizer. Meanwhile the python script prints the timestamp.
    该 python 脚本需要安装“matplotlib.pyplot”和“numpy”包。现在您应该看到 3 个图形显示运行时频率偏移信道状态/响应星座形式均衡器。同时,python 脚本打印时间戳

    While running, all information is also stored into a file side_info.txt. A matlab script test_side_info_file_display.m is offered to help you do analysis on the Chip State Information offline.
    在运行时,所有信息也会存储到文件 side_info.txt 中。提供了一个 Matlab 脚本 test_side_info_file_display.m 来帮助您离线分析芯片状态信息。

Understand the CSI feature
了解 CSI 功能

The CSI information is extracted via the openwifi side channel infrastructure. This figure explains the related modules (also related source code file name) and how the information goes from the SDR board to the computer.
CSI 信息是通过 openwifi 侧信道基础设施提取的。该图解释了相关模块(也包括相关源代码文件名)以及信息如何从 SDR 板传输到计算机。

The CSI information format is shown in this figure.
该 CSI 信息格式如图所示。

For each element, the actual size is 64bit.
对于每个元素,实际大小为 64 位。

  • timestamp: 64bit TSF timer value, which is the same timestamp value shown by other sniffer software, like tcpdump, wireshark or openwifi printing in dmesg.
    时间戳:64 位 TSF 计时器值,与其他嗅探软件(如 tcpdump、wireshark 或在 dmesg 中打印的 openwifi)显示的时间戳值相同。
  • freq_offset: Only the 1st 16bit is used.
  • csi (channel state/response) and equalizer: Only the first two 16bit are used for I/Q of channel response and equalizer output. The remaining two 16bit are reserved for future multi-antenna cases.
    csi(信道状态/响应)和均衡器:仅使用前两个 16 位用于信道响应和均衡器输出的 I/Q。剩余的两个 16 位保留用于未来的多天线情况。

The python and Matlab scripts are recommended for you to understand the CSI packet format precisely.
建议您使用 Python 和 Matlab 脚本来准确理解 CSI 数据包格式。

Config the capture condition and interval
配置捕获条件和间隔

The quick start guide will monitor all CSI information of all packets decoded by the WiFi ofdm receiver. To monitor only specific packets that match the specific conditions: FC (Frame Control), addr1 (target MAC address), addr2 (source MAC address), configuration command should be issued before executing "side_ch_ctl g". The configuration command is realized by feeding a different parameter to "side_ch_ctl".
快速入门指南将监控 WiFi OFDM 接收器解码的所有数据包的所有 CSI 信息。要仅监控符合特定条件的特定数据包:FC(帧控制)、addr1(目标 MAC 地址)、addr2(源 MAC 地址),应在执行"side_ch_ctl g"之前发出配置命令。配置命令通过向"side_ch_ctl"提供不同的参数来实现。

A quick example: Capture only CSI of those packets from the device with MAC address 56:5b:01:ec:e2:8f
仅捕获来自 MAC 地址为 56:5b:01:ec:e2:8f 的设备的那些数据包的 CSI

./side_ch_ctl wh1h4001
./side_ch_ctl wh7h01ece28f
(01ece28f are the last 32 bits of MAC address 56:5b:01:ec:e2:8f)
./side_ch_ctl g

The parameter string format is explained in detail:
参数字符串格式详细说明:

whXhY

The X is the register index, and the Y is the value in hex format. The remaining "w", "h" and "h" should be kept untouched.
X 是寄存器索引,Y 是十六进制格式的值。其余的"w"、"h"和"h"应保持不变。

  • To turn on conditional capture, X should be 1. For Y: bit11~bit0 should be 001(hex), bit12: on/off of FC match, bit13: on/off of addr1 match, bit14 : on/off of addr2 match. Examples:
    要开启条件捕获,X 应为 1。对于 Y:bit11~bit0 应为 001(十六进制),bit12:FC 匹配的开/关,bit13:addr1 匹配的开/关,bit14:addr2 匹配的开/关。示例:
Turn on FC only match:
./side_ch_ctl wh1h1001
(1001 is the value in hex format)
Turn on addr2 (source address) only match:
./side_ch_ctl wh1h4001

Turn on both FC and addr1 (target address) match:
./side_ch_ctl wh1h3001

Turn off conditional capture (all packets will be captured):
./side_ch_ctl wh1h0001
  • To specify the condition matching target (when that type of match is turned on by above command):
    要指定条件匹配目标(当上述命令启用该类型匹配时):
Specify the FC matching target:
./side_ch_ctl wh5hY
(Y is the FC value in hex format)
Specify the addr1 (target address) matching target:
./side_ch_ctl wh6hY

Specify the addr2 (source address) matching target:
./side_ch_ctl wh7hY
(Y is the MAC address in hex format. Only the last 32 bits are needed. Example: for 56:5b:01:ec:e2:8f, 01ece28f should be input.)

The command "side_ch_ctl g" will perform CSI capture every 100ms until you press ctrl+C. To use a different capture interval:
命令 "side_ch_ctl g" 将每 100 毫秒执行一次 CSI 捕获,直到您按下 ctrl+C。要使用不同的捕获间隔:

side_ch_ctl gN

The interval will become N*1ms
间隔将变为 N*1 毫秒

Config the num_eq

The num_eq (number of equalizer output) is configurable in case you don't need so many equalizer information. The valid value is 0~8. You should align the num_eq value at the side_ch.ko, side_info_display.py and test_side_info_file_display.m.
num_eq(均衡器输出数量)是可配置的,以防您不需要那么多均衡器信息。有效值为 0~8。您应该在 side_ch.ko、side_info_display.py 和 test_side_info_file_display.m 中对齐 num_eq 值。

  • When insert the kernel module, use:
    当插入内核模块时,请使用:
insmod side_ch.ko num_eq_init=3

You can replace 3 by number 0~8. (8 is the default value. You don't need to specify it like in the Quick start section)
您可以将 3 替换为数字 0~8。(8 是默认值。您不需要像在快速入门部分那样指定它)

  • When launch the python script, use:
    当启动 Python 脚本时,请使用:
side_info_display.py 3
  • When use the Matlab script, please change the num_eq variable in the script to 3 (3 is just an example).
    使用 Matlab 脚本时,请将脚本中的 num_eq 变量更改为 3(3 只是一个示例)。

Compile the side channel driver and user space program
编译侧信道驱动程序和用户空间程序

  • side_ch.ko
$OPENWIFI_DIR/driver/side_ch/make_driver.sh $OPENWIFI_DIR $XILINX_DIR ARCH_BIT
(For Zynq 7000, ARCH_BIT should be 32, for Zynq MPSoC, ARCH_BIT should be 64)
  • side_ch_ctl (take user_space/side_ch_ctl_src/side_ch_ctl.c and compile it on board!)
gcc -o side_ch_ctl side_ch_ctl.c

Run the CSI together with modes other than monitor
与监视模式以外的模式一起运行 CSI

The openwifi CSI feature could run with not only monitor mode but also other modes, such as AP-Client or ad-hoc mode. After the communication functionality is fully up in those modes, you can start CSI feature from "insmod side_ch.ko" and "./side_ch_ctl g" on board as described in the previous sections to extract CSI to your computer.
openwifi CSI 功能不仅可以在监视模式下运行,还可以在其他模式下运行,例如 AP-Client 或临时模式。在这些模式下通信功能完全启动后,您可以从 "insmod side_ch.ko" 和 "./side_ch_ctl g" 开始 CSI 功能,如前面章节所述,将 CSI 提取到您的计算机上。

Map the CSI information to the WiFi packet
将 CSI 信息映射到 WiFi 数据包

Please check this discussion: #344
请检查此讨论: #344

If you want to relate the CSI information to the WiFi packet, you need to capture WiFi packets (tcpdump/wireshark/etc) while capturing CSI. Then you can match the timestamp (TSF timer value) between WiFi packet and CSI information, because this is the unique same identity of a Wifi packet and related CSI information.
如果您想将 CSI 信息与 WiFi 数据包关联起来,您需要在捕获 CSI 的同时捕获 WiFi 数据包(tcpdump/wireshark 等)。然后,您可以在 WiFi 数据包和 CSI 信息之间匹配时间戳(TSF 计时器值),因为这是 WiFi 数据包和相关 CSI 信息的唯一相同标识。

Please learn the python and Matlab script to extract CSI information per packet according to your requirement.
请学习 Python 和 Matlab 脚本,以根据您的要求提取每个数据包的 CSI 信息。

openwifi/doc/app_notes/csi.md at master · open-sdr/openwifi