| 1 | [[TracNav(WARPLab/TOC)]] |
| 2 | |
| 3 | = Baseband Buffers Module Implementation = |
| 4 | |
| 5 | The WARPLab Reference Design implements a [wiki:../../Framework/Modules#Baseband Baseband] module that buffers incoming and outgoing samples from radio interfaces. It supports up to 4 interfaces, including both I/Q and RSSI. On WARP v3 hardware, each buffer is 2^15 samples long. On WARP v2 hardware, each buffer is 2^14 samples long. |
| 6 | |
| 7 | = Baseband Commands = |
| 8 | |
| 9 | Baseband commands are selected as string inputs to the {{{wl_basebandCmd}}} method in [browser:ResearchApps/PHY/WARPLAB/WARPLab7/M_Code_Reference/classes/wl_node.m wl_node.m]. These strings are each individual cases of the switch statement in {{{procCmd}}} method of [browser:ResearchApps/PHY/WARPLAB/WARPLab7/M_Code_Reference/classes/wl_baseband_buffers.m wl_baseband_buffers.m]. |
| 10 | |
| 11 | == Syntax == |
| 12 | MATLAB allows two valid forms of syntax for calling methods |
| 13 | |
| 14 | * Let {{{N}}} be a scalar or vector of {{{wl_node}}} objects |
| 15 | * Let {{{command_string}}} be a string containing a particular command |
| 16 | * Let {{{arg}}} be an argument for that command (optional) |
| 17 | |
| 18 | Syntax 1: {{{wl_basebandCmd(N, command_string, arg1, arg2, ..., argN)}}} |
| 19 | |
| 20 | Syntax 2: {{{N.wl_basebandCmd(command_string, arg1, arg2, ..., argN)}}} |
| 21 | |
| 22 | These two different forms of syntax are identical and either may be used for issuing commands to WARP nodes. |
| 23 | |
| 24 | === Optional Buffer Selection Syntax === |
| 25 | |
| 26 | Some baseband commands require the selection of one or more buffers. This requirement is specified in the below documentation with {{{Requires BUFF_SEL:}}}. If a command requires a buffer selection, then the following syntaxes are valid: |
| 27 | |
| 28 | * Let {{{buffer_selection}}} be a collection of interfaces or the string {{{'RF_ALL'}}} |
| 29 | |
| 30 | Syntax 1: {{{wl_interfaceCmd(N, buffer_selection, command_string, arg1, arg2, ..., argN)}}} |
| 31 | |
| 32 | Syntax 2: {{{N.wl_interfaceCmd(buffer_selection, command_string, arg1, arg2, ..., argN)}}} |
| 33 | |
| 34 | |
| 35 | == Command List and Documentation == |
| 36 | === {{{tx_delay}}} === |
| 37 | Transmit delay- gets or sets the number of sample periods the baseband [[BR]] |
| 38 | waits between the trigger and starting the transission[[BR]] |
| 39 | |
| 40 | |
| 41 | '''Requires BUFF_SEL:''' No |
| 42 | |
| 43 | '''Arguments:''' none or (uint32 TX_DLY) |
| 44 | |
| 45 | '''Returns:''' (uint32 TX_DLY) or none |
| 46 | |
| 47 | If an argument is specified, this command enters a write mode where[[BR]] |
| 48 | that argument is written to the board. If no argument is specified,[[BR]] |
| 49 | the current value of TX_DLY is read from the board.[[BR]] |
| 50 | |
| 51 | |
| 52 | === {{{tx_length}}} === |
| 53 | Transmit length- reads or sets the duration of each transmit cycle, in sample periods [[BR]] |
| 54 | |
| 55 | |
| 56 | '''Requires BUFF_SEL:''' No |
| 57 | |
| 58 | '''Arguments:''' none or (uint32 TX_LEN) |
| 59 | |
| 60 | '''Returns:''' (uint32 TX_LEN) or none |
| 61 | |
| 62 | If an argument is specified, this command enters a write mode where[[BR]] |
| 63 | that argument is written to the board. If no argument is specified,[[BR]] |
| 64 | the current value of TX_LEN is read from the board.[[BR]] |
| 65 | |
| 66 | |
| 67 | === {{{rx_length}}} === |
| 68 | Receive length- reads or sets the duration of each receive cycle, in sample periods [[BR]] |
| 69 | |
| 70 | |
| 71 | '''Requires BUFF_SEL:''' No |
| 72 | |
| 73 | '''Arguments:''' none or (uint32 RX_LEN) |
| 74 | |
| 75 | '''Returns:''' (uint32 RX_LEN) or none |
| 76 | |
| 77 | If an argument is specified, this command enters a write mode where[[BR]] |
| 78 | that argument is written to the board. If no argument is specified,[[BR]] |
| 79 | the current value of RX_LEN is read from the board.[[BR]] |
| 80 | |
| 81 | |
| 82 | === {{{continuous_tx}}} === |
| 83 | Enable/disable continuous transmit mode[[BR]] |
| 84 | |
| 85 | |
| 86 | '''Requires BUFF_SEL:''' No |
| 87 | |
| 88 | '''Arguments:''' (boolean CONT_TX) |
| 89 | CONT_TX:[[BR]] |
| 90 | true enables continuous transmit mode[[BR]] |
| 91 | false disable continuous transmit mode[[BR]] |
| 92 | |
| 93 | '''Returns:''' none |
| 94 | |
| 95 | |
| 96 | === {{{tx_buff_en}}} === |
| 97 | Enable transmit buffer for one or more interfaces. When a buffer is enabled it will[[BR]] |
| 98 | drive samples into its associated interface when a trigger is received. The interface[[BR]] |
| 99 | itself must also be enabled (wl_interfaceCmd(...,'tx_en')) to actually transmit the samples[[BR]] |
| 100 | |
| 101 | |
| 102 | '''Requires BUFF_SEL:''' Yes |
| 103 | |
| 104 | '''Arguments:''' none |
| 105 | |
| 106 | '''Returns:''' none |
| 107 | |
| 108 | |
| 109 | === {{{rx_buff_en}}} === |
| 110 | Enable receive buffer for one or more interfaces. When a buffer is enabled it will[[BR]] |
| 111 | capture samples from its associated interface when a trigger is received. The interface[[BR]] |
| 112 | itself must also be enabled (wl_interfaceCmd(...,'rx_en'))[[BR]] |
| 113 | |
| 114 | |
| 115 | '''Requires BUFF_SEL:''' Yes |
| 116 | |
| 117 | '''Arguments:''' none |
| 118 | |
| 119 | '''Returns:''' none |
| 120 | |
| 121 | |
| 122 | === {{{tx_rx_buff_dis}}} === |
| 123 | Disable the Tx and Rx buffers for one or more interfaces. When a buffer is disabled it will not[[BR]] |
| 124 | output/capture samples when a trigger is received, even if the associated interface is enabled[[BR]] |
| 125 | |
| 126 | |
| 127 | '''Requires BUFF_SEL:''' Yes |
| 128 | |
| 129 | '''Arguments:''' none |
| 130 | |
| 131 | '''Returns:''' none |
| 132 | |
| 133 | |
| 134 | === {{{tx_buff_clk_freq}}} === |
| 135 | Read the transmit sample clock frequency out of the buffer core.[[BR]] |
| 136 | |
| 137 | |
| 138 | '''Requires BUFF_SEL:''' No |
| 139 | |
| 140 | '''Arguments:''' none |
| 141 | |
| 142 | '''Returns:''' (uint32 Fs_Tx) |
| 143 | Fs_Tx: Tx sample frequency of buffer core in Hz[[BR]] |
| 144 | |
| 145 | |
| 146 | === {{{rx_buff_clk_freq}}} === |
| 147 | Read the receive sample clock frequency out of the buffer core.[[BR]] |
| 148 | |
| 149 | |
| 150 | '''Requires BUFF_SEL:''' No |
| 151 | |
| 152 | '''Arguments:''' none |
| 153 | |
| 154 | '''Returns:''' (uint32 Fs_Rx) |
| 155 | Fs_Rx: Rx sample frequency of buffer core in Hz[[BR]] |
| 156 | |
| 157 | |
| 158 | === {{{rx_rssi_clk_freq}}} === |
| 159 | Read the receive RSSI sample clock frequency out of the buffer core.[[BR]] |
| 160 | |
| 161 | |
| 162 | '''Requires BUFF_SEL:''' No |
| 163 | |
| 164 | '''Arguments:''' none |
| 165 | |
| 166 | '''Returns:''' (uint32 Fs_RxRSSI) |
| 167 | Fs_RxRSSI: Rx RSSI sample frequency of buffer core in Hz[[BR]] |
| 168 | |
| 169 | |
| 170 | === {{{write_iq}}} === |
| 171 | Write I/Q samples to the specified buffers. The dimensions of the buffer selection and samples matrix[[BR]] |
| 172 | must agree. The same samples can be written to multiple buffers by combining buffer IDs[[BR]] |
| 173 | |
| 174 | |
| 175 | '''Requires BUFF_SEL:''' Yes (combined BUFF_SEL values ok) |
| 176 | |
| 177 | '''Arguments:''' (complex double TX_SAMPS, int OFFSET) |
| 178 | TX_SAMPS: matrix of complex samples. The number of columns must match the length of BUFF_SEL[[BR]] |
| 179 | OFFSET: buffer index of first sample to write (optional; defaults to 0)[[BR]] |
| 180 | |
| 181 | Examples:[[BR]] |
| 182 | {{{ |
| 183 | TxLength = 2^14; |
| 184 | Ts = 1/(wl_basebandCmd(node0,'tx_buff_clk_freq')); |
| 185 | t = [0:Ts:(TxLength-1)*Ts].'; %column vector |
| 186 | X = exp(t*1i*2*pi*3e6); %3MHz sinusoid |
| 187 | Y = exp(t*1i*2*pi*5e6); %5MHz sinusoid |
| 188 | |
| 189 | %Write X to RFA |
| 190 | wl_basebandCmd(node, RFA, 'write_iq', X); |
| 191 | |
| 192 | %Write X to RFA and RFB |
| 193 | wl_basebandCmd(node, RFA+RFB, 'write_iq', X); |
| 194 | |
| 195 | %Write X to RFA, Y to RFB |
| 196 | wl_basebandCmd(node, [RFA RFB], 'write_iq', [X Y]); |
| 197 | }}} |
| 198 | |
| 199 | === {{{read_iq}}} === |
| 200 | Read I/Q samples from the specified buffers. The elements of the buffer selection must be scalers which[[BR]] |
| 201 | identify a single buffer. To read multiple buffers in one call, pass a vector of individual buffer IDs[[BR]] |
| 202 | |
| 203 | |
| 204 | '''Requires BUFF_SEL:''' Yes (combined BUFF_SEL values not allowed) |
| 205 | |
| 206 | '''Arguments:''' (int OFFSET, int NUM_SAMPS) |
| 207 | OFFSET: buffer index of first sample to read (optional; defaults to 0)[[BR]] |
| 208 | NUM_SAMPS: number of complex samples to read (optional; defaults to length(OFFSET:rxIQLen-1))[[BR]] |
| 209 | |
| 210 | Examples:[[BR]] |
| 211 | {{{ |
| 212 | %Read full buffer for RFA |
| 213 | %size(X) will be [rxIQLen, 1] |
| 214 | X = wl_basebandCmd(node, RFA, 'read_iq'); |
| 215 | |
| 216 | %Read partial buffer for RFA (samples 1000:4999) |
| 217 | %size(X) will be [5000, 1] |
| 218 | X = wl_basebandCmd(node, RFA, 'read_iq', 1000, 5000); |
| 219 | |
| 220 | %Read full buffers for RFA and RFB |
| 221 | %size(X) will be [rxIQLen, 2] |
| 222 | X = wl_basebandCmd(node, [RFA RFB], 'read_iq'); |
| 223 | }}} |
| 224 | |
| 225 | === {{{read_rssi}}} === |
| 226 | Read RSSI samples from the specified buffers. The elements of the buffer selection must be scalers which[[BR]] |
| 227 | identify a single buffer. To read multiple buffers in one call, pass a vector of individual buffer IDs.[[BR]] |
| 228 | |
| 229 | See 'read_iq' for arguments/returns[[BR]] |
| 230 | |
| 231 | |
| 232 | === {{{agc_state}}} === |
| 233 | Read AGC state from the specified buffers. The elements of the buffer selection must be scalers which[[BR]] |
| 234 | identify a single buffer. To read multiple buffers in one call, pass a vector of individual buffer IDs[[BR]] |
| 235 | |
| 236 | |
| 237 | '''Requires BUFF_SEL:''' Yes (combined BUFF_SEL values not allowed) |
| 238 | |
| 239 | '''Arguments:''' none |
| 240 | |
| 241 | |
| 242 | '''Returns:''' agc_state -- column vector per buffer BUFF_SEL |
| 243 | |
| 244 | agc_state(1): RF gain chosen by AGC[[BR]] |
| 245 | agc_state(2): BB gain chosen by AGC[[BR]] |
| 246 | agc_state(3): RSSI observed by AGC at time of lock[[BR]] |
| 247 | |
| 248 | |
| 249 | === {{{agc_thresh}}} === |
| 250 | Read or write AGC threshold.[[BR]] |
| 251 | |
| 252 | |
| 253 | '''Requires BUFF_SEL:''' No |
| 254 | |
| 255 | '''Arguments:''' none or (int32 thresh1), (int32 thresh2), (int32 thresh3) |
| 256 | |
| 257 | '''Returns:''' (int32 thresh1), (int32 thresh2), (int32 thresh3) or none |
| 258 | |
| 259 | If arguments are specified, this command enters a write mode where[[BR]] |
| 260 | those arguments are written to the board. If no arguments are specified,[[BR]] |
| 261 | the current values of agc thresholds are read from the board.[[BR]] |
| 262 | |
| 263 | thresh1: receive power (in dBm) under which AGC will not[[BR]] |
| 264 | attempt to change gains[[BR]] |
| 265 | default value: -90[[BR]] |
| 266 | |
| 267 | thresh2: receive power (in dBm) under which AGC will select[[BR]] |
| 268 | high RF gain (RF Gain 3)[[BR]] |
| 269 | default value: -53[[BR]] |
| 270 | |
| 271 | thresh3: receive power (in dBm) under which AGC will select[[BR]] |
| 272 | medium RF gain (RF Gain 2). Above this receive power[[BR]] |
| 273 | the AGC will select low RF gain (RF Gain 1)[[BR]] |
| 274 | default value: -43[[BR]] |
| 275 | |
| 276 | Default known-good values for this threshold are derived from[[BR]] |
| 277 | the MAX2829 datasheet (bottom, middle plot on page 16).[[BR]] |
| 278 | These default values are (-90,-53,-43)dBm. There is no reason[[BR]] |
| 279 | to call this command unless changing from these defaults is desired.[[BR]] |
| 280 | |
| 281 | |
| 282 | === {{{agc_target}}} === |
| 283 | Set the AGC target[[BR]] |
| 284 | |
| 285 | |
| 286 | '''Requires BUFF_SEL:''' No. Values apply to all RF paths |
| 287 | |
| 288 | '''Arguments:''' (int32 target) |
| 289 | target: target receive power (in dBm)[[BR]] |
| 290 | default value: -10[[BR]] |
| 291 | |
| 292 | '''Returns:''' none |
| 293 | |
| 294 | This command is the best way to tweak AGC behavior[[BR]] |
| 295 | to apply more or less gain. For example, a target of[[BR]] |
| 296 | -5dBm will apply more gain thatn a target of -10dBm, |
| 297 | so the waveform will be larger at the inputs of the I[[BR]] |
| 298 | and Q ADCs.[[BR]] |
| 299 | |
| 300 | |
| 301 | === {{{agc_noise_est}}} === |
| 302 | Set the AGC noise estimate[[BR]] |
| 303 | |
| 304 | |
| 305 | '''Requires BUFF_SEL:''' No. Values apply to all RF paths |
| 306 | |
| 307 | '''Arguments:''' (int32 noise_estimate) |
| 308 | noise_estimate: rx noise power (in dBm)[[BR]] |
| 309 | default value: -95[[BR]] |
| 310 | |
| 311 | '''Returns:''' none |
| 312 | |
| 313 | |
| 314 | === {{{agc_dco}}} === |
| 315 | Enable/disable DC offset correction[[BR]] |
| 316 | |
| 317 | |
| 318 | '''Requires BUFF_SEL:''' No |
| 319 | |
| 320 | '''Arguments:''' (boolean DCO) |
| 321 | DCO:[[BR]] |
| 322 | true enables DC offset correction[[BR]] |
| 323 | false disable DC offset correction[[BR]] |
| 324 | |
| 325 | '''Returns:''' none |
| 326 | |
| 327 | |
| 328 | === {{{agc_trig_delay}}} === |
| 329 | Sets the AGC trigger delay. The argument specifies a[[BR]] |
| 330 | delay (in number of cycles) that the AGC should wait[[BR]] |
| 331 | before beginning its processing after the node[[BR]] |
| 332 | receives a trigger.[[BR]] |
| 333 | |
| 334 | |
| 335 | '''Requires BUFF_SEL:''' No. Values apply to all RF paths |
| 336 | |
| 337 | '''Arguments:''' (uint16 trigger_delay) |
| 338 | trigger_delay: # if cycles of delay after trigger[[BR]] |
| 339 | valid range: ![0,511][[BR]] |
| 340 | |
| 341 | '''Returns:''' none |
| 342 | |
| 343 | |
| 344 | === {{{agc_reset}}} === |
| 345 | Resets the AGC to its default state[[BR]] |
| 346 | |
| 347 | |
| 348 | '''Requires BUFF_SEL:''' No. Values apply to all RF paths |
| 349 | |
| 350 | '''Arguments:''' none |
| 351 | |
| 352 | '''Returns:''' none |
| 353 | |
| 354 | |
| 355 | === {{{agc_done_addr}}} === |
| 356 | Sample index where AGC finished[[BR]] |
| 357 | |
| 358 | |
| 359 | '''Requires BUFF_SEL:''' No. Values apply to all RF paths |
| 360 | |
| 361 | '''Arguments:''' |
| 362 | |
| 363 | '''Returns:''' (uint32) sample_index |