Commit 94c024f6 authored by Oscar Bejarano's avatar Oscar Bejarano

Add CBRS check and one-gain-setting

parent 0f4f05db
......@@ -172,7 +172,7 @@ def agc_thread():
ch = 0
# Arbitrary - start off with some "decent" initial fixed gain
rxgain_init = 90
sdr.setGain(SOAPY_SDR_RX, ch, rxgain_init) # w/CBRS 3.6GHz [0:105], 2.5GHZ [0:108]
sdr.setGain(SOAPY_SDR_RX, ch, rxgain_init)
time.sleep(0.1) # Let gain settle
time.sleep(5) # Wait for "demo" purposes
print(" ********** AGC KICKS IN ********** ")
......
......@@ -15,6 +15,17 @@
on the base station
(NOTICE THERE'S NO SPACES BETWEEN SERIAL NUMBERS!)
NOTE ON GAINS:
Gain settings will vary depending on RF frontend board being used
If using CBRS:
rxgain: at 2.5GHz [3:1:105], at 3.6GHz [3:1:102]
txgain: at 2.5GHz [16:1:93], at 3.6GHz [15:1:102]
If using only Dev Board:
rxgain: at both frequency bands [0:1:30]
txgain: at both frequency bands [0:1:42]
---------------------------------------------------------------------
Copyright © 2018-2019. Rice University.
RENEW OPEN SOURCE LICENSE: http://renew-wireless.org/license
......@@ -45,6 +56,7 @@ from generate_sequence import *
sdrs = None
hub_dev = None
def beamsweeper(hub, serials, rate, freq, txgain, rxgain, numSamps, numSyms, prefix_length, postfix_length, calibrate, both_channels):
global sdrs, hub_dev
if hub != "": hub_dev = SoapySDR.Device(dict(serial=hub))
......@@ -55,7 +67,7 @@ def beamsweeper(hub, serials, rate, freq, txgain, rxgain, numSamps, numSyms, pre
for sdr in sdrs:
info = sdr.getHardwareInfo()
print("%s settings on device" % (info["frontend"]))
for ch in [0,1]:
for ch in [0, 1]:
sdr.setBandwidth(SOAPY_SDR_RX, ch, 2.5*rate)
sdr.setBandwidth(SOAPY_SDR_TX, ch, 2.5*rate)
sdr.setSampleRate(SOAPY_SDR_TX, ch, rate)
......@@ -64,16 +76,24 @@ def beamsweeper(hub, serials, rate, freq, txgain, rxgain, numSamps, numSyms, pre
sdr.setFrequency(SOAPY_SDR_RX, ch, "BB", 0.75*rate)
sdr.setFrequency(SOAPY_SDR_TX, ch, "RF", freq - 0.75*rate)
sdr.setFrequency(SOAPY_SDR_RX, ch, "RF", freq - 0.75*rate)
sdr.setGain(SOAPY_SDR_TX, ch, txgain)
sdr.setGain(SOAPY_SDR_RX, ch, rxgain)
sdr.setAntenna(SOAPY_SDR_RX, ch, "TRX")
for ch in [0,1]:
sdr.setDCOffsetMode(SOAPY_SDR_RX, ch, True)
if calibrate:
sdr.writeSetting(SOAPY_SDR_RX, ch, "CALIBRATE", 'SKLK')
sdr.writeSetting(SOAPY_SDR_TX, ch, "CALIBRATE", '')
sdr.setDCOffsetMode(SOAPY_SDR_RX, ch, True)
if "CBRS" in info["frontend"]:
# Set gains to high val (initially)
sdr.setGain(SOAPY_SDR_TX, ch, txgain) # txgain: at 2.5GHz [16:1:93], at 3.6GHz [15:1:102]
sdr.setGain(SOAPY_SDR_RX, ch, rxgain) # rxgain: at 2.5GHz [3:1:105], at 3.6GHz [3:1:102]
else:
# No CBRS board gains, only changing LMS7 gains
sdr.setGain(SOAPY_SDR_TX, ch, "PAD", txgain) # [0:1:42]
sdr.setGain(SOAPY_SDR_TX, ch, "IAMP", 0) # [-12:1:3]
sdr.setGain(SOAPY_SDR_RX, ch, "LNA", rxgain) # [0:1:30]
sdr.setGain(SOAPY_SDR_RX, ch, "TIA", 0) # [0, 3, 9, 12]
sdr.setGain(SOAPY_SDR_RX, ch, "PGA", -10) # [-12:1:19]
if not both_channels:
sdr.writeSetting(SOAPY_SDR_RX, 1, 'ENABLE_CHANNEL', 'false')
......@@ -134,6 +154,7 @@ def beamsweeper(hub, serials, rate, freq, txgain, rxgain, numSamps, numSyms, pre
hub_dev.writeSetting("TRIGGER_GEN", "")
signal.pause()
def signal_handler(rate, numSyms, signal, frame):
global sdrs, hub_dev
print("printing number of frames")
......@@ -148,14 +169,15 @@ def signal_handler(rate, numSyms, signal, frame):
hub_dev = None
sys.exit(0)
def main():
parser = OptionParser()
parser.add_option("--hub", type="string", dest="hub", help="serial number of the hub device", default="")
parser.add_option("--serials", type="string", dest="serials", help="serial numbers of the devices", default="")
parser.add_option("--rate", type="float", dest="rate", help="Tx sample rate", default=5e6)
parser.add_option("--freq", type="float", dest="freq", help="Optional Tx freq (Hz)", default=3.6e9)
parser.add_option("--txgain", type="float", dest="txgain", help="Optional Tx gain (dB) w/CBRS 3.6GHz [0:105], 2.5GHZ [0:105]", default=30.0)
parser.add_option("--rxgain", type="float", dest="rxgain", help="Optional Rx gain (dB) w/CBRS 3.6GHz [0:105], 2.5GHZ [0:108]", default=30.0)
parser.add_option("--txgain", type="float", dest="txgain", help="Optional Tx gain (dB)", default=30.0)
parser.add_option("--rxgain", type="float", dest="rxgain", help="Optional Rx gain (dB)", default=30.0)
parser.add_option("--numSamps", type="int", dest="numSamps", help="Num samples to receive", default=512)
parser.add_option("--prefix-length", type="int", dest="prefix_length", help="prefix padding length for beacon and pilot", default=82)
......
......@@ -11,6 +11,17 @@
downlink data is transmitted and received by the client(s). If successful,
equalization is done for each received client stream.
NOTE ON GAINS:
Gain settings will vary depending on RF frontend board being used
If using CBRS:
rxgain: at 2.5GHz [3:1:105], at 3.6GHz [3:1:102]
txgain: at 2.5GHz [16:1:93], at 3.6GHz [15:1:102]
If using only Dev Board:
rxgain: at both frequency bands [0:1:30]
txgain: at both frequency bands [0:1:42]
Example Usage:
python3 MMIMO_DOWNLINK.py --bnodes="../IrisUtils/data_in/bs_serials.txt"
--cnodes="../IrisUtils/data_in/cl_serials.txt"
......@@ -67,7 +78,6 @@ def signal_handler(signum, frame):
def init(hub, bnodes, cnodes, ref_ant, ampl, rate, freq, txgain, rxgain, cp, plotter, numSamps, prefix_length, postfix_length, tx_advance, mod_order, threshold, use_trig):
if hub != "": hub_dev = SoapySDR.Device(dict(driver="remote", serial = hub)) # device that triggers bnodes and ref_node
bsdrs = [SoapySDR.Device(dict(driver="iris", serial = serial)) for serial in bnodes] # base station sdrs
csdrs = [SoapySDR.Device(dict(driver="iris", serial = serial)) for serial in cnodes] # client sdrs
# assume trig_sdr is part of the master nodes
trig_dev = None
......@@ -91,17 +101,19 @@ def init(hub, bnodes, cnodes, ref_ant, ampl, rate, freq, txgain, rxgain, cp, plo
sdr.setFrequency(SOAPY_SDR_RX, ch, 'RF', freq-.75*rate)
sdr.setFrequency(SOAPY_SDR_TX, ch, 'BB', .75*rate)
sdr.setFrequency(SOAPY_SDR_RX, ch, 'BB', .75*rate)
sdr.setAntenna(SOAPY_SDR_RX, ch, "TRX")
sdr.setDCOffsetMode(SOAPY_SDR_RX, ch, True)
sdr.setGain(SOAPY_SDR_TX, ch, 'PAD', txgain)
sdr.setGain(SOAPY_SDR_TX, ch, 'ATTN', -6)
sdr.setGain(SOAPY_SDR_RX, ch, 'LNA', rxgain)
sdr.setGain(SOAPY_SDR_RX, ch, 'LNA2', 14)
if freq < 3e9:
sdr.setGain(SOAPY_SDR_RX, ch, 'ATTN', -12)
else:
sdr.setGain(SOAPY_SDR_RX, ch, 'ATTN', 0)
sdr.setAntenna(SOAPY_SDR_RX, ch, "TRX")
sdr.setDCOffsetMode(SOAPY_SDR_RX, ch, True)
if "CBRS" in info["frontend"]:
sdr.setGain(SOAPY_SDR_TX, ch, 'ATTN', -6)
sdr.setGain(SOAPY_SDR_RX, ch, 'LNA2', 14)
if freq < 3e9:
sdr.setGain(SOAPY_SDR_RX, ch, 'ATTN', -12)
else:
sdr.setGain(SOAPY_SDR_RX, ch, 'ATTN', 0)
# Read initial gain settings
readLNA = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA')
......@@ -679,8 +691,8 @@ def main():
parser.add_option("--ampl", type="float", dest="ampl", help="Amplitude coefficient for downCal/upCal", default=0.5)
parser.add_option("--rate", type="float", dest="rate", help="Tx sample rate", default=5e6)
parser.add_option("--freq", type="float", dest="freq", help="Optional Tx freq (Hz)", default=3.59e9)
parser.add_option("--txgain", type="float", dest="txgain", help="Optional Tx gain (dB)", default=40.0) # w/CBRS 3.6GHz [0:105], 2.5GHZ [0:105]
parser.add_option("--rxgain", type="float", dest="rxgain", help="Optional Rx gain (dB)", default=20.0) # w/CBRS 3.6GHz [0:105], 2.5GHZ [0:108]
parser.add_option("--txgain", type="float", dest="txgain", help="Optional Tx gain (dB)", default=40.0)
parser.add_option("--rxgain", type="float", dest="rxgain", help="Optional Rx gain (dB)", default=20.0)
parser.add_option("--bw", type="float", dest="bw", help="Optional Tx filter bw (Hz)", default=10e6)
parser.add_option("--cp", action="store_true", dest="cp", help="adds cyclic prefix to tx symbols", default=True)
parser.add_option("--plotter", action="store_true", dest="plotter", help="continuously plots all signals and stats",default=False)
......
This diff is collapsed.
......@@ -29,8 +29,18 @@
sdr.writeRegister("IRIS30", FPGA_IRIS030_WR_PKT_DET_NEW_FRAME, 1)
Usage example: python3 SISO_RX.py --serial="RF3C000034" --rxMode="REC" --AGCen=1
Currently, AGC only supports the CBRS RF frontend. It cannot be used
with the Iris Dev Board or UHF board
NOTE ON GAINS:
Gain settings will vary depending on RF frontend board being used
If using CBRS:
rxgain: at 2.5GHz [3:1:105], at 3.6GHz [3:1:102]
If using only Dev Board:
rxgain: at both frequency bands [0:1:30]
Usage example: python3 SISO_RX.py --serial="RF3C000034" --rxMode="REC" --AGCen=1
---------------------------------------------------------------------
Copyright © 2018-2019. Rice University.
RENEW OPEN SOURCE LICENSE: http://renew-wireless.org/license
......@@ -215,24 +225,34 @@ def rxsamples_app(srl, freq, gain, num_samps, recorder, agc_en, wait_trigger):
info = sdr.getHardwareInfo()
print(info)
# Set gains to very high value if AGC enabled.
if agc_en:
# Set gains to very high value if AGC enabled (AGC only supports CBRS RF frontend at the moment).
if agc_en and "CBRS" in info["frontend"]:
gain = 100
rssi_target_idx = 20
agc_init(sdr, rssi_target_idx)
else:
# Make sure AGC is disabled if any of the previous checks fails
agc_en = 0
# Set params on both channels (both RF chains)
for ch in [0, 1]:
# sdr.setBandwidth(SOAPY_SDR_RX, ch, 3*Rate)
# sdr.setBandwidth(SOAPY_SDR_TX, ch, 3*Rate)
sdr.setBandwidth(SOAPY_SDR_RX, ch, 2.5*Rate)
sdr.setBandwidth(SOAPY_SDR_TX, ch, 2.5*Rate)
sdr.setFrequency(SOAPY_SDR_RX, ch, freq)
sdr.setSampleRate(SOAPY_SDR_RX, ch, Rate)
sdr.setFrequency(SOAPY_SDR_TX, ch, freq)
sdr.setSampleRate(SOAPY_SDR_TX, ch, Rate)
sdr.setGain(SOAPY_SDR_RX, ch, gain)
# sdr.setAntenna(SOAPY_SDR_RX, ch, "TRX")
sdr.setAntenna(SOAPY_SDR_RX, ch, "TRX")
sdr.setDCOffsetMode(SOAPY_SDR_RX, ch, True)
if "CBRS" in info["frontend"]:
sdr.setGain(SOAPY_SDR_RX, ch, gain)
else:
# No CBRS board gains, only changing LMS7 gains
sdr.setGain(SOAPY_SDR_RX, ch, "LNA", gain) # [0:1:30]
sdr.setGain(SOAPY_SDR_RX, ch, "TIA", 0) # [0, 3, 9, 12]
sdr.setGain(SOAPY_SDR_RX, ch, "PGA", -10) # [-12:1:19]
print("Number of Samples %d " % num_samps)
print("Frequency has been set to %f" % sdr.getFrequency(SOAPY_SDR_RX, 0))
sdr.writeRegister("RFCORE", 120, 0)
......@@ -243,15 +263,15 @@ def rxsamples_app(srl, freq, gain, num_samps, recorder, agc_en, wait_trigger):
# RSSI read setup
setUpDigitalRssiMode(sdr)
#anim = animation.FuncAnimation(fig, animate, init_func=init, fargs=(num_samps, recorder, agc_en, wait_trigger), frames=100,
# interval=100, blit=True)
anim = MyFuncAnimation(fig, animate, init_func=init, fargs=(num_samps, recorder, agc_en, wait_trigger), frames=100,
interval=100, blit=True)
# There's a bug in the FuncAnimation function, we replaced it with a fixed version
# anim = animation.FuncAnimation(fig, animate, init_func=init, fargs=(num_samps, recorder, agc_en, wait_trigger),
# frames=100, interval=100, blit=True)
anim = MyFuncAnimation(fig, animate, init_func=init, fargs=(num_samps, recorder, agc_en, wait_trigger, info),
frames=100, interval=100, blit=True)
plt.show()
def animate(i, num_samps, recorder, agc_en, wait_trigger):
def animate(i, num_samps, recorder, agc_en, wait_trigger, info):
global sdr, rxStream, freqScale, sampsRx, frameCounter, fft_size, Rate, num_samps_circ_buff, rssi_circ_buff, pwr_circ_buff
# Trigger AGC
......@@ -336,12 +356,18 @@ def animate(i, num_samps, recorder, agc_en, wait_trigger):
noisPwrBuffer.append(noiseFloor)
rssiPwrBuffer_fpga.append(PWRdBm_fpga)
# Current gain values?
lna_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA') # ChanA (0)
tia_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'TIA') # ChanA (0)
pga_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'PGA') # ChanA (0)
lna1_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA1') # ChanA (0)
lna2_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA2') # ChanA (0)
attn_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'ATTN') # ChanA (0)
if "CBRS" in info["frontend"]:
lna1_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA1') # ChanA (0)
lna2_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA2') # ChanA (0)
attn_rd = sdr.getGain(SOAPY_SDR_RX, 0, 'ATTN') # ChanA (0)
else:
lna1_rd = []
lna2_rd = []
attn_rd = []
# Moving average (just for visualization purposes)
circ_buff_idx = frameCounter % num_samps_circ_buff
......@@ -353,9 +379,8 @@ def animate(i, num_samps, recorder, agc_en, wait_trigger):
# Count number of frames received
frameCounter = frameCounter + 1
# print("RSSI: {} \t PWR: {} \t LNA: {} \t TIA: {} \t PGA: {} \t XXXXX LNA1: {} \t LNA2: {} \t ATTN: {}".format(rssi_fpga, PWRdBm_fpga, lna_rd, tia_rd, pga_rd, lna1_rd, lna2_rd, attn_rd))
print("RSSI: {} \t PWR: {} \t XXX ATTN: {} \t LNA1: {} \t LNA2: {} \t LNA: {} \t TIA: {} \t PGA: {} ".format(rssi_buff_avg, pwr_buff_avg, attn_rd, lna1_rd, lna2_rd, lna_rd, tia_rd, pga_rd))
#print("RSSI_LMS7 rssi and dBFS: {} {} \t RSSI: {} \t PWR: {}".format(rssi_buff_avg, pwr_buff_avg, rssi, PWRdBFS))
print("RSSI: {} \t PWR: {} \t ||| GAINS - ATTN: {} \t LNA1: {} \t LNA2: {} \t LNA: {} \t TIA: {} \t PGA: {} ".format(
rssi_buff_avg, pwr_buff_avg, attn_rd, lna1_rd, lna2_rd, lna_rd, tia_rd, pga_rd))
# Fill out data structures with measured data
line1.set_data(range(buff0.size), np.real(sampsRx[0]))
......@@ -406,7 +431,7 @@ def replay(name, leng):
def main():
parser = OptionParser()
parser.add_option("--label", type="string", dest="label", help="label for recorded file name", default="rx2.600GHz_TEST.hdf5")
parser.add_option("--rxgain", type="float", dest="rxgain", help="RX GAIN: 2.5GHz [0:108](dB), 3.6GHz [0:105] (dB)", default=65.0)
parser.add_option("--rxgain", type="float", dest="rxgain", help="RX GAIN (dB)", default=65.0) # See documentation at top of file for info on gain range
parser.add_option("--latitude", type="float", dest="latitude", help="Latitude", default=0.0)
parser.add_option("--longitude", type="float", dest="longitude", help="Longitude", default=0.0)
parser.add_option("--elevation", type="float", dest="elevation", help="Elevation", default=0.0)
......
......@@ -9,6 +9,14 @@
Usage example: python3 SISO_TX.py --serial="RF3C000047"
NOTE ON GAINS:
Gain settings will vary depending on RF frontend board being used
If using CBRS:
gain: at 2.5GHz [16:1:93], at 3.6GHz [15:1:102]
If using only Dev Board:
gain: at both frequency bands [0:1:42]
---------------------------------------------------------------------
Copyright © 2018-2019. Rice University.
RENEW OPEN SOURCE LICENSE: http://renew-wireless.org/license
......@@ -97,11 +105,12 @@ def siggen_app(args, rate, ampl, ant, gain, freq, bbfreq, waveFreq, numSamps, se
sdr.writeSetting(SOAPY_SDR_TX, c, 'TSP_TSG_CONST', str(amplFixed))
sdr.writeSetting(SOAPY_SDR_TX, c, 'TX_ENB_OVERRIDE', 'true')
#sdr.setGain(SOAPY_SDR_TX, c, gain)
sdr.setGain(SOAPY_SDR_TX, c, "PAD", gain)
sdr.setGain(SOAPY_SDR_TX, c, "IAMP", 0)
sdr.setGain(SOAPY_SDR_TX, c, "PA2", 0)
sdr.setGain(SOAPY_SDR_TX, c, "ATTN", -6)
if "CBRS" in info["frontend"]:
sdr.setGain(SOAPY_SDR_TX, c, gain)
else:
# No CBRS board gains, only changing LMS7 gains
sdr.setGain(SOAPY_SDR_TX, c, "PAD", gain) # [0:1:42]
sdr.setGain(SOAPY_SDR_TX, c, "IAMP", 0) # [-12:1:3]
# Generate TX signal
txSignal = np.empty(numSamps).astype(np.complex64)
......@@ -149,14 +158,19 @@ def siggen_app(args, rate, ampl, ant, gain, freq, bbfreq, waveFreq, numSamps, se
sdr.writeRegisters("TX_RAM_B", replay_addr, pilot1_ui32.tolist())
sdr.writeSetting("TX_REPLAY", str(numSamps)) # this starts transmission
# Selected gains
IAMP = sdr.getGain(SOAPY_SDR_TX, 0, "IAMP")
PAD = sdr.getGain(SOAPY_SDR_TX, 0, "PAD")
PA1 = sdr.getGain(SOAPY_SDR_TX, 0, "PA1")
PA2 = sdr.getGain(SOAPY_SDR_TX, 0, "PA2")
PA3 = sdr.getGain(SOAPY_SDR_TX, 0, "PA3")
ATTN = sdr.getGain(SOAPY_SDR_TX, 0, "ATTN")
print("GAINS: {}, {}, {}, {}, {}, {}".format(PA1, PA3, PA2, ATTN, PAD, IAMP))
# Show current gains
if "CBRS" in info["frontend"]:
IAMP = sdr.getGain(SOAPY_SDR_TX, 0, "IAMP")
PAD = sdr.getGain(SOAPY_SDR_TX, 0, "PAD")
PA1 = sdr.getGain(SOAPY_SDR_TX, 0, "PA1")
PA2 = sdr.getGain(SOAPY_SDR_TX, 0, "PA2")
PA3 = sdr.getGain(SOAPY_SDR_TX, 0, "PA3")
ATTN = sdr.getGain(SOAPY_SDR_TX, 0, "ATTN")
print("GAINS CHAN0: PA1 {}, PA3 {}, PA2 {}, ATTN {}, PAD {}, IAMP {}".format(PA1, PA3, PA2, ATTN, PAD, IAMP))
else:
IAMP = sdr.getGain(SOAPY_SDR_TX, 0, "IAMP")
PAD = sdr.getGain(SOAPY_SDR_TX, 0, "PAD")
print("GAINS CHAN0: PAD {}, IAMP {}".format(PAD, IAMP))
# Plot signal
debug = 0
......
......@@ -31,6 +31,18 @@
what each of the Iris boards received from each other (as shown
in the schedule above).
NOTE ON GAINS:
Gain settings will vary depending on RF frontend board being used
If using CBRS:
rxgain: at 2.5GHz [3:1:105], at 3.6GHz [3:1:102]
txgain: at 2.5GHz [16:1:93], at 3.6GHz [15:1:102]
If using only Dev Board:
rxgain: at both frequency bands [0:1:30]
txgain: at both frequency bands [0:1:42]
The code assumes both TX and RX have the same type of RF frontend board.
Example:
python3 SISO_TXRX_TDD.py --serial1="RF3C000042" --serial2="RF3C000025"
......@@ -53,17 +65,7 @@ import math
import json
import matplotlib.pyplot as plt
from type_conv import *
#########################################
# Registers #
#########################################
# TDD Register Set
RF_RST_REG = 48
TDD_CONF_REG = 120
SCH_ADDR_REG = 136
SCH_MODE_REG = 140
TX_GAIN_CTRL = 88
from macros import *
#########################################
......@@ -88,15 +90,22 @@ def siso_tdd_burst(serial1, serial2, rate, freq, txgain, rxgain, numSamps, prefi
sdr.setFrequency(SOAPY_SDR_RX, ch, 'RF', freq-.75*rate)
sdr.setFrequency(SOAPY_SDR_TX, ch, 'BB', .75*rate)
sdr.setFrequency(SOAPY_SDR_RX, ch, 'BB', .75*rate)
sdr.setGain(SOAPY_SDR_TX, ch, txgain)
sdr.setGain(SOAPY_SDR_RX, ch, rxgain)
sdr.setAntenna(SOAPY_SDR_RX, ch, "TRX")
sdr.setDCOffsetMode(SOAPY_SDR_RX, ch, True)
# TX_GAIN_CTRL and SYNC_DELAYS
msdr.writeRegister("IRIS30", TX_GAIN_CTRL, 0)
if "CBRS" in info["frontend"]:
# Set gains to high val (initially)
sdr.setGain(SOAPY_SDR_TX, ch, txgain) # txgain: at 2.5GHz [16:1:93], at 3.6GHz [15:1:102]
sdr.setGain(SOAPY_SDR_RX, ch, rxgain) # rxgain: at 2.5GHz [3:1:105], at 3.6GHz [3:1:102]
else:
# No CBRS board gains, only changing LMS7 gains
sdr.setGain(SOAPY_SDR_TX, ch, "PAD", txgain) # [0:1:42]
sdr.setGain(SOAPY_SDR_TX, ch, "IAMP", 0) # [-12:1:3]
sdr.setGain(SOAPY_SDR_RX, ch, "LNA", rxgain) # [0:1:30]
sdr.setGain(SOAPY_SDR_RX, ch, "TIA", 0) # [0, 3, 9, 12]
sdr.setGain(SOAPY_SDR_RX, ch, "PGA", -10) # [-12:1:19]
# SYNC_DELAYS
bsdr.writeSetting("SYNC_DELAYS", "")
# Packet size
......@@ -215,11 +224,11 @@ def siso_tdd_burst(serial1, serial2, rate, freq, txgain, rxgain, numSamps, prefi
#########################################
def main():
parser = OptionParser()
parser.add_option("--serial1", type="string", dest="serial1", help="serial number of the device 1", default="RF3E000134")
parser.add_option("--serial2", type="string", dest="serial2", help="serial number of the device 2", default="RF3E000191")
parser.add_option("--serial1", type="string", dest="serial1", help="serial number of the device 1", default="")
parser.add_option("--serial2", type="string", dest="serial2", help="serial number of the device 2", default="")
parser.add_option("--rate", type="float", dest="rate", help="Tx sample rate", default=5e6)
parser.add_option("--txgain", type="float", dest="txgain", help="Optional Tx gain (dB)", default=25.0) # w/CBRS 3.6GHz [0:105], 2.5GHZ [0:105]
parser.add_option("--rxgain", type="float", dest="rxgain", help="Optional Tx gain (dB)", default=20.0) # w/CBRS 3.6GHz [0:105], 2.5GHZ [0:108]
parser.add_option("--txgain", type="float", dest="txgain", help="Tx gain (dB)", default=25.0) # See documentation at top of file for info on gain range
parser.add_option("--rxgain", type="float", dest="rxgain", help="Rx gain (dB)", default=20.0) # See documentation at top of file for info on gain range
parser.add_option("--freq", type="float", dest="freq", help="Optional Tx freq (Hz)", default=3.6e9)
parser.add_option("--numSamps", type="int", dest="numSamps", help="Num samples to receive", default=512)
parser.add_option("--prefix-pad", type="int", dest="prefix_length", help="prefix padding length for beacon and pilot", default=82)
......
......@@ -46,7 +46,6 @@
stored in binary files and they can be inspected using plt_simp.py
in the IrisUtils folder
Example:
python3 SOUNDER_TXRX.py --bsnode="RF3C000042" --clnode="RF3C000025"
......@@ -60,6 +59,20 @@
set bsnode to the serial number of a base station node and clnode to the
serial number of a client node!
NOTE ON GAINS:
Gain settings will vary depending on RF frontend board being used
If using CBRS:
rxgain: at 2.5GHz [3:1:105], at 3.6GHz [3:1:102]
txgain: at 2.5GHz [16:1:93], at 3.6GHz [15:1:102]
If using only Dev Board:
rxgain: at both frequency bands [0:1:30]
txgain: at both frequency bands [0:1:42]
The code assumes both TX and RX have the same type of RF frontend board.
Also, currently AGC only supports the CBRS RF frontend. It cannot be used
with the Iris Dev Board or UHF board
---------------------------------------------------------------------
Copyright (c) 2018-2019, Rice University
RENEW OPEN SOURCE LICENSE: http://renew-wireless.org/license
......@@ -157,10 +170,6 @@ def rx_thread(sdr, rxStream, numSamps, txSymNum, both_channels):
if r1<0:
print("Problem activating stream #1")
while (running):
readLNA = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA')
readTIA = sdr.getGain(SOAPY_SDR_RX, 0, 'TIA')
readPGA = sdr.getGain(SOAPY_SDR_RX, 0, 'PGA')
# print("LNA: {}, \t TIA:{}, \t PGA:{}".format(readLNA, readTIA, readPGA))
for j in range(pilotSymNum):
sr = sdr.readStream(rxStream, [waveRxA, waveRxB], numSamps)
#print("BS: readStream returned %d" % sr.ret)
......@@ -210,15 +219,24 @@ def siso_sounder(serial1, serial2, rate, freq, txgain, rxgain, numSamps, numSyms
sdr.setFrequency(SOAPY_SDR_RX, ch, 'RF', freq-.75*rate)
sdr.setFrequency(SOAPY_SDR_TX, ch, 'BB', .75*rate)
sdr.setFrequency(SOAPY_SDR_RX, ch, 'BB', .75*rate)
# Set gains to high val (initially)
if agc_en: rxgain = 100
sdr.setGain(SOAPY_SDR_TX, ch, txgain)
sdr.setGain(SOAPY_SDR_RX, ch, rxgain)
sdr.setAntenna(SOAPY_SDR_RX, ch, "TRX")
sdr.setDCOffsetMode(SOAPY_SDR_RX, ch, True)
if "CBRS" in info["frontend"]:
# Set gains to high val (initially)
if agc_en: rxgain = 100
sdr.setGain(SOAPY_SDR_TX, ch, txgain)
sdr.setGain(SOAPY_SDR_RX, ch, rxgain)
else:
# No CBRS board gains, only changing LMS7 gains
# AGC only supported for CBRS boards
agc_en = False
sdr.setGain(SOAPY_SDR_TX, ch, "PAD", txgain) # [0:1:42]
sdr.setGain(SOAPY_SDR_TX, ch, "IAMP", 0) # [-12:1:3]
sdr.setGain(SOAPY_SDR_RX, ch, "LNA", rxgain) # [0:1:30]
sdr.setGain(SOAPY_SDR_RX, ch, "TIA", 0) # [0, 3, 9, 12]
sdr.setGain(SOAPY_SDR_RX, ch, "PGA", -10) # [-12:1:19]
# Read initial gain settings
readLNA = sdr.getGain(SOAPY_SDR_RX, 0, 'LNA')
readTIA = sdr.getGain(SOAPY_SDR_RX, 0, 'TIA')
......@@ -396,8 +414,8 @@ def main():
parser.add_option("--bsnode", type="string", dest="bsnode", help="serial number of the master (base station node) device", default="")
parser.add_option("--clnode", type="string", dest="clnode", help="serial number of the slave (client node) device", default="")
parser.add_option("--rate", type="float", dest="rate", help="Tx sample rate", default=5e6)
parser.add_option("--txgain", type="float", dest="txgain", help="Optional Tx gain (dB) w/CBRS 3.6GHz [0:105], 2.5GHZ [0:105]", default=30.0)
parser.add_option("--rxgain", type="float", dest="rxgain", help="Optional Rx gain (dB) w/CBRS 3.6GHz [0:105], 2.5GHZ [0:108]", default=30.0)
parser.add_option("--txgain", type="float", dest="txgain", help="Tx gain (dB)", default=30.0) # Check top of file for info on gain range
parser.add_option("--rxgain", type="float", dest="rxgain", help="Rx gain (dB)", default=30.0) # Check top of file for info on gain range
parser.add_option("--freq", type="float", dest="freq", help="Optional Tx freq (Hz)", default=3.6e9)
parser.add_option("--numSamps", type="int", dest="numSamps", help="Num samples to receive", default=512)
parser.add_option("--prefix-length", type="int", dest="prefix_length", help="prefix padding length for beacon and pilot", default=100) # to compensate for front-end group delay
......
......@@ -49,3 +49,5 @@ FPGA_IRIS030_WR_AGC_GAIN_INIT = 316
# AGC Cont'd
FPGA_IRIS030_WR_NUM_SAT_STAGES = 320
FPGA_IRIS030_WR_NUM_FINE_STAGES = 324
TX_GAIN_CTRL = 88
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment