diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d76016712f67d127948d30d7bcca3afffc7a4740..658ac84e65a03b64b34d9ef1106410a5f88da0f8 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -554,6 +554,7 @@ elseif (${RF_BOARD} STREQUAL "OAI_BLADERF") elseif (${RF_BOARD} STREQUAL "OAI_LMSSDR") include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB") + include_directories("/usr/local/include/lime") LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lmsSDR") LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lms7002m") diff --git a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp index c1e3cb81c1533187b132f96604a7c42af64fa737..3a9878e82b182c670602344442321b6ffdb52804 100644 --- a/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp +++ b/targets/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp @@ -37,6 +37,8 @@ * @{ */ #include <lime/LimeSuite.h> +#include <lime/LMS7002M.h> +#include <lime/LMS7002M_RegistersMap.h> #include "common_lib.h" lms_device_t* lms_device; @@ -46,8 +48,7 @@ lms_stream_t tx_stream; #define RXDCLENGTH 4096 #define NUMBUFF 32 -int16_t cos_fsover8[8] = {2047, 1447, 0, -1448, -2047, -1448, 0, 1447}; -int16_t cos_3fsover8[8] = {2047, -1448, 0, 1447, -2047, 1447, 0, -1448}; +using namespace lime; extern "C" { @@ -131,18 +132,24 @@ 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]; + LMS_SetNormalizedGain(lms_device, LMS_CH_TX, 0, openair0_cfg[0].tx_gain[0]/100.0); + + // RX gains, use low-level setting + + 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", (int16_t)gv); + LMS7002M lms7; + lms7.SetConnection(lms7.GetConnection()); + lms7.Modify_SPI_Reg_bits(LMS7param(G_PGA_RBB),(int16_t)gv); - 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);*/ return(0); } @@ -205,14 +212,12 @@ int trx_lms_start(openair0_device *device){ } printf("Set TX frequency %f MHz\n",device->openair0_cfg[0].tx_freq[0]/1e6); - printf("Override antenna settings to: RX1_W, TXA_2"); - LMS_SetAntenna(lms_device, LMS_CH_RX, 0, 3); + printf("Override antenna settings to: RX1_H, TXA_2"); + LMS_SetAntenna(lms_device, LMS_CH_RX, 0, 1); 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 +244,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()); @@ -284,7 +292,7 @@ int trx_lms_set_freq(openair0_device* device, openair0_config_t *openair0_cfg,in // 31 = 19 dB => 105 dB total gain @ 2.6 GHz /*! \brief calibration table for LMSSDR */ -rx_gain_calib_table_t calib_table_sodera[] = { +rx_gain_calib_table_t calib_table_lmssdr[] = { {3500000000.0,70.0}, {2660000000.0,80.0}, {2300000000.0,80.0}, @@ -369,7 +377,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg){ break; } - openair0_cfg[0].rx_gain_calib_table = calib_table_sodera; + openair0_cfg[0].rx_gain_calib_table = calib_table_lmssdr; set_rx_gain_offset(openair0_cfg,0); device->Mod_id = 1; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf index 83f8af699e940b71861641babb4f1b5d661421c4..d6970e8e44fae45f512aa4afd5c78603347c55df 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.usrpb210.conf @@ -17,12 +17,15 @@ eNBs = mobile_country_code = "208"; - mobile_network_code = "95"; + mobile_network_code = "93"; ////////// Physical parameters: component_carriers = ( { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; frame_type = "FDD"; tdd_config = 3; tdd_config_s = 0; @@ -34,6 +37,7 @@ eNBs = N_RB_DL = 50; Nid_cell_mbsfn = 0; nb_antennas_tx = 1; + nb_antenna_ports = 1; nb_antennas_rx = 1; tx_gain = 90; rx_gain = 110; @@ -46,7 +50,7 @@ eNBs = pucch_nRB_CQI = 1; pucch_nCS_AN = 0; pucch_n1_AN = 32; - pdsch_referenceSignalPower = -15; + pdsch_referenceSignalPower = -23; pdsch_p_b = 0; pusch_n_SB = 1; pusch_enable64QAM = "DISABLE"; @@ -64,9 +68,9 @@ eNBs = srs_ackNackST =; srs_MaxUpPts =;*/ - pusch_p0_Nominal = -90; + pusch_p0_Nominal = -96; pusch_alpha = "AL1"; - pucch_p0_Nominal = -96; + pucch_p0_Nominal = -104; msg3_delta_Preamble = 6; pucch_deltaF_Format1 = "deltaF2"; pucch_deltaF_Format1b = "deltaF3"; @@ -98,6 +102,7 @@ eNBs = ue_TimersAndConstants_n310 = 20; ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; } ); @@ -133,7 +138,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.170"; + mme_ip_address = ( { ipv4 = "127.0.0.3"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -142,11 +147,11 @@ eNBs = NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.241/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.241/24"; + ENB_INTERFACE_NAME_FOR_S1U = "lo"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.lmssdr.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.lmssdr.conf index af9ed2c221022b4e597b8ab5f38274c988fdbd37..e12acef70340404256fb63ee2538fc7a1f97b130 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.lmssdr.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.lmssdr.conf @@ -31,7 +31,7 @@ eNBs = tdd_config_s = 0; prefix_type = "NORMAL"; eutra_band = 7; - downlink_frequency = 2660000000L; + downlink_frequency = 2680000000L; uplink_frequency_offset = -120000000; Nid_cell = 0; N_RB_DL = 50; @@ -39,7 +39,7 @@ eNBs = nb_antenna_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; @@ -50,7 +50,7 @@ eNBs = pucch_nRB_CQI = 1; pucch_nCS_AN = 0; pucch_n1_AN = 32; - pdsch_referenceSignalPower = -27; + pdsch_referenceSignalPower = -30; pdsch_p_b = 0; pusch_n_SB = 1; pusch_enable64QAM = "DISABLE"; @@ -70,7 +70,7 @@ eNBs = pusch_p0_Nominal = -96; pusch_alpha = "AL1"; - pucch_p0_Nominal = -100; + pucch_p0_Nominal = -104; msg3_delta_Preamble = 6; pucch_deltaF_Format1 = "deltaF2"; pucch_deltaF_Format1b = "deltaF3"; @@ -149,7 +149,7 @@ eNBs = ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; ENB_INTERFACE_NAME_FOR_S1U = "lo"; - ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index c3c88323aac7f1268b27a3835b3e45e6bc29fe85..1dfb0eeb9fb3397b1dc8b6855008a283fdb31fbe 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -149,7 +149,7 @@ eNBs = ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; ENB_INTERFACE_NAME_FOR_S1U = "lo"; - ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; 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; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index fd98d7037f3f7375b32dd1fa643fd4da5001b441..1988686901b7edd1b73292862b31ebef5671b47b 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1360,12 +1360,12 @@ void init_openair0() { openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off; } + openair0_cfg[card].configFilename = rf_config_file; printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n", card,i, openair0_cfg[card].tx_gain[i], openair0_cfg[card].rx_gain[i], openair0_cfg[card].tx_freq[i], openair0_cfg[card].rx_freq[i]); - openair0_cfg[card].configFilename = rf_config_file; } } }