1 | |
---|
2 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
3 | % % Start of Code to avoid conflict between users, only needed for the |
---|
4 | % % workshop |
---|
5 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
6 | % fid = fopen('c:\boards_lock.txt'); |
---|
7 | % |
---|
8 | % if(fid > -1) |
---|
9 | % fclose('all'); |
---|
10 | % errordlg('Boards already in use - Please try again!'); |
---|
11 | % okToUseBoards = 0; |
---|
12 | % return; |
---|
13 | % end |
---|
14 | % |
---|
15 | % !echo > c:\boards_lock.txt |
---|
16 | % okToUseBoards = 1; |
---|
17 | % |
---|
18 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
19 | % % End of Code to avoid conflict between users, only needed for the |
---|
20 | % % workshop |
---|
21 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
22 | |
---|
23 | % Create arp entry for magic sync |
---|
24 | !arp -s 10.0.0.244 ff-ff-ff-ff-ff-ff 10.0.0.200 |
---|
25 | |
---|
26 | %Close any stale sockets before trying to create new ones |
---|
27 | pnet('closeall'); |
---|
28 | |
---|
29 | %Load some global definitions (packet types, etc.) |
---|
30 | warplab_mimo_2x2_GUIdefines; |
---|
31 | |
---|
32 | %Initial packet number |
---|
33 | warplab_mimo_2x2_GUI.pktNoTx = 1; |
---|
34 | |
---|
35 | %Define nodes |
---|
36 | warplab_mimo_2x2_GUI.nodes = [1:2]; |
---|
37 | |
---|
38 | %Define the nodes' IP addresses & UDP ports |
---|
39 | % The IP address and UDP port ranges must match those hardc-coded in the FPGA |
---|
40 | warplab_mimo_2x2_GUI.IPAddrs = warplab_IP2int('10.0.0.0') + warplab_mimo_2x2_GUI.nodes; |
---|
41 | warplab_mimo_2x2_GUI.UDP_Ports = 9000 + warplab_mimo_2x2_GUI.nodes-1; |
---|
42 | |
---|
43 | %Define the magic SYNC address; this must match the address hard-coded in the FPGA |
---|
44 | warplab_mimo_2x2_GUI.MagicSyncAddr = '10.0.0.255'; |
---|
45 | |
---|
46 | warplab_mimo_2x2_GUI.socketHandles = warplab_initNets(warplab_mimo_2x2_GUI.MagicSyncAddr, warplab_mimo_2x2_GUI.IPAddrs, warplab_mimo_2x2_GUI.UDP_Ports); |
---|
47 | |
---|
48 | %Initialize the individual nodes |
---|
49 | warplab_initNodes(warplab_mimo_2x2_GUI.socketHandles); |
---|
50 | |
---|
51 | %Separate the socket handles for easier access |
---|
52 | % The first socket handle is always the magic SYNC |
---|
53 | % The rest can be arranged in any combination of Tx and Rx |
---|
54 | warplab_mimo_2x2_GUI.udp_Sync = warplab_mimo_2x2_GUI.socketHandles(1); |
---|
55 | warplab_mimo_2x2_GUI.udp_node1 = warplab_mimo_2x2_GUI.socketHandles(2); |
---|
56 | warplab_mimo_2x2_GUI.udp_node2 = warplab_mimo_2x2_GUI.socketHandles(3); |
---|
57 | % warplab_mimo_2x2_GUI.CaptOffset = 1000; %Number of noise samples per Rx capture; in [0:2^14] |
---|
58 | warplab_mimo_2x2_GUI.TxDelay = 1000; %Number of noise samples per Rx capture; in [0:2^14] |
---|
59 | warplab_mimo_2x2_GUI.TxLength = 2^14-1; %Length of transmission; in [0:2^14-CaptOffset] |
---|
60 | warplab_mimo_2x2_GUI.CarrierChannel = 8; % Channel in the 2.4 GHz band. In [1:14] |
---|
61 | warplab_mimo_2x2_GUI.TxA_BB = 3; %Tx Baseband Gain in [0:3] |
---|
62 | warplab_mimo_2x2_GUI.TxA_RF = 40; %Tx RF Gain in [0:63] |
---|
63 | warplab_mimo_2x2_GUI.RxA_BB = 13; %Rx Baseband Gain in [0:31] |
---|
64 | warplab_mimo_2x2_GUI.RxA_RF = 1; %Rx RF Gain in [1:3] |
---|
65 | warplab_mimo_2x2_GUI.TxB_BB = 3; %Tx Baseband Gain in [0:3] |
---|
66 | warplab_mimo_2x2_GUI.TxB_RF = 40; %Tx RF Gain in [0:63] |
---|
67 | warplab_mimo_2x2_GUI.RxB_BB = 13; %Rx Baseband Gain in [0:31] |
---|
68 | warplab_mimo_2x2_GUI.RxB_RF = 1; %Rx RF Gain in [1:3] |
---|
69 | warplab_mimo_2x2_GUI.TxSelect = 2; |
---|
70 | warplab_mimo_2x2_GUI.RxSelect = 2; |
---|