nexmon_csi icon indicating copy to clipboard operation
nexmon_csi copied to clipboard

How can I distiguish the CSI data of the 4 antenna's on the ASUS RT AC86U?

Open GerbenGheysens opened this issue 3 years ago • 12 comments

When I collected some CSI data on the router (4x4) I only got 1 vector in the matlab code. Is there a possibility to distinguish which data is coming from which antenna?

GerbenGheysens avatar Jun 24 '21 14:06 GerbenGheysens

https://github.com/seemoo-lab/nexmon_csi#analyzing-the-csi

The next two bytes contain core and spatial stream number where the lowest three bits indicate the core and the next three bits the spatial stream number, e.g. 0x0019 (0b00011001) means core 0 and spatial stream 3.

Maybe you can use this?

Also please check if all the 4 antennas are indeed 5 GHz. I suspect 2 of them are 2.4 GHz, and 2 are 5 GHz. Jet - @yujianyuanhaha, opened up the router, and has a better idea. Here is the thread: https://github.com/seemoo-lab/nexmon_csi/issues/199

zeroby0 avatar Jun 24 '21 19:06 zeroby0

Thanks for your response, with the provide matlab code it looks like there is just one vector provided. Do you know how I can get the splitted values (the vector from each antenna) with the matlab code?

GerbenGheysens avatar Jun 25 '21 12:06 GerbenGheysens

Packets from all the antennas are in one file, and are read into one vector. Also, you have to enable csi collection for all antennas using makecsiparams. I don't think the matlab script provides ways to distinguish the antennas though. Checkout csikit by @Gi-z.

zeroby0 avatar Jun 27 '21 07:06 zeroby0

@GerbenGheysens

It is pretty easy, in matlab it is like

payloadbytes = typecast(payload,'uint8');
if strcmp(DEVICE,'ASUS')
    
    core = bitand(payloadbytes(56),3); %
    rxss = bitand(bitshift(payloadbytes(56),-3),3);
    Nss(k) = core*4 + rxss;
    
else
    % payloadbytes(55)
    % 0 8 16 24
   % for NEXUS phone and PI
    Nss(k) =  round( payloadbytes(55)/8);
end

right after line 36 at csireader.m

Best

Jet

yujianyuanhaha avatar Jun 28 '21 14:06 yujianyuanhaha

How to setup at the TX and RX router for collected some CSI data on the router (4x4) on ASUS RT AC86U @yujianyuanhaha @zeroby0 Thanks

ozawali avatar Jun 29 '21 06:06 ozawali

@ozawali command like ./makecsiparams -c 100/80 -C 0xf -N 0xf -m MAC_ADDR -b 0x88 is good to go.

yujianyuanhaha avatar Jun 29 '21 14:06 yujianyuanhaha

@yujianyuanhaha Thanks. I use your code, but the rxcore is always zeros. Or I want to know the frame structure is ok.

ozawali avatar Jun 30 '21 01:06 ozawali

Has anyone already managed to get the separate CSI-data vectors from each antenna?

GerbenGheysens avatar Jul 05 '21 12:07 GerbenGheysens

Same question here. @GerbenGheysens @ozawali @zeroby0 , I found it is difficult to distinguish which core 1 packet is coming with which core 0 packet corresponding to the same frame. Any Ideas?

haochenku avatar Jul 12 '21 08:07 haochenku

I want to do some AoA on 2.4GHz with the router and my iPhone. Is it correct to set the parameters as follows: -C 15 -N1 -m(MAC address) I already found out that the internal antenna is only for 5GHz so this will give all zero's and I've placed the antennas closer to each other (half wavelength).

GerbenGheysens avatar Jul 29 '21 08:07 GerbenGheysens

Was on holiday when this discussion was active, but I've just pushed an update (and a subsequent one) to CSIKit which collates CSI for the same frame from multiple spatial streams into one matrix. The implementation is a little work-in-progress in how it's relayed to the user since the real core/spatial stream functionality is not identical to that of the likes of Intel/Atheros CSI tools where dimensions refer to Rx/Tx antennas (As far as I'm aware! If you know better, I'd love to hear more!).

image

For now, it does function in its current state. For more detail on the implementation, this source file is loosely based on the MATLAB csireader implementation provided by Seemoo.

For reference for anyone implementing this themselves: the "sequence number" in the payload header will indicate the frame for which CSI was captured. Note that when multiple cores/spatial streams are active, this number will remain the same across a number of frames synchronous with your number of active cores * spatial streams. The core/spatial stream bitmask in bytes 12 and 13 will detail which core/spatial stream the frame was received on.

Any feedback is appreciated, as I'd like to make sure we've all got this worked out.

Gi-z avatar Jul 29 '21 23:07 Gi-z

Hi Anyone knows how to change regulations file in asus patch, I am only able to listen to channel 36 at 5GHz?

nisarnabeel avatar Sep 22 '22 07:09 nisarnabeel