diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp index c1e3cb81c1533187b132f96604a7c42af64fa737..3abcbbac5a5dbcdc4e4b6c0fde9735fb64794a3f 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp @@ -131,18 +131,8 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index) { */ int trx_lms_set_gains(openair0_device* device, openair0_config_t *openair0_cfg) { - /* double gv = openair0_cfg[0].rx_gain[0] - openair0_cfg[0].rx_gain_offset[0]; - - if (gv > 31) { - printf("RX Gain 0 too high, reduce by %f dB\n",gv-31); - gv = 31; - } - if (gv < 0) { - printf("RX Gain 0 too low, increase by %f dB\n",-gv); - gv = 0; - } - printf("[LMS] Setting 7002M G_PGA_RBB to %d\n", (uint16_t)gv); - LMS_WriteParam(lms_device,LMS7param(G_PGA_RBB),(uint16_t)gv);*/ + LMS_SetNormalizedGain(lms_device, LMS_CH_TX, 0, openair0_cfg[0].tx_gain[0]/100.0); + LMS_SetNormalizedGain(lms_device, LMS_CH_RX, 0, openair0_cfg[0].rx_gain[0]/openair0_cfg[0].rx_gain_offset[0]); return(0); } @@ -209,10 +199,8 @@ int trx_lms_start(openair0_device *device){ LMS_SetAntenna(lms_device, LMS_CH_RX, 0, 3); LMS_SetAntenna(lms_device, LMS_CH_TX, 0, 2); - trx_lms_set_gains(device, device->openair0_cfg); - /*LMS_SetNormalizedGain(lms_device, LMS_CH_TX, 0, 0.175); - LMS_SetNormalizedGain(lms_device, LMS_CH_RX, 0, 0.65);*/ + for (int i = 0; i< device->openair0_cfg->rx_num_channels; i++) { if (LMS_SetLPFBW(lms_device,LMS_CH_RX,i,device->openair0_cfg->rx_bw)!=0) @@ -239,6 +227,9 @@ int trx_lms_start(openair0_device *device){ tx_stream.throughputVsLatency = 0.1; tx_stream.dataFmt = lms_stream_t::LMS_FMT_I12; tx_stream.isTx = true; + + trx_lms_set_gains(device, device->openair0_cfg); + if (LMS_SetupStream(lms_device, &tx_stream)!=0) printf("TX stream setup failed %s\n",LMS_GetLastErrorMessage()); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf index b0ef9e037418c5aa6a4ad13751d51b10f23655e2..d912b1a10213a42d9332a00199e4c3c3a88df14b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.lmssdr.conf @@ -39,7 +39,7 @@ eNBs = nb_antennas_ports = 1; nb_antennas_tx = 1; nb_antennas_rx = 1; - tx_gain = 60; + tx_gain = 100; rx_gain = 111; prach_root = 0; prach_config_index = 0;