diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 227a100692fef69d7bc72b37fd5641c989acab61..156da0c4ce6991c3b54c4901650f34d826d8348f 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -60,6 +60,11 @@ typedef enum { max_gain=0,med_gain,byp_gain } rx_gain_t; +typedef enum { + duplex_mode_TDD=1,duplex_mode_FDD=0 +} duplex_mode_t; + + /** @addtogroup _PHY_RF_INTERFACE_ * @{ */ @@ -76,6 +81,8 @@ typedef struct { int Mod_id; // device log level int log_level; + //! duplexing mode + duplex_mode_t duplex_mode; //! number of downlink resource blocks int num_rb_dl; //! number of samples per frame diff --git a/targets/ARCH/EXMIMO/DEFS/pcie_interface.h b/targets/ARCH/EXMIMO/DEFS/pcie_interface.h index 925787cabfbb955e1cb20d17b0d73ecb0c5a5694..713480b40bbdcadcb042af1c14c9c3c199a0555d 100644 --- a/targets/ARCH/EXMIMO/DEFS/pcie_interface.h +++ b/targets/ARCH/EXMIMO/DEFS/pcie_interface.h @@ -316,7 +316,9 @@ typedef struct { // // In TDD mode, there are two ways to control the RX/TX switch: // 1. using the LSB from the TX data (TXRXSWITCH_LSB) +// only the LSB from RF chain set in the ACTIVE_RF register controls the switch on all the chains // 2. using FPGA logic, based on switch_offset[0..3] +// this mode is not tested well and should be used with care #define DUPLEXMODE_MASK (1<<0) #define DUPLEXMODE_FDD 0 #define DUPLEXMODE_TDD (1<<0) @@ -330,6 +332,11 @@ typedef struct { #define SWITCHSTATE_1 (1<<3) #define TEST_ADACLOOP_MASK (1<<4) #define TEST_ADACLOOP_EN (1<<4) +#define RF_ACTIVE_MASK (15<<5) +#define RF_ACTIVE_1 (1<<5) +#define RF_ACTIVE_2 (2<<5) +#define RF_ACTIVE_3 (4<<5) +#define RF_ACTIVE_4 (8<<5) typedef enum { BW5, diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c index df9900d3bc98720090143b73c2989a30ad0868ea..238c94bd7e97a6ce6d6330f260ca99c38e83e5b5 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c @@ -296,6 +296,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) int ant, card; int resampling_factor=2; int rx_filter=RXLPF25, tx_filter=TXLPF25; + int ACTIVE_RF=0; exmimo_config_t *p_exmimo_config; exmimo_id_t *p_exmimo_id; @@ -315,8 +316,6 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) else p_exmimo_config->framing.eNB_flag = !UE_flag; - p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB; - if (openair0_num_detected_cards==1) p_exmimo_config->framing.multicard_syncmode=SYNCMODE_FREE; else if (card==0) @@ -355,6 +354,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) for (ant=0; ant<4; ant++) { if (openair0_cfg[card].rx_freq[ant] || openair0_cfg[card].tx_freq[ant]) { + ACTIVE_RF += (1<<ant)<<5; p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE; p_exmimo_config->rf.do_autocal[ant] = 1;//openair0_cfg[card].autocal[ant]; printf("card %d, antenna %d, autocal %d\n",card,ant,openair0_cfg[card].autocal[ant]); @@ -408,6 +408,15 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) } } + if (openair0_cfg[card].duplex_mode==duplex_mode_FDD) { + p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD; + printf("!!!!!setting FDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config); + } + else { + p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF; + printf("!!!!!setting TDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config); + } + ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card); if (ret!=0) diff --git a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10 b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10 index 2889dfa80f8f6a9128af6e9ca6dd1a309c9e1b39..d79e46df76881a3d2bf476b82f988b0a9bfd4839 100755 Binary files a/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10 and b/targets/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/sdr_expressmimo2_v10 differ diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.exmimo2.conf index 0071b7d002ab33c880b125fdfa8791b35a927339..9444a6f95e8c610b95a87dd6ce3ecc52765ac811 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm1.exmimo2.conf @@ -17,7 +17,7 @@ eNBs = mobile_country_code = "208"; - mobile_network_code = "92"; + mobile_network_code = "93"; ////////// Physical parameters: @@ -131,7 +131,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.13.11"; + mme_ip_address = ( { ipv4 = "192.168.12.70"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -141,10 +141,10 @@ eNBs = NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf index 212f341580f6acbab2cb4fc8994e38beb4f6b47e..3ce32398f7ac5d6fe42720447565c0fb6326213a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf @@ -17,7 +17,7 @@ eNBs = mobile_country_code = "208"; - mobile_network_code = "92"; + mobile_network_code = "93"; ////////// Physical parameters: @@ -31,7 +31,7 @@ eNBs = downlink_frequency = 2680000000L; uplink_frequency_offset = -120000000; Nid_cell = 0; - N_RB_DL = 50; + N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antennas_tx = 1; nb_antennas_rx = 1; @@ -131,7 +131,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "10.0.1.1"; + mme_ip_address = ( { ipv4 = "192.168.12.171"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -140,11 +140,11 @@ eNBs = NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth3"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.0.1.229/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.80/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth3"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.0.1.229/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth2"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.80/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 45625e7e736d05eab7848c5831262061ebd5c9ea..3bd561aedcb5f67ff8d36e25ba24c6ed6da1b72e 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -418,7 +418,7 @@ void help (void) { printf(" --ue-txgain set UE TX gain\n"); printf(" --ue-scan_carrier set UE to scan around carrier\n"); printf(" --loop-memory get softmodem (UE) to loop through memory instead of acquiring from HW\n"); - printf(" -C Set the downlink frequecny for all Component carrier\n"); + printf(" -C Set the downlink frequency for all component carriers\n"); printf(" -d Enable soft scope and L1 and L2 stats (Xforms)\n"); printf(" -F Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"); printf(" -g Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n"); @@ -432,6 +432,7 @@ void help (void) { printf(" -r Set the PRB, valid values: 6, 25, 50, 100 \n"); printf(" -S Skip the missed slots/subframes \n"); printf(" -t Set the maximum uplink MCS\n"); + printf(" -T Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"); printf(" -U Set the lte softmodem as a UE\n"); printf(" -W Enable L2 wireshark messages on localhost \n"); printf(" -V Enable VCD (generated file will be located atopenair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n"); @@ -966,6 +967,25 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset++] = 0x00010001; } } + + if ((((phy_vars_eNB->lte_frame_parms.tdd_config==0) || + (phy_vars_eNB->lte_frame_parms.tdd_config==1) || + (phy_vars_eNB->lte_frame_parms.tdd_config==2) || + (phy_vars_eNB->lte_frame_parms.tdd_config==6)) && + (subframe==0)) || (subframe==5)) { + // turn on tx switch N_TA_offset before + //LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,phy_vars_eNB->N_TA_offset,slot_offset); + for (i=0; i<phy_vars_eNB->N_TA_offset; i++) { + tx_offset = (int)slot_offset+time_offset[aa]+i-phy_vars_eNB->N_TA_offset/2; + if (tx_offset<0) + tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti; + + if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti)) + tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti; + + phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset] = 0x00000000; + } + } } } } @@ -2037,7 +2057,7 @@ static void get_options (int argc, char **argv) {NULL, 0, NULL, 0} }; - while ((c = getopt_long (argc, argv, "C:dK:g:F:G:hqO:m:SUVRM:r:P:Ws:t:x:",long_options,NULL)) != -1) { + while ((c = getopt_long (argc, argv, "C:dK:g:F:G:hqO:m:SUVRM:r:P:Ws:t:Tx:",long_options,NULL)) != -1) { switch (c) { case LONG_OPTION_MAXPOWER: tx_max_power[0]=atoi(optarg); @@ -2302,8 +2322,13 @@ static void get_options (int argc, char **argv) printf("Transmission mode > 2 (%d) not supported for the moment\n",transmission_mode); exit(-1); } + break; + case 'T': + for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) + frame_parms[CC_id]->frame_type = TDD; break; + case 'h': help (); exit (-1); @@ -2463,12 +2488,10 @@ int main( int argc, char **argv ) memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs); set_latency_target(); - - for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { frame_parms[CC_id] = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS)); /* Set some default values that may be overwritten while reading options */ - frame_parms[CC_id]->frame_type = FDD; /* TDD */ + frame_parms[CC_id]->frame_type = FDD; frame_parms[CC_id]->tdd_config = 3; frame_parms[CC_id]->tdd_config_S = 0; frame_parms[CC_id]->N_RB_DL = 100; @@ -2816,7 +2839,7 @@ int main( int argc, char **argv ) } #else - //already taken care of in lte-softmodem + //already taken care of in lte-softmodem.c PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0; #endif @@ -2863,7 +2886,12 @@ int main( int argc, char **argv ) openair0_cfg[card].tx_bw = 1.5e6; openair0_cfg[card].rx_bw = 1.5e6; } - + + if (frame_parms[0]->frame_type==TDD) + openair0_cfg[card].duplex_mode = duplex_mode_TDD; + else //FDD + openair0_cfg[card].duplex_mode = duplex_mode_FDD; + #ifdef ETHERNET //calib needed