Commit 0e3ba81b authored by rdoost's avatar rdoost

adding gain calib val to command line arguments

parent 7e9057d0
...@@ -176,6 +176,7 @@ typedef struct { ...@@ -176,6 +176,7 @@ typedef struct {
//! \brief memory //! \brief memory
//! \brief Pointer to Calibration table for RX gains //! \brief Pointer to Calibration table for RX gains
rx_gain_calib_table_t *rx_gain_calib_table; rx_gain_calib_table_t *rx_gain_calib_table;
int gain_calib_val;
//! mode for rxgain (ExpressMIMO2) //! mode for rxgain (ExpressMIMO2)
rx_gain_t rxg_mode[4]; rx_gain_t rxg_mode[4];
......
...@@ -373,6 +373,7 @@ int trx_iris_set_gains(openair0_device* device, ...@@ -373,6 +373,7 @@ int trx_iris_set_gains(openair0_device* device,
rx_gain_calib_table_t calib_table_iris[] = { rx_gain_calib_table_t calib_table_iris[] = {
{3500000000.0,83}, {3500000000.0,83},
{2660000000.0,83}, {2660000000.0,83},
{2580000000.0,80},
{2300000000.0,83}, {2300000000.0,83},
{1880000000.0,83}, {1880000000.0,83},
{816000000.0,83}, {816000000.0,83},
...@@ -414,6 +415,7 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_ ...@@ -414,6 +415,7 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
break; break;
} }
} }
/*
while (openair0_cfg->rx_gain_calib_table[i].freq>0) { while (openair0_cfg->rx_gain_calib_table[i].freq>0) {
diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq); diff = fabs(openair0_cfg->rx_freq[chain_index] - openair0_cfg->rx_gain_calib_table[i].freq);
printf("cal %d: freq %f, offset %f, diff %f\n", printf("cal %d: freq %f, offset %f, diff %f\n",
...@@ -426,7 +428,9 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_ ...@@ -426,7 +428,9 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
} }
i++; i++;
} }
*/
openair0_cfg->rx_gain_offset[chain_index] = openair0_cfg->gain_calib_val+gain_adj;
printf("Calculating gain offset for rf chain %d: %2.2f\n", chain_index, openair0_cfg->rx_gain_offset[chain_index]);
} }
/*! \brief print the Iris statistics /*! \brief print the Iris statistics
...@@ -515,6 +519,7 @@ extern "C" { ...@@ -515,6 +519,7 @@ extern "C" {
break; break;
} }
printf("tx_sample_advance %d\n", openair0_cfg[0].tx_sample_advance); printf("tx_sample_advance %d\n", openair0_cfg[0].tx_sample_advance);
printf("gain calibration value %2.2f\n", openair0_cfg[0].gain_calib_val);
int r; int r;
for (r = 0; r < s->device_num; r++) for (r = 0; r < s->device_num; r++)
...@@ -528,9 +533,11 @@ extern "C" { ...@@ -528,9 +533,11 @@ extern "C" {
if (i < openair0_cfg[0].rx_num_channels) { if (i < openair0_cfg[0].rx_num_channels) {
s->iris[r]->setSampleRate(SOAPY_SDR_RX, i, openair0_cfg[0].sample_rate/SAMPLE_RATE_DOWN); s->iris[r]->setSampleRate(SOAPY_SDR_RX, i, openair0_cfg[0].sample_rate/SAMPLE_RATE_DOWN);
s->iris[r]->setFrequency(SOAPY_SDR_RX, i, "RF", openair0_cfg[0].rx_freq[i]); s->iris[r]->setFrequency(SOAPY_SDR_RX, i, "RF", openair0_cfg[0].rx_freq[i]);
set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
s->iris[r]->setGain(SOAPY_SDR_RX, i, openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i]); s->iris[r]->setGain(SOAPY_SDR_RX, i, openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i]);
printf("input rx gain value for rf chain %d: %2.2f\n", i, openair0_cfg[0].rx_gain[i]);
if (openair0_cfg[0].duplex_mode == 1 ) //duplex_mode_TDD if (openair0_cfg[0].duplex_mode == 1 ) //duplex_mode_TDD
s->iris[r]->setAntenna(SOAPY_SDR_RX, i, (i==0)?"TRXA":"TRXB"); s->iris[r]->setAntenna(SOAPY_SDR_RX, i, (i==0)?"TRXA":"TRXB");
s->iris[r]->setDCOffsetMode(SOAPY_SDR_RX, i, true); // move somewhere else s->iris[r]->setDCOffsetMode(SOAPY_SDR_RX, i, true); // move somewhere else
...@@ -548,13 +555,13 @@ extern "C" { ...@@ -548,13 +555,13 @@ extern "C" {
for(i = 0; i < openair0_cfg[0].tx_num_channels; i++) { for(i = 0; i < openair0_cfg[0].tx_num_channels; i++) {
if (i < s->iris[r]->getNumChannels(SOAPY_SDR_TX) ) { if (i < s->iris[r]->getNumChannels(SOAPY_SDR_TX) ) {
s->iris[r]->setBandwidth(SOAPY_SDR_TX, i, openair0_cfg[0].tx_bw); s->iris[r]->setBandwidth(SOAPY_SDR_TX, i, openair0_cfg[0].tx_bw);
printf("Setting tx freq/gain on channel %lu/%lu: BW %f (readback %f)\n",i,s->iris[r]->getNumChannels(SOAPY_SDR_TX),openair0_cfg[0].tx_bw/1e6,s->iris[r]->getBandwidth(SOAPY_SDR_TX, i)/1e6); printf("Setting tx bandwidth on channel %lu/%lu: BW %f (readback %f)\n",i,s->iris[r]->getNumChannels(SOAPY_SDR_TX),openair0_cfg[0].tx_bw/1e6,s->iris[r]->getBandwidth(SOAPY_SDR_TX, i)/1e6);
} }
} }
for(i = 0; i < openair0_cfg[0].rx_num_channels; i++) { for(i = 0; i < openair0_cfg[0].rx_num_channels; i++) {
if (i < s->iris[r]->getNumChannels(SOAPY_SDR_RX)) { if (i < s->iris[r]->getNumChannels(SOAPY_SDR_RX)) {
s->iris[r]->setBandwidth(SOAPY_SDR_RX, i, openair0_cfg[0].rx_bw); s->iris[r]->setBandwidth(SOAPY_SDR_RX, i, openair0_cfg[0].rx_bw);
printf("Setting rx freq/gain on channel %lu/%lu : BW %f (readback %f)\n",i,s->iris[r]->getNumChannels(SOAPY_SDR_RX),openair0_cfg[0].rx_bw/1e6,s->iris[r]->getBandwidth(SOAPY_SDR_RX, i)/1e6); printf("Setting rx bandwidth on channel %lu/%lu : BW %f (readback %f)\n",i,s->iris[r]->getNumChannels(SOAPY_SDR_RX),openair0_cfg[0].rx_bw/1e6,s->iris[r]->getBandwidth(SOAPY_SDR_RX, i)/1e6);
} }
} }
......
...@@ -233,6 +233,7 @@ int16_t node_synch_ref[MAX_NUM_CCs]; ...@@ -233,6 +233,7 @@ int16_t node_synch_ref[MAX_NUM_CCs];
uint32_t target_dl_mcs = 28; //maximum allowed mcs uint32_t target_dl_mcs = 28; //maximum allowed mcs
uint32_t target_ul_mcs = 10; uint32_t target_ul_mcs = 10;
uint32_t tx_sample_advance = 0; //cws: added to test tx/rx sync uint32_t tx_sample_advance = 0; //cws: added to test tx/rx sync
uint32_t gain_calib_val = 0; //rd: having a fixed table in the driver was not as efficient, so we set it as cmdline arg
uint32_t timing_advance = 0; uint32_t timing_advance = 0;
uint8_t exit_missed_slots=1; uint8_t exit_missed_slots=1;
uint64_t num_missed_slots=0; // counter for the number of missed slots uint64_t num_missed_slots=0; // counter for the number of missed slots
...@@ -409,6 +410,7 @@ void help (void) { ...@@ -409,6 +410,7 @@ void help (void) {
printf(" -E Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"); printf(" -E Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n");
printf(" --rrh-remote-address Remote radio head address (serial for Iris)\n"); printf(" --rrh-remote-address Remote radio head address (serial for Iris)\n");
printf(" --tx-sample-advance TX Sample Advance\n"); printf(" --tx-sample-advance TX Sample Advance\n");
printf(" --gain-calib-val value to be used for calibrating gain\n");
#if T_TRACER #if T_TRACER
printf(" --T_port [port] use given port\n"); printf(" --T_port [port] use given port\n");
printf(" --T_nowait don't wait for tracer, start immediately\n"); printf(" --T_nowait don't wait for tracer, start immediately\n");
...@@ -703,6 +705,7 @@ static void get_options (int argc, char **argv) ...@@ -703,6 +705,7 @@ static void get_options (int argc, char **argv)
LONG_OPTION_EXMIMO_TDD_WORKAROUND, LONG_OPTION_EXMIMO_TDD_WORKAROUND,
LONG_OPTION_RRH_REMOTE_ADDRESS, LONG_OPTION_RRH_REMOTE_ADDRESS,
LONG_OPTION_TX_SAMPLE_ADVANCE, LONG_OPTION_TX_SAMPLE_ADVANCE,
LONG_OPTION_GAIN_CALIB_VALUE,
#if T_TRACER #if T_TRACER
LONG_OPTION_T_PORT, LONG_OPTION_T_PORT,
LONG_OPTION_T_NOWAIT, LONG_OPTION_T_NOWAIT,
...@@ -734,6 +737,7 @@ static void get_options (int argc, char **argv) ...@@ -734,6 +737,7 @@ static void get_options (int argc, char **argv)
{"exmimo-tdd-workaround", no_argument, NULL, LONG_OPTION_EXMIMO_TDD_WORKAROUND}, {"exmimo-tdd-workaround", no_argument, NULL, LONG_OPTION_EXMIMO_TDD_WORKAROUND},
{"rrh-remote-address", required_argument, NULL, LONG_OPTION_RRH_REMOTE_ADDRESS}, {"rrh-remote-address", required_argument, NULL, LONG_OPTION_RRH_REMOTE_ADDRESS},
{"tx-sample-advance", required_argument, NULL, LONG_OPTION_TX_SAMPLE_ADVANCE}, {"tx-sample-advance", required_argument, NULL, LONG_OPTION_TX_SAMPLE_ADVANCE},
{"gain-calib-value", required_argument, NULL, LONG_OPTION_GAIN_CALIB_VALUE},
#if T_TRACER #if T_TRACER
{"T_port", required_argument, 0, LONG_OPTION_T_PORT}, {"T_port", required_argument, 0, LONG_OPTION_T_PORT},
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT}, {"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
...@@ -745,6 +749,10 @@ static void get_options (int argc, char **argv) ...@@ -745,6 +749,10 @@ static void get_options (int argc, char **argv)
while ((c = getopt_long (argc, argv, "A:a:C:dEK:g:F:G:hqO:m:SUVRM:r:P:Ws:t:Tx:",long_options,NULL)) != -1) { while ((c = getopt_long (argc, argv, "A:a:C:dEK:g:F:G:hqO:m:SUVRM:r:P:Ws:t:Tx:",long_options,NULL)) != -1) {
switch (c) { switch (c) {
case LONG_OPTION_GAIN_CALIB_VALUE:
gain_calib_val = atoi(optarg);
printf("Setting gain calib value to %d\n",gain_calib_val);
break;
case LONG_OPTION_TX_SAMPLE_ADVANCE: case LONG_OPTION_TX_SAMPLE_ADVANCE:
tx_sample_advance = atoi(optarg); tx_sample_advance = atoi(optarg);
printf("Setting tx_sample_advance to %d\n",tx_sample_advance); printf("Setting tx_sample_advance to %d\n",tx_sample_advance);
...@@ -1391,6 +1399,9 @@ void init_openair0() { ...@@ -1391,6 +1399,9 @@ void init_openair0() {
openair0_cfg[card].tx_sample_advance = tx_sample_advance; //BS will set this in the config file openair0_cfg[card].tx_sample_advance = tx_sample_advance; //BS will set this in the config file
printf("Set tx_sample_advance to %d\n", openair0_cfg[card].tx_sample_advance); printf("Set tx_sample_advance to %d\n", openair0_cfg[card].tx_sample_advance);
openair0_cfg[card].gain_calib_val = gain_calib_val;
printf("Set gain calibration value to %d\n", openair0_cfg[card].gain_calib_val);
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL; openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
......
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