WARPLab ver 7.0 Documentation by Thundluck Sereevoravitgul
description
Transcript of WARPLab ver 7.0 Documentation by Thundluck Sereevoravitgul
-
WARPLab ver 7.0 Documentation
by Thundluck Sereevoravitgul, Sirindhorn International Institute of Technology, Thammasat University
supervisor: Prof. Dr.-Ing.Marius Pesavento ,
Christian Steffens, Technische Universitt Darmstadt
Date 10 May 2013
-
1
Contents
Introduction-----------------------------------------------------------------------------------------------------------------------------2
WARP Platform Framework---------------------------------------------------------------------------------------------------------2
-Hardware Components---------------------------------------------------------------------------------------------------3
-Design Architecture-------------------------------------------------------------------------------------------------------5
-Specification----------------------------------------------------------------------------------------------------------------7
WARPLab Framework----------------------------------------------------------------------------------------------------------------9
Command Reference----------------------------------------------------------------------------------------------------------------11
-Node Commands---------------------------------------------------------------------------------------------------------11
-Interface Commands----------------------------------------------------------------------------------------------------12
-Baseband Commands---------------------------------------------------------------------------------------------------15
-Transport Commands---------------------------------------------------------------------------------------------------20
-Trigger Manager Commands-----------------------------------------------------------------------------------------21
Example of usage--------------------------------------------------------------------------------------------------------------------22
-Result-----------------------------------------------------------------------------------------------------------------------26
Appendix-------------------------------------------------------------------------------------------------------------------------------29
-Binary Phase Shift Keying (BPSK)-------------------------------------------------------------------------------------29
-Cross Correlation---------------------------------------------------------------------------------------------------------30
-MATLAB function Reference-------------------------------------------------------------------------------------------31
References-----------------------------------------------------------------------------------------------------------------------------33
-
2
Introduction WARP or Wireless Open-Access Research Platform is a programmable wireless platform available for
researchers to develop into advance wireless research. The platform preserved for four main requirements.
First, the platform is capable of implementing advance wireless algorithm. Second, the platform is scalable,
allowing additional processing resource to be allocated. Third, it is extensible by providing peripheral and
interface expansion for future application. Fourth, it is considered as a long term usage, supporting the
evolution of some components without compromising others function.
WARP Platform Framework
Figure 1: WARP v3 (Virtex-6)
Mango Communications WARP v3 is the latest generation of WARP hardware, integrating a Virtex-6
FPGA, two programmable RF interfaces and a variety of peripherals. The block diagram in Figure 2 gives an
overview of the hardware design.
Figure 2 : Block diagram of the hardware design
For wireless transmission, digital I and Q values from the FPGA are taken through digital-to-analog
converters and are delivered to the transceiver for upconversion. Wireless reception follows the reciprocal
process where I and Q analog streams are taken from the transceiver through analog-to-digital conversion
and are delivered to the FPGA.
-
3
Hardware Components
Figure 3 : Hardware Components
The major hardware components of WARP v3 platform are indicated as shown in the Figure 3 and
are described below:
User I/O: This collection of push buttons, LEDs, hexadecimal displays, dip switches, and debug header pins is used for interacting with the board. Designs can read values from the switches and push buttons and can write values to the displays and LEDs. The DIP switch setting is explained in Figure 4. The debug header can be used for any number of purposes, such as providing a convenient way for one WARP board to trigger the action of another board over a wire.
Figure 4 : DIP Switch Setting
Radio Interfaces A & B: There interfaces provide the radios that allow designs to communicate at the 2.4GHz and 5GHz bands.. The interfaces are labeled "RF A" and "RF B" on the board and in our reference designs.
SDRAM: This DDR3 SO-DIMM provides extra memory beyond the block RAM inside the FPGA. The WARP v3 kit ships with a pre-tested 2GB SO-DIMM.
Device label: This label shows the FPGA device on the WARP v3 board. This device is used in a number of places during the development process (such as exporting a peripheral core from Xilinx System Generator), so this label is present for convenient lookup.
Virtex-6 FPGA: Under the fan, the FPGA serves as the central processing system for the WARP board. FMC HPC Slot: The FPGA Mezzanine Card High Pin Count slot provides connectivity to an existing
ecosystem of hardware as well as future WARP-specific modules.
-
4
Serial #: This is the unique serial number for the WARP board. This number is also programmed into an EEPROM on the board prior to shipping, allowing software running on the hardware to read this information.
Ethernet A/B: The two 10/100/1000 Ethernet ports provide high-speed connectivity between the board and a wired network. The ports are labeled "ETH A" and "ETH B" on the WARP v3 board and in our reference designs.
JTAG: The JTAG connector allows direct programming of the Virtex-6 FPGA using a Digilent or Xilinx JTAG cable.
SD Card: An alternative to programming the board over JTAG is to use the SD card. This allows non-volatile storage of programs that will automatically download and execute upon insertion of the SD card.
UART: The micro-USB connector on the board allows programs on the board to print messages to a terminal running on a computer.
Power Switch: The power switch controls power to the board. The "off" position is where the switch is furthest away from the power jack. The "on" position is where the switch is closest to the power jack.
Power Jack: The power jack is where the 12V power supply that comes with the WARP hardware should be plugged in. Note: the power switch should be in the "off" position whenever the power plug is inserted or removed. This allows the circuitry controlled by the switch to properly sequence the power regulators on the board.
Caution: WARP v3 is designed as a prototyping platform. As such, the hardware is shipped as an exposed
board, with the various connectors and interfaces ready for access by user designs. This also means that
sensitive circuits on the hardware are exposed and can be damaged by misuse. You must take care when
handling the WARP v3 board
Warning: The WARP v3 board is sensitive to electrostatic discharge (ESD). You must take ESD precautions
when handling the hardware. Always ensure you are grounded before touching the board. Damage due to
ESD is not covered by warranty.
Using the CM-MMCX with WARP v3
WARP v3 users can use the CM-MMCX clock module to share sampling and/or RF clocks between multiple WARP v3 kits. The SIP switches on the CM-MMCX board are used to configure the board into a number of different states (shown in Figure 5). For example, the switches can be used to configure the board to act as a host of sample and RF clocks by enabling the MMCX clock outputs on the board. Using MMCX cables to connect this host board to a different WARP v3 node with the CM-MMCX that is configured for off-board clocking allows clocks to be shared.
Figure 5 : CM-MMCX configuration
-
5
Design Architecture Transmission (Tx) and Reception (Rx) paths for one antenna are shown in the Figure 6, blocks in the Tx Path are highlighted in pink and blocks in the Rx path are highlighted in blue. The blocks are described below.
Figure 6 : SISO wireless communication architecture
Blocks on transmitter path:
Tx I/Q Buffers: In-Phase samples to be transmitted are stored in the Tx I Buffer and Quadrature samples to be transmitted are stored in the Tx Q Buffer.
DAC I/Q: Digital-to-Analog Converters for In-Phase/Quadrature samples. Tx BB Amplifiers: Transmitter Base Band Amplifiers. There are two amplifiers, one for the I signal and
one for the Q signal. These are variable Gain Amplifiers both set to the same gain value which can be input by the user from MATLAB workspace.
Upconversion: Converts the base band signal to an RF signal. Carrier frequency depends on PLL setting.
Tx RF Amplifiers: Transmitter RF amplifier, variable gain amplifier, gain value can be input by the user from MATLAB worksapce.
Blocks on receiver path:
Rx RF Amplifier: Receiver RF amplifier, variable gain amplifier, gain value can be input by the user from MATLAB worksapce.
Downconversion: Converts the RF signal to base band In-Phase/Quadrature signals. Downconversion from RF depends on PLL setting.
Rx BB Amplifiers: Receiver Base Band Amplifiers. There are two amplifiers, one for the I signal and one for the Q signal. These are variable Gain Amplifiers both set to the same gain value which can be input by the user from MATLAB workspace.
RSSI: Received Signal Strength Indicator. This block measures the RSSI. ADC I/Q: Analog-to-Digital Converters for In-Phase/Quadrature samples. ADC RSSI: Analog-to-Digital Converter for the measured RSSI. The RSSI data is available at 1/4th the
rate of the I/Q data. Rx I/Q Buffers: Received In-Phase samples are stored in the Rx I Buffer and Received Quadrature
samples are stored in the Rx Q Buffer. RSSI Buffer: RSSI data is stored in the this buffer.
-
6
PLL block: Setting of the PLL determines the carrier frequency which can be set to any of the 14 channels in the Wi-Fi 2.4 GHz band or 23 channels in the 5 GHz band. The carrier channel can be set directly from the MATLAB workspace.
NOTE: Receiver RF and BB gains can be set using Manual Gain Control (MGC) or Automatic Gain Control (AGC). In MGC mode the user picks the values for these gains and sets the gains on the boards using functions available in the WARPLab Reference M-Code. In AGC mode the board is configured so that it automatically sets receiver gains based on measured RSSI. The WARPLab framework provides examples that illustrate how to use MGC and AGC modes.
-
7
Specification for WARPLab
Tx/Rx I/Q Buffers
Independent Tx/Rx I/Q Buffers. Each buffer can store a maximum of 215 samples. Buffers persist between triggers. Samples are read from Tx I/Q Buffers to I/Q DACs at 40 MHz. Samples are written from I/Q ADCs to Rx I/Q buffers at 40MHz.
Tx Signal Requirements
Amplitude of real part (In-Phase signal: I) in [-1,1] and amplitude of imaginary part (Quadrature signal: Q) in [-1,1]. I/Q signals on transmitter path are represented in the FPGA using Fixed Point 16_15.
Lowest Frequency: 30 kHz. Radios filter DC. Highest Frequency: Depends on the Tx/Rx Low Pas Filter (LPF) Corner Frequency Setting. By default,
Tx and Rx LPF are set to nominal mode. Possible Tx/Rx LPF settings are the following. Tx LPF corner frequency: Mode 0: Undefined, Mode 1: 12 MHz (Nominal Mode), Mode 2: 18 MHz (Turbo Mode 1), Mode 3: 24 MHz (Turbo Mode 2). Rx LPF corner frequency: Mode 0: 7.5 MHz, Mode 1: 9.5 MHz (Nominal Mode), Mode 2: 14 MHz (Turbo Mode 1), Mode 3: 18 MHz (Turbo Mode 2).
40 MHz sampling frequency.
I/Q ADC/DAC
Are always clocked at 40 MHz. DAC I/Q input signals are represented using Fixed Point 16_15. ADC I/Q output signals are represented using Fixed Point 14_13.
Tx/Rx Amplifiers
The Tx path applies gain at three amplifiers: Tx Base Band (Tx BB), Tx RF, and Tx RF PA. The Tx RF PA is always fixed at 30 dB gain. The Tx BB and Tx RF amplifiers are adjusted digitally, the range of gains is the following. Tx BB: In [0, 3] applies 1.5 dB/step. Tx RF: In [0, 63] applies 0.5 dB/step.
The Rx path applies gain at two amplifiers: Rx Base Band (Rx BB) and Rx RF. Rx amplifiers are adjusted digitally, the range of gains is the following. Rx BB: In [0, 31] applies 2 dB/step. Rx RF: In [1, 3] applies 15 dB/step.
A signal with I/Q that span full [-1,1] range of I/Q DAC input (e.g a complex exponential exp(j*2*pi*f*t) with f in passband of Tx/Rx LPFs) will be transmitted at RF with a peak power of approximately 19 dBm when Tx gains are set at maximum values (Tx BB = 3 and Tx RF =63 ), the average power will depend on the waveform.
-
8
Received Signal Strength Indicator (RSSI)
RSSI reading is a 10-bit number linear in dB that can be converted to received power in dBm. The RSSI is measured after the Rx RF amplifier, so the digital RSSI to Rx Power conversion depends on
the Rx RF gain setting. The numbers below are approximate, based on plots from the MAX2829 datasheet. For a more precise mapping, you would need to take measurements using a transmitter with known output power (like an RF signal generator). For high gain (Rx RF = 3), RSSI=0 is -100dBm; RSSI=1023 is -30dBm. For medium gain (Rx RF = 2), RSSI=0 is -85dBm; RSSI=1023 is -15dBm. For low gain (Rx RF = 1), RSSI=0 is -70dBm; RSSI=1023 is 0dBm.
MAX2829 specifies the RSSI bandwidth is 3MHz but we have observed that RSSI bandwidth spans nearly the full bandwidth of the RF path (RF path bandwidth is determined by Tx/RF LPFs corner frequency settings). Users are recommended to test RSSI bandwidth directly in their setup to see its characteristics directly; try transmitting a chirp (sweeping sinusoid) and plotting the RSSI vs. time. See WARPLab example 'warplab_siso_example_TxRx_BandwidthChange.m'.
The RSSI signal is sampled by its own ADC (independent of I/Q ADCs). In WARPLab, the RSSI ADC is clocked at 10 MHz (1/4 of the rate of the I/Q ADCs).
-
9
WARPLab Framework
WARPLab is a framework which brings together WARP and MATLAB. With WARPLab, you can
interact with WARP nodes directly from the MATLAB workspace and signals generated in MATLAB can be
transmitted in real-time over the air using WARP nodes. This facilitates rapid prototyping of physical layer
(PHY) algorithms directly in MATLAB M-Code.
The WARPLab architecture is shown in the Figure 7. It is very flexible, supporting any combination of WARP v1, v2, or v3 hardware. Furthermore, any number of radios on each WARP board are also supported.
Figure 7 : The WARPLab setup.
The design flow for a new PHY is the following:
The user creates the samples to be transmitted in MATLAB. The samples are downloaded to buffers in the nodes assigned as transmitters. The user sends a trigger to transmitter and receiver nodes. Upon reception of this trigger, samples
are transmitted over-the-air and captured in real-time. The user reads captured samples from the receiver nodes to the MATLAB workspace. Received samples are processed offline in MATLAB
Setup Setting up the WARPLab is shown in Figure 8. Up to 16 WARP nodes and a host computer running
MATLAB are connected to a switch via Ethernet links. The Ethernet links are used to transfer data to and
from the WARP nodes. While the transmission is real-time, the communication between the PC and the
boards takes longer.
The way to set up the WARPLab :
1. Download the latest WARPLab Reference Design Release and unzip it.
2. Open MATLAB and change the current path to the M_Code_Reference directory from the downloaded archive.
3. Run wl_setup on the MATLAB command line. 4. Follow the prompts to configure your WARPLab environment
You can download the latest WARPLab Reference Design and update the development by this link:
http://warpproject.org/trac/wiki/WARPLab/Changelog
-
10
Figure 8 : Setting up WARPLab
Example
1. Confirm everything is ready by copying and pasting the following lines to the MATLAB command line:
clear
N = 1;
nodes = wl_initNodes(N);
wl_nodeCmd(nodes,'identify');
disp(nodes)
Note: N can be changed to the number of nodes in your network. When you run these lines of code, you should see the User I/O LEDs on your N nodes blink as a result of the identify command.
2. If the previous stepped work, you should try one of the example code.
-
11
Command Reference
Node Commands
Node commands are selected as string input to the wl_nodeCmd method. These string are each individual cases of the switch statement in procCmd.
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_nodeCmd(N, command_string, arg1, arg2, ..., argN)
Syntax 2: N.wl_nodeCmd(command_string, arg1, arg2, ..., argN)
These two different forms of syntax are identical and either may be used for issuing commands to WARP nodes.
Command List
get_hardware_info
Reads details from the WARP hardware and updates node object parameters
Arguments: none
Returns: none (access updated node parameters if needed)
get_fpga_temperature
Reads the temperature (in Celsius) from the FPGA
Arguments: none
Returns: (double currTemp), (double minTemp), (double maxTemp)
currTemp - current temperature of FPGA in degrees Celsius minTemp - minimum recorded temperature of FPGA in degrees Celsius maxTemp - maximum recorded temperature temperature of FPGA in degrees Celsius
initialize
Initializes the node; this must be called at least once per power cycle of the node
Arguments: none
Returns: none
identify
Blinks the user LEDs on the WARP node, to help identify MATLAB node-to-hardware node mapping
Arguments: none
Returns: none
-
12
Interface Commands
Interface commands are selected as string inputs to the wl_interfaceCmd method. These string
are each individual cases of the switch statement in procCmd.
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 interface_selection be a collection of interfaces or the string 'RF_ALL'
Let arg be an argument for that command (optional)
Syntax 1: wl_interfaceCmd(N, command_string, arg1, arg2, ..., argN)
Syntax 2: N.wl_interfaceCmd(command_string, arg1, arg2, ..., argN)
These two different forms of syntax are identical and either may be used for issuing commands to WARP nodes.
Command List
tx_en
Enable transmit mode for selected interfaces
Arguments: none
Returns: none
rx_en
Enable receive mode for selected interfaces
Arguments: none
Returns: none
tx_rx_dis
Disable transmit and receive for selected interfaces (standby mode)
Arguments: none
Returns: none
rx_gain_mode
Sets the gain selection mode
Arguments: (string MODE) MODE: 'automatic' for AGC, or 'manual' for manual gain control
Returns: none
-
13
channel
Tune selected interfaces to the specified band and channel
Arguments: (float BAND, int CHAN) BAND: Must be 2.4 or 5, to select 2.4GHz or 5GHz channels CHAN: Must be integer in [1,11] for BAND=2.4, [1,23] for BAND=5
Returns: none
BAND and CHAN must be scalars (same values for all specified interfaces) or 1-D vectors (one value per interface) with length equal to the length of the interface ID vector
Band/Channel - Center Frequency Map:
2.4GHz 5GHz
Chan Freq Chan Freq
1 2412 1 5180
2 2417 2 5200
3 2422 3 5220
4 2427 4 5240
5 2432 5 5260
6 2437 6 5280
7 2442 7 5300
8 2447 8 5320
9 2452 9 5500
10 2457 10 5520
11 2462 11 5540
12 5560
13 5580
14 5600
15 5620
16 5640
17 5660
18 5680
19 5700
20 5745
21 5765
22 5785
23 5805
-
14
tx_gains
Sets the gains for the variable gain amplifiers in the MAX2829 Tx path
Refer to MAX2829 datasheet for curves of gain value vs actual gain at 2.4 and 5 GHz
Arguments : (int BB_GAIN, int RF_GAIN) BB_GAIN: Must be integer in [0,1,2,3] for approx ![-5, -3, -1.5, 0]dB baseband gain RF_GAIN: Must be integer in [0:63] for approx [0:31]dB RF gain
Returns: none
BB_GAIN and RF_GAIN must be scalars (same values for all specified interfaces) or 1-D vectors (one value per interface) with length equal to the length of the interface ID vector
rx_gains
Sets the gains for the variable gain amplifiers in the MAX2829 Rx path Refer to MAX2829 datasheet for curves of gain value vs actual gain at 2.4 and 5GHz
Arguments: (int BB_GAIN, int RF_GAIN) BB_GAIN: Must be integer in [0:31] for approx [0:63]dB baseband gain RF_GAIN: Must be integer in [1,2,3] for approx [0,15,30]dB RF gain
Returns: none
BB_GAIN and RF_GAIN must be scalars (same values for all specified interfaces) or 1-D vectors (one value per interface) with length equal to the length of the interface ID vector
tx_lpf_corn_freq
Sets the corner frequency for the MAX2829 Tx path low pass filter Refer to MAX2829 datasheet for curves of the frequency response with each setting
Arguments: (int FILT) FILT: Must be integer in [1,2,3] for approx [12,18,24]MHz corner frequencies ([24,36,48]MHz bandwidths)
Returns: none
FILT must be scalar (same value for all specified interfaces) or 1-D vector (one value per interface) with length equal to the length of the interface ID vector
rx_lpf_corn_freq
Sets the corner frequency for the MAX2829 Rx path low pass filter Refer to MAX2829 datasheet for curves of the frequency response with each setting
Arguments: (int FILT) FILT: Must be integer in [0,1,2,3] for approx ![7.5,9.5,14,18]MHz corner frequencies ([15,19,28,36]MHz bandwidths)
Returns: none
FILT must be scalar (same value for all specified interfaces) or 1-D vector (one value per interface) with length equal to the length of the interface ID vector
-
15
Baseband Commands
Baseband commands are selected as string inputs to the wl_basebandCmd method. These string
are each individual cases of the switch statement in procCmd.
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
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.
-
16
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
-
17
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)
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]]
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
-
18
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.
-
19
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
-
20
Transport Commands
Transport commands are selected as string inputs to the wl_transportCmd method. These
string are each individual cases of the switch statement in procCmd.
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_transportCmd(N, command_string, arg1, arg2, ..., argN)
Syntax 2: N.wl_transportCmd(command_string, arg1, arg2, ..., argN)
These two different forms of syntax are identical and either may be used for issuing commands to WARP nodes.
Command List
ping
Test to make sure node can be accessed via this transport
Arguments: none
Returns: true if board responds; raises error otherwise
payload_size_test
Determine's objects maxPayload parameter
Arguments: none
Returns: none
-
21
Trigger Manager Commands
Trigger commands are selected as string inputs to the wl_transportCmd method. These string
are each individual cases of the switch statement in procCmd.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_transportCmd(N, command_string, arg1, arg2, ..., argN)
Syntax 2: N.wl_transportCmd(command_string, arg1, arg2, ..., argN)
These two different forms of syntax are identical and either may be used for issuing commands to WARP nodes.
Command List
add_trigger_input
Associates node to a trigger input
Arguments: (wl_trigger_manager TRIGGER)
Returns: none
delete_trigger_input
Deassociates node to a trigger input
Arguments: (wl_trigger_manager TRIGGER)
Returns: none
clear_trigger_input
Clears all trigger associations in the node
Arguments: none
Returns: none
get_trigger_input
Reads current trigger association from node
Arguments: node
Returns: (uint32 TRIGGER_ASSOCIATION) TRIGGER_ASSOCIATION: bit-wise AND of associated trigger IDs
test_trigger
Sends a test trigger
Arguments: none
Returns: none
-
22
Example of usage
Digital Communication
An application of the WARPLab is SISO Digital Communication. We generate the data bit and
compress with the carrier signal before transmit. We need to find the bit error rate of the transmission by
comparing the transmitted bit and the received bit. The experiment can be divided into 4 parts.
First, we have to set up the WARPLab by initialize the nodes object, create a UDP broadcast trigger
and tell each other to be ready for transmission. In this case, we deal with the SISO transmission, so the
number of nodes are 2.
Next, getting IDs for the interfaces on the boards and set up the interface for the experiment. In this example, we assumes each board has the same interface capabilities, we only need to get the IDs from one of the boards. The gain control can be setting manually by assigning USE_AGC = false, then you can set the gain of receiver for the baseband and radio frequency. Otherwise it will be automatically setting. After that, we will use the transmitters I/Q buffer size to determine how long our transmission can be and set up the baseband for the experiment.
NUMNODES = 2; nodes = wl_initNodes(NUMNODES); trig = wl_trigger_eth_udp_broadcast; wl_triggerManagerCmd(nodes,'add_trigger_input',[trig]);
[RFA,RFB,RFC,RFD] = wl_getInterfaceIDs(nodes(1));
wl_interfaceCmd(nodes,RFA,'tx_gains',1,10); wl_interfaceCmd(nodes,RFA,'channel',2.4,11);
USE_AGC = false;
if(USE_AGC) wl_interfaceCmd(nodes,RFA,'rx_gain_mode','automatic'); wl_basebandCmd(nodes,'agc_target',-10); wl_basebandCmd(nodes,'agc_trig_delay', 500); wl_basebandCmd(nodes,'agc_dco', true); else wl_interfaceCmd(nodes,RFA,'rx_gain_mode','manual'); RxGainRF = 1; %Rx RF Gain in [1:3] RxGainBB = 10; %Rx Baseband Gain in [0:31] wl_interfaceCmd(nodes,RFA,'rx_gains',RxGainRF,RxGainBB); end
txLength = nodes(1).baseband.txIQLen;
wl_basebandCmd(nodes,'tx_delay',0); wl_basebandCmd(nodes,'tx_length',txLength);
-
23
Second, we need to generate the transmit signal. The transmit signal consist of 2 parts, the preamble for AGC which corresponds to the short symbols from the 802.11a PHY standard and the payload which is our data This example, we deal with the BPSK communication, a digital modulation that convey the data by modulating the phase of the reference signal. The digital data bits are randomly generated from the function randi([0 1], NSym, 1). The data bit are sent as an impulse, bandlimit in time-domain but unlimited bandwidth in frequency domain. So we need to convolve with some bandlimited pulse in frequency domain. The pulse shaping is setting by a function mypulseshape (...).
shortSymbol_freq = [0 0 0 0 0 0 0 0 1+i 0 0 0 -1+i 0 0 0 -1-i 0 0 0
1-i 0 0 0 -1-i 0 0 0 1-i 0 0 0 0 0 0 0 1-i 0 0 0 -1-i 0 0 0 1-i 0 0
0 -1-i 0 0 0 -1+i 0 0 0 1+i 0 0 0 0 0 0 0].'; shortSymbol_freq = [zeros(32,1);shortSymbol_freq;zeros(32,1)]; shortSymbol_time = ifft(fftshift(shortSymbol_freq)); shortSymbol_time =
(shortSymbol_time(1:32).')./max(abs(shortSymbol_time)); shortsyms_rep = repmat(shortSymbol_time,1,30);
preamble = shortsyms_rep; preamble = preamble(:);
Ts = 1/(wl_basebandCmd(nodes(1),'tx_buff_clk_freq')); % Create time vector(Sample Frequency is Ts (Hz)) t = [0:Ts:((txLength-length(preamble)-1))*Ts].';
NZeros = 3; nsamp = NZeros+1; % --------------------------- BPSK -------------------------------- NSym = ((2^15)-length(preamble)-200)/(NZeros+1);% number of symbols b = randi([0 1], NSym, 1); % random data bit x0 = [x.'; zeros(NZeros,NSym)]; % zero expansion x0 = x0(:); % ----------------------- pulse shaping---------------------------- g = mypulseshape(NZeros,Ts,'rc');
xTx = conv(x0,g,'same'); payload_A = xTx;
txData_A = [preamble; payload_A]; txData = [txData_A];
node_tx = nodes(1); node_rx = nodes(2);
-
24
Command Reference:
mypulseshape()
set the shape of the pulse that we need to compress with the data bits.
inputs: (number_of_zero, time, type_of_pulse)
Returns: pulse signal
Type of pulse value of type_of_pulse
rectangular rect
raise cosine rc
sinc sinc
Gaussian gaussian
Pulse shaping is a method to reduce sidelobe energy relative to the pulse and must be done in such a way that intersymbol interference (ISI) between pulse in the received signal is not introduced. Third, transmit and receive signal using WARPLab. The commands refer to reference design in WARPLab Framework part. Forth, after we received the data, we need to checking the bit error rate by applied the cross correlation technique, comparing the transmit and received signal, to find the range of the preamble and the payload. We extract the data bits by sampling every nsamp.
wl_basebandCmd(node_tx,[RFA], 'write_IQ', txData); wl_interfaceCmd(node_tx,RFA,'tx_en'); wl_interfaceCmd(node_rx,RFA,'rx_en');
wl_basebandCmd(node_tx,RFA,'tx_buff_en'); wl_basebandCmd(node_rx,RFA,'rx_buff_en');
trig.send();
rx_IQ = wl_basebandCmd(node_rx,[RFA],'read_IQ', 0, txLength);
rx_RSSI = wl_basebandCmd(node_rx,[RFA],'read_RSSI');
wl_basebandCmd(nodes,RFA,'tx_rx_buff_dis'); wl_interfaceCmd(nodes,RFA,'tx_rx_dis');
c = myxcorr(rx_IQ,preamble); [cMax,startPreamble] = max(c);
p = angle(cMax); % compute the phase of the preamble startPayload = startPreamble + length(preamble) + 1; y = exp(-1i*p)*rx_IQ(startPayload:end); yData = y(1:nsamp:4*NSym); % sampling for extract the data bit
bEst = (1-sign(real(yData)))/2; % bit estimate
ber = sum(abs(b(1:length(bEst))-bEst))/length(bEst)% bit error rate
-
25
Command Reference:
myxcorr()
compute the cross correlation technique to find the range of preamble and payload
inputs: (received_signal, preamble)
Returns: value and index from the calculation
Finally, we compute the bandwidth of the transmission from the function mybandwidth() Command Reference:
mybandwidth()
compute the bandwidth of the transmission
inputs: (transmit_signal, received_signal, number_of_zero, frequency, type_of_pulse)
Returns: bandwidth of the transmission
Type of pulse value of type_of_pulse
rectangular rect
raise cosine rc
sinc sinc
gaussian gaussian
MyBW = mybandwidth(xTx,y,NZeros,fA,'rc')
-
26
Result
(a.) (b.)
Figure 9 : Visualize of the transmission using raise cosine pulse (a.) 3 number of zeros (b.) 15 number of zero
-
27
(a.) (b.)
Figure 10 : Visualize of the transmission using sinc pulse (a.) 3 number of zeros (b.) 15 number of zero
-
28
Figure 9 and Figure 10 show the transmit and receive signals, the spectrum of the transmit and
receive signals, and the pulse shape used for BPSK. According to the result, we can prove the theory that a
raise cosine function in time-domain will be a sinc function in frequency-domain and a sinc function in time-
domain is a rectangular function in frequency-domain. Refer to the second row of the figures, the spectrum
of transmit and receive signal, the black color is a spectrum of the transmit signal, the blue color is the
spectrum of the receive signal and the red line is a theoretical signal. We also learn that the more number of
zero, the less bandwidth of transmission, that means the less bits can be sent and received as shown in Table
1. Table 1 is an observation of the effect in number of zero with each pulse shape to the bandwidth and
accuracy of transmission.
Table 1: The statistic of the result for each pulse shape and sample number of zeros.
rectangular raise cosine sinc gaussian
no. Zero 3 5 15 3 5 15 3 5 15 3 5 15
Bit sent 7902 5268 1975 7902 5268 1975 7902 5268 1975 7902 5268 1975
Bit received 7902 3512 494 7902 3512 494 7902 3512 494 7902 3512 494 Percentage of transmission
100 66.7 25 100 66.7 25 100 66.7 25 100 66.7 25
error 0 0 0 0 0 0 0 0.001 0 0.02 0.04 0.08
Bandwidth 20.1 13.4 - 20.1 13.5 - 13.8 7.9 - 16.2 12.6 -
-
29
Appendix
Binary Phase Shift Keying (BPSK)
Binary Phase Shift Keying(BPSK or 2PSK) or Phase reversal Keying(PRK) is one of the simplest form of
digital modulation. It uses two phases which are separated by 180 and so can also be termed 2-PSK. It does
not particularly matter exactly where the constellation points are positioned, and in this Figure A1 they are
shown on the real axis, at 0 and . This modulation is the most robust of all the PSKs since it takes the highest
level of noise or distortion to make the demodulator reach an incorrect decision. However, only able to
modulate at 1 bit/symbol (as seen in the figure) and so is unsuitable for high data-rate applications.
In the presence of an arbitrary phase-shift introduced by the communications channel, the demodulator is
unable to tell which constellation point is which. As a result, the data is often differentially encoded prior to
modulation.
BPSK is functionally equivalent to 2-QAM modulation.
Implementation
The general form for BPSK follows the equation:
where fc is the frequency of the carrier-wave.
Bit error rate of BPSK
The bit error rate (BER) of BPSK in AWGN can be calculated as:
or
Since there is only one bit per symbol, this is also the symbol error rate.
-
30
Cross Correlation Cross correlation is a technique of checking similarity of two waveforms as a function of a time-lag
applied to one of them. This is also known as a sliding dot product or sliding inner-product. The cross-
correlation is similar in nature to the convolution of two functions.
For continuous functions, f and g, the cross-correlation is defined as:
where f *() denotes the complex conjugate of f().
Similarly, for discrete functions, the cross-correlation is defined as:
-
31
MATLAB Function Reference
mypulseshape()
function ps = mypulseshape(NZeros,Ts,shape)
% number of sampling nsamp = NZeros+1; % rectangular if strcmp(shape,'rect') nt = ones(nsamp,1); ps = [zeros(nsamp/4,1); nt;zeros(nsamp/4,1)]; end % raise cosine if strcmp(shape,'rc') filtorder = nsamp*4; delay = filtorder/(nsamp*2); rolloff = 1; rrcfilter = rcosine(1,nsamp,'fir/normal',rolloff,delay); ps = rrcfilter; end % sinc if strcmp(shape,'sinc') fsinc = 1/nsamp; % number of periods Np = 100; tsinc = (-Np*(nsamp-1):Np*(nsamp-1))*Ts; T0 = NZeros*Ts; ps = sinc(tsinc/T0); end % gaussian if strcmp(shape,'gaussian') bt = 0.2; % 3-dB bandwidth-symbol time (b is the one-sided
bandwidth in Hz. Smaller bt, larger pulse widths.) o = nsamp; % Oversampling factor (number of samples per symbol) n = 2; % number of symbol periods between the start of impulse
response and its peak. ps = gaussfir(bt,n,o); end
myxcorr()
function c = myxcorr(x,y)
N = length(x); M = length(y);
for k=1:N c(k) = 0; for l=1:M c(k) = c(k) + x(min(N,k+l))*conj(y(min(M,l))); end end
-
32
mybandwidh()
function bw = mybandwidth(xTx,y,NZeros,fA,type)
TA = 1/fA; TTx = length(xTx)*TA;TRx = length(y)*TA; fTx = -1/2/TA+1/TTx:1/TTx:1/2/TA; fRx = -1/2/TA+1/TRx:1/TRx:1/2/TA;
temp = 0;
if strcmp(type,'rect') num = 1000; x = sinc(fTx*TA*(NZeros+1)); else if strcmp(type,'rc') num = 500; x = sinc(fTx*TA*(NZeros+1)); else if strcmp(type,'sinc') num = 300; x = rectangularPulse(fTx*TA*(NZeros)); temp = 1; else if strcmp(type,'gaussian') num = 1000; x = sinc(fTx*TA*(NZeros+1)); end end end end if temp == 1 x_smooth = x; M = length(x_smooth); idx = find(x_smooth); z_idx = idx(1); y_idx = idx(end); else if temp == 0 x_smooth = 20*log10(abs(x)); M = length(x_smooth); [my,m] = max(x_smooth); for i=m+5000:M-num a(i) = mean(x_smooth(i-num/2:i)); b(i) = mean(x_smooth(i:i+num/2)); if a(i)-b(i) < 0 y = x_smooth(i); y_idx = i; break end end for j=m-5000:-1:num c(j) = mean(x_smooth(j:j+num/2)); d(j) = mean(x_smooth(j-num/2:j)); if c(j)-d(j) < 0 z = x_smooth(j); z_idx = j; break end end end end fB1 = fRx(z_idx);
fB2 = fRx(y_idx); bw = fB2-fB1;
-
33
Reference
- http://warp.rice.edu/trac
- John B. Anderson, Digital Transmission Engineering, 2nd Edition, Wiley-Interscience, 2005
- V. Chandra Sekar, Communication systems, Oxford University Press, 2012
- David Tse and Pramod Viswanath, Fundamentals of Wireless Communication, Cambridge University
Press, 2005
- http://www2.siit.tu.ac.th/prapun/ecs455/index.html
- http://www2.siit.tu.ac.th/prapun/ecs332/index.html
- http://en.wikipedia.org/wiki/Phase-shift_keying#timing
- http://en.wikipedia.org/wiki/Cross-correlation
- http://en.wikipedia.org/wiki/Bandwidth