Atheros-CSI-Tool-UserSpace-APP icon indicating copy to clipboard operation
Atheros-CSI-Tool-UserSpace-APP copied to clipboard

Processing CSI with matlab

Open Furyt4nk opened this issue 7 years ago • 8 comments

Hi, I had a trouble when I accessed the measured CSI with matlab.

I tried to extract CSI value from the measured CSI binary file, but I failed.

It seems kind of formatting problem.

screenshot from 2018-01-09 16-44-49

It seems work decoding the first packet, but It seems fail to decode from the second packet.

I tried to re-build mex file and run matlab in different environment, but nothing worked.

Here I attach a screenshot.

Is there anything I did wrong or missed?

Furyt4nk avatar Jan 09 '18 07:01 Furyt4nk

I ran into this same issue and solved it.

It seems like the latest version of the file "read_log_file.m" is broken...

If you revert to a previous version of the file https://github.com/xieyaxiongfly/Atheros-CSI-Tool-UserSpace-APP/commit/dbd3efa3c3ae8d56ddaa1f8cb5f1ac792a23ddc3#diff-21823fdb8f8d73dabdef736ad254426f

Then this error will go away and it will work.

The simple fix is on line 46:

endian_format = 'ieee-be'; should be endian_format = 'ieee-le';

justinklchan avatar Mar 04 '18 04:03 justinklchan

Maybe that can help you: https://github.com/brunosoaresds/csi-monitor

brunosoaresds avatar Sep 26 '18 11:09 brunosoaresds

I ran into this same issue and solved it.

It seems like the latest version of the file "read_log_file.m" is broken...

If you revert to a previous version of the file dbd3efa#diff-21823fdb8f8d73dabdef736ad254426f

Then this error will go away and it will work.

The simple fix is on line 46:

endian_format = 'ieee-be'; should be endian_format = 'ieee-le';

Thanks a lot! I am dealing with the same problem, It does work.

zhangdh24 avatar Jan 11 '19 00:01 zhangdh24

Another issue is how to change the frequency to 5G.

shulinyang avatar Jan 21 '19 01:01 shulinyang

@brunosoaresds , how can I use your tool for plotting graph for offline ".dat" files?

army-mehak avatar Apr 19 '19 11:04 army-mehak

I have tried the solution proposed by @zhangdh24. However, this did not work for me. I am using Windows 10 and Matlab 2018a. Here is how I fixed the read_csi.c file and read_log_file.m

In read_csi.c change the following lines, or basically, cast pointers to unsigned int pointers. Then compile the read_csi.c file by typing mex read_csi.c in command window.

nr_p = (unsigned int *) mxGetPr(prhs[1]); nc_p = (unsigned int *) mxGetPr(prhs[2]); num_tones_p = (unsigned int *) mxGetPr(prhs[3]);

Also, you need to revert back to the previous version of read_log_file.m. I tried changing line 46 only as described by @zhangdh24 that did not work. A solution that worked for me is removing line 46 and adding the following from the previous version.

endian_code = fread(f,1,'*ubit8');	
if endian_code == 255	
    endian_format = 'ieee-be';	
elseif endian_code == 0	
    endian_format = 'ieee-le';	
else	
    error('Wrong endian format.');	
end

muhmaz3 avatar Jul 13 '19 23:07 muhmaz3

@zhangdh24 It is not working for me ,altrough its completely running but i am getting the csi_len=0 for all .. and as @muhmaz3 when i try its gives me an error "Wrong endian format"?? Can anyone help?? How should read the CSI matrix?

Parbin avatar Apr 28 '20 08:04 Parbin

@Parbin It has been quite long, but the following solution worked for us. In read_log_file.m remove line 46 and add the following lines that are taken from the previous version.

if endian_code == 255	
    endian_format = 'ieee-be';	
elseif endian_code == 0	
    endian_format = 'ieee-le';	
else	
    error('Wrong endian format.');	
end

muhmaz3 avatar Apr 28 '20 11:04 muhmaz3