seemoo-lab / nexmon_csi

Channel State Information Extraction on Various Broadcom Wi-Fi Chips
309 stars 121 forks source link

Is there the information about interpretation of extracted CSI data? #368

Closed Urb1101 closed 22 hours ago

Urb1101 commented 1 day ago

Hello, I dont know structure of CSI data from nexmon extractor. that looks consist of 16 bytes info about each packet, 64bytes offset(this seems to have source MAC address) and payloads(the number of bytes is defined as 'NFFTS' in csireader.m). In this page, its said that payloads contain int16 imaginary part and int16 real part, in addition, I think that the first half have real part each subcarrier and the letter half have imaginary part each subcarrier. I interpreted these by reading csireader.m and plotcsi but I want to know correct structure. someone know about this or where I can find infomation?

sorry for my bad english and knowledge.

jlinktu commented 23 hours ago
Urb1101 commented 23 hours ago

thank you for nice information. but I only got rough info about format from README and already knew each CHIP has different processing by reading readcsi.m . especially I want to know payload part format in detail for me to separate that each subcarrier, where can I get detail? for example, I think that 'csi_buffer' in csireader.m before executing reshape(2,:) has this matrix↓ [subcarrier1 real, subcarrier2 real,... subcarrierN real, subcarrier1 imaginary, cubcarrier2 imaginary...subcarrierN imaginary] in each row, and ultimately that become [subcarrier1 real+imaginary, subcarrier2 real+imaginary,... subcarrierN real+imaginary] in each row, and whether which is correct is What I want to know.

I apologize for complex explaining.

jlinktu commented 22 hours ago

The code should be self-explaining.. Hout before reshape (line 48) is a one-dimensional vector holding interleaved real and imaginary parts for each subcarrier. After reshape, Hout is two-dimensional, where the first dimension holds real parts over all subcarriers and the sceond dimension holds respective imaginary parts. Hence, each row resembles one subcarrier. In line 49, real and imaginary parts are combined to form a complex value for each ob the subcarriers. In line 50, the complex values of all subcarrier are assigned to one row of csi_buff. Therefore, after executing the script, each row of csi_buff holds complex values of one extraction, where each columns represents one subcarrier.

Urb1101 commented 22 hours ago

your explaining is almost same as mine and thats what I wanted to check. thank you for your corresponding! im glad if you let me know where "a one-dimensional vector holding interleaved real and imaginary parts for each subcarrier" generate.(thats ok if possible)

jlinktu commented 21 hours ago

im glad if you let me know where "a one-dimensional vector holding interleaved real and imaginary parts for each subcarrier" generate.(thats ok if possible)

For bcm4339 and bcm43455c0 this is done in line 39 by typecasting the payload into int16 values. For bcm4358 and bcm4366c0 it is done by converting the payload from floating point format to integer values (line 41 and 43). The conversion magic happens in unpack_float.c.

If you wan't to understand this process in more detail please go through the respective code yourself, everything is open-source and can be inspected by you. :)