wiki:WARPLab/Reference/Baseband/Buffers

Version 4 (modified by chunter, 11 years ago) (diff)

--

Baseband Buffers Module Implementation

The WARPLab Reference Design implements a 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 215 samples long. On WARP v2 hardware, each buffer is 214 samples long.

Related Components:

Baseband Commands

Baseband commands are selected as string inputs to the wl_basebandCmd method in wl_node.m. These strings are each individual cases of the switch statement in procCmd method of wl_baseband_buffers.m.

Syntax

MATLAB allows two valid forms of syntax for calling methods

  • Let N be a scalar or vector of wl_node objects
  • Let command_string be a string containing a particular command
  • Let arg be an argument for that command (optional)

Syntax 1: wl_basebandCmd(N, command_string, arg1, arg2, ..., argN)

Syntax 2: N.wl_basebandCmd(command_string, arg1, arg2, ..., argN)

These two different forms of syntax are identical and either may be used for issuing commands to WARP nodes.

Optional Buffer Selection Syntax

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:

  • Let buffer_selection be a collection of interfaces or the string 'RF_ALL'

Syntax 1: wl_interfaceCmd(N, buffer_selection, command_string, arg1, arg2, ..., argN)

Syntax 2: N.wl_interfaceCmd(buffer_selection, command_string, arg1, arg2, ..., argN)

Command List and Documentation

tx_delay

Transmit delay- gets or sets the number of sample periods the baseband
waits between the trigger and starting the transission

Requires BUFF_SEL: No

Arguments: none or (uint32 TX_DLY)

Returns: (uint32 TX_DLY) or none

If an argument is specified, this command enters a write mode where
that argument is written to the board. If no argument is specified,
the current value of TX_DLY is read from the board.

tx_length

Transmit length- reads or sets the duration of each transmit cycle, in sample periods

Requires BUFF_SEL: No

Arguments: none or (uint32 TX_LEN)

Returns: (uint32 TX_LEN) or none

If an argument is specified, this command enters a write mode where
that argument is written to the board. If no argument is specified,
the current value of TX_LEN is read from the board.

rx_length

Receive length- reads or sets the duration of each receive cycle, in sample periods

Requires BUFF_SEL: No

Arguments: none or (uint32 RX_LEN)

Returns: (uint32 RX_LEN) or none

If an argument is specified, this command enters a write mode where
that argument is written to the board. If no argument is specified,
the current value of RX_LEN is read from the board.

continuous_tx

Enable/disable continuous transmit mode

Requires BUFF_SEL: No

Arguments: (boolean CONT_TX) CONT_TX:
true enables continuous transmit mode
false disable continuous transmit mode

Returns: none

tx_buff_en

Enable transmit buffer for one or more interfaces. When a buffer is enabled it will
drive samples into its associated interface when a trigger is received. The interface
itself must also be enabled (wl_interfaceCmd(...,'tx_en')) to actually transmit the samples

Requires BUFF_SEL: Yes

Arguments: none

Returns: none

rx_buff_en

Enable receive buffer for one or more interfaces. When a buffer is enabled it will
capture samples from its associated interface when a trigger is received. The interface
itself must also be enabled (wl_interfaceCmd(...,'rx_en'))

Requires BUFF_SEL: Yes

Arguments: none

Returns: none

tx_rx_buff_dis

Disable the Tx and Rx buffers for one or more interfaces. When a buffer is disabled it will not
output/capture samples when a trigger is received, even if the associated interface is enabled

Requires BUFF_SEL: Yes

Arguments: none

Returns: none

tx_buff_clk_freq

Read the transmit sample clock frequency out of the buffer core.

Requires BUFF_SEL: No

Arguments: none

Returns: (uint32 Fs_Tx) Fs_Tx: Tx sample frequency of buffer core in Hz

rx_buff_clk_freq

Read the receive sample clock frequency out of the buffer core.

Requires BUFF_SEL: No

Arguments: none

Returns: (uint32 Fs_Rx) Fs_Rx: Rx sample frequency of buffer core in Hz

rx_rssi_clk_freq

Read the receive RSSI sample clock frequency out of the buffer core.

Requires BUFF_SEL: No

Arguments: none

Returns: (uint32 Fs_RxRSSI) Fs_RxRSSI: Rx RSSI sample frequency of buffer core in Hz

write_iq

Write I/Q samples to the specified buffers. The dimensions of the buffer selection and samples matrix
must agree. The same samples can be written to multiple buffers by combining buffer IDs

Requires BUFF_SEL: Yes (combined BUFF_SEL values ok)

Arguments: (complex double TX_SAMPS, int OFFSET) TX_SAMPS: matrix of complex samples. The number of columns must match the length of BUFF_SEL
OFFSET: buffer index of first sample to write (optional; defaults to 0)

Examples:

TxLength = 2^14;
Ts = 1/(wl_basebandCmd(node0,'tx_buff_clk_freq'));
t = [0:Ts:(TxLength-1)*Ts].'; %column vector
X = exp(t*1i*2*pi*3e6); %3MHz sinusoid
Y = exp(t*1i*2*pi*5e6); %5MHz sinusoid

%Write X to RFA
wl_basebandCmd(node, RFA, 'write_iq', X);

%Write X to RFA and RFB
wl_basebandCmd(node, RFA+RFB, 'write_iq', X);

%Write X to RFA, Y to RFB
wl_basebandCmd(node, [RFA RFB], 'write_iq', [X Y]);

read_iq

Read I/Q samples from the specified buffers. The elements of the buffer selection must be scalers which
identify a single buffer. To read multiple buffers in one call, pass a vector of individual buffer IDs

Requires BUFF_SEL: Yes (combined BUFF_SEL values not allowed)

Arguments: (int OFFSET, int NUM_SAMPS) OFFSET: buffer index of first sample to read (optional; defaults to 0)
NUM_SAMPS: number of complex samples to read (optional; defaults to length(OFFSET:rxIQLen-1))[[BR]]

Examples:

%Read full buffer for RFA
%size(X) will be [rxIQLen, 1]
X = wl_basebandCmd(node, RFA, 'read_iq');

%Read partial buffer for RFA (samples 1000:4999)
%size(X) will be [5000, 1]
X = wl_basebandCmd(node, RFA, 'read_iq', 1000, 5000);

%Read full buffers for RFA and RFB
%size(X) will be [rxIQLen, 2]
X = wl_basebandCmd(node, [RFA RFB], 'read_iq');

read_rssi

Read RSSI samples from the specified buffers. The elements of the buffer selection must be scalers which
identify a single buffer. To read multiple buffers in one call, pass a vector of individual buffer IDs.

See 'read_iq' for arguments/returns

agc_state

Read AGC state from the specified buffers. The elements of the buffer selection must be scalers which
identify a single buffer. To read multiple buffers in one call, pass a vector of individual buffer IDs

Requires BUFF_SEL: Yes (combined BUFF_SEL values not allowed)

Arguments: none

Returns: agc_state -- column vector per buffer BUFF_SEL

agc_state(1): RF gain chosen by AGC
agc_state(2): BB gain chosen by AGC
agc_state(3): RSSI observed by AGC at time of lock

agc_thresh

Read or write AGC threshold.

Requires BUFF_SEL: No

Arguments: none or (int32 thresh1), (int32 thresh2), (int32 thresh3)

Returns: (int32 thresh1), (int32 thresh2), (int32 thresh3) or none

If arguments are specified, this command enters a write mode where
those arguments are written to the board. If no arguments are specified,
the current values of agc thresholds are read from the board.

thresh1: receive power (in dBm) under which AGC will not
attempt to change gains
default value: -90

thresh2: receive power (in dBm) under which AGC will select
high RF gain (RF Gain 3)
default value: -53

thresh3: receive power (in dBm) under which AGC will select
medium RF gain (RF Gain 2). Above this receive power
the AGC will select low RF gain (RF Gain 1)
default value: -43

Default known-good values for this threshold are derived from
the MAX2829 datasheet (bottom, middle plot on page 16).
These default values are (-90,-53,-43)dBm. There is no reason
to call this command unless changing from these defaults is desired.

agc_target

Set the AGC target

Requires BUFF_SEL: No. Values apply to all RF paths

Arguments: (int32 target) target: target receive power (in dBm)
default value: -10

Returns: none

This command is the best way to tweak AGC behavior
to apply more or less gain. For example, a target of
-5dBm will apply more gain thatn a target of -10dBm, so the waveform will be larger at the inputs of the I
and Q ADCs.

agc_noise_est

Set the AGC noise estimate

Requires BUFF_SEL: No. Values apply to all RF paths

Arguments: (int32 noise_estimate) noise_estimate: rx noise power (in dBm)
default value: -95

Returns: none

agc_dco

Enable/disable DC offset correction

Requires BUFF_SEL: No

Arguments: (boolean DCO) DCO:
true enables DC offset correction
false disable DC offset correction

Returns: none

agc_trig_delay

Sets the AGC trigger delay. The argument specifies a
delay (in number of cycles) that the AGC should wait
before beginning its processing after the node
receives a trigger.

Requires BUFF_SEL: No. Values apply to all RF paths

Arguments: (uint16 trigger_delay) trigger_delay: # if cycles of delay after trigger
valid range: [0,511]

Returns: none

agc_reset

Resets the AGC to its default state

Requires BUFF_SEL: No. Values apply to all RF paths

Arguments: none

Returns: none

agc_done_addr

Sample index where AGC finished

Requires BUFF_SEL: No. Values apply to all RF paths

Arguments:

Returns: (uint32) sample_index