137 | | |
| 137 | ---- |
| 138 | '''Tx/Rx Cycle''': The basic flow of a Tx/Rx cycle in WARPLab 7 is unchanged: |
| 139 | * Write samples to Tx buffers (see above) |
| 140 | * Enable Tx radios and buffers |
| 141 | * Enable Rx radios and buffers |
| 142 | * Send trigger to Tx and Rx nodes |
| 143 | * Disable Tx/Rx radios and buffers |
| 144 | * Retrieve captured samples from Rx buffers (see below) |
| 145 | |
| 146 | The code below illustrates the updated syntax for en/disabling radios and buffers and sending triggers. |
| 147 | |
| 148 | {{{#!html |
| 149 | <table border=1 width=600><tr valign=top><td width=50% align=left> |
| 150 | }}} |
| 151 | |
| 152 | {{{ |
| 153 | %WARPLab 6 |
| 154 | |
| 155 | %Enable the RF transceivers |
| 156 | warplab_sendCmd(udp_node1, RADIO2_TXEN, packetNum); |
| 157 | warplab_sendCmd(udp_node1, RADIO3_TXEN, packetNum); |
| 158 | warplab_sendCmd(udp_node2, RADIO2_RXEN, packetNum); |
| 159 | warplab_sendCmd(udp_node2, RADIO3_RXEN, packetNum); |
| 160 | |
| 161 | %Enable the Tx/Rx buffers |
| 162 | warplab_sendCmd(udp_node1, RADIO2TXBUFF_TXEN, packetNum); |
| 163 | warplab_sendCmd(udp_node1, RADIO3TXBUFF_TXEN, packetNum); |
| 164 | warplab_sendCmd(udp_node2, RADIO2RXBUFF_RXEN, packetNum); |
| 165 | warplab_sendCmd(udp_node2, RADIO3RXBUFF_RXEN, packetNum); |
| 166 | |
| 167 | %Prepare nodes for trigger reception |
| 168 | warplab_sendCmd(udp_node1, TX_START, packetNum); |
| 169 | warplab_sendCmd(udp_node2, RX_START, packetNum); |
| 170 | |
| 171 | % Send the trigger |
| 172 | warplab_sendSync(udp_Sync); |
| 173 | |
| 174 | %Disable the RF transceivers |
| 175 | warplab_sendCmd(udp_node1, RADIO2_TXDIS, packetNum); |
| 176 | warplab_sendCmd(udp_node1, RADIO3_TXDIS, packetNum); |
| 177 | warplab_sendCmd(udp_node2, RADIO2_RXDIS, packetNum); |
| 178 | warplab_sendCmd(udp_node2, RADIO3_RXDIS, packetNum); |
| 179 | |
| 180 | %Disable the Tx/Rx buffers |
| 181 | warplab_sendCmd(udp_node1, RADIO2TXBUFF_TXDIS, packetNum); |
| 182 | warplab_sendCmd(udp_node1, RADIO3TXBUFF_TXDIS, packetNum); |
| 183 | warplab_sendCmd(udp_node2, RADIO2RXBUFF_RXDIS, packetNum); |
| 184 | warplab_sendCmd(udp_node2, RADIO3RXBUFF_RXDIS, packetNum); |
| 185 | |
| 186 | |
| 187 | }}} |
| 188 | |
| 189 | {{{#!html |
| 190 | </td><td width=50% align=left> |
| 191 | }}} |
| 192 | |
| 193 | {{{ |
| 194 | %WARPLab 7 |
| 195 | |
| 196 | %Enable the RF transceivers |
| 197 | wl_interfaceCmd(nodes(1), [RFA RFB], 'tx_en'); |
| 198 | wl_interfaceCmd(nodes(2), [RFA RFB], 'rx_en'); |
| 199 | |
| 200 | %Enable the sample buffers |
| 201 | wl_basebandCmd(nodes(1), [RFA RFB], 'tx_buff_en'); |
| 202 | wl_basebandCmd(nodes(2), [RFA RFB], 'rx_buff_en'); |
| 203 | |
| 204 | %Send the broadcast trigger |
| 205 | eth_trig.send(); |
| 206 | |
| 207 | %Disable the transceivers and buffers |
| 208 | wl_basebandCmd(nodes, 'RF_ALL', 'tx_rx_buff_dis'); |
| 209 | wl_interfaceCmd(nodes, 'RF_ALL', 'tx_rx_dis'); |
| 210 | |
| 211 | %Retrieve the IQ and RSSI samples from the Rx node |
| 212 | rx_IQ = wl_basebandCmd(nodes(2), [RFA RFB], 'read_IQ', 0, 2^14); |
| 213 | rx_RSSI = wl_basebandCmd(nodes(2), [RFA RFB], 'read_RSSI', 0, 2^12); |
| 214 | }}} |
| 215 | |
| 216 | {{{#!html |
| 217 | </td></tr></table> |
| 218 | }}} |
| 219 | |
| 220 | |
| 221 | ---- |
| 222 | '''Reading Samples'': WARPLab 7 simplifies the process for reading samples from multiple nodes and multiple buffers. The example below illustrates reading IQ and RSSI samples from two interfaces (RFA and RFB) on one node. |
| 223 | |
| 224 | {{{#!html |
| 225 | <table border=1 width=600><tr valign=top><td width=50% align=left> |
| 226 | }}} |
| 227 | |
| 228 | {{{ |
| 229 | %WARPLab 6 |
| 230 | |
| 231 | %Retrieve and format the IQ samples from RFA and RFB |
| 232 | [Node2_Radio2_RawRxData] = warplab_readSMRO(udp_node2, RADIO2_RXDATA, 2^14); |
| 233 | [Node2_Radio2_RxData] = warplab_processRawRxData(Node2_Radio2_RawRxData); |
| 234 | [Node2_Radio3_RawRxData] = warplab_readSMRO(udp_node2, RADIO3_RXDATA, 2^14); |
| 235 | [Node2_Radio3_RxData] = warplab_processRawRxData(Node2_Radio3_RawRxData); |
| 236 | |
| 237 | %Retrieve and format the RSSI samples from RFA and RFB |
| 238 | [Node2_Radio2_RawRSSIData] = warplab_readSMRO(udp_node2, RADIO2_RSSIDATA, 2^12); |
| 239 | [Node2_Radio2_RSSIData] = warplab_processRawRSSIData(Node2_Radio2_RawRSSIData); |
| 240 | [Node2_Radio3_RawRSSIData] = warplab_readSMRO(udp_node2, RADIO3_RSSIDATA, 2^12); |
| 241 | [Node2_Radio3_RSSIData] = warplab_processRawRSSIData(Node2_Radio3_RawRSSIData); |
| 242 | |
| 243 | }}} |
| 244 | |
| 245 | {{{#!html |
| 246 | </td><td width=50% align=left> |
| 247 | }}} |
| 248 | |
| 249 | {{{ |
| 250 | %WARPLab 7 |
| 251 | |
| 252 | %Retrieve the IQ and RSSI samples from both interfaces on the Rx node |
| 253 | rx_IQ = wl_basebandCmd(nodes(2), [RFA RFB], 'read_IQ', 0, 2^14); |
| 254 | rx_RSSI = wl_basebandCmd(nodes(2), [RFA RFB], 'read_RSSI', 0, 2^12); |
| 255 | }}} |
| 256 | |
| 257 | {{{#!html |
| 258 | </td></tr></table> |
| 259 | }}} |
| 260 | |
| 261 | |