diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c1507de61ba160934df62dd4c6f2ade2fae857bb..5e86d59378331fe0795d57aea2c2c0750ad69c1f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -664,7 +664,7 @@ add_boolean_option(ENABLE_NEW_MULTICAST False "specific to oaisim") add_boolean_option(EXMIMO_IOT True "????") add_boolean_option(LARGE_SCALE False "specific to oaisim: defines max eNB=2 and max UE=120") add_boolean_option(LOCALIZATION False "???") -add_integer_option(MAX_NUM_CCs 2 "????") +add_integer_option(MAX_NUM_CCs 1 "????") add_boolean_option(MU_RECEIVER False "????") add_boolean_option(NEW_FFT True "????") add_boolean_option(OPENAIR1 True "????") diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 99350a4c1e0f2b8a236725696f5db4a2f359f1ca..0011842a03f08071a8210e109951e319ffe0d097 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -134,6 +134,14 @@ typedef struct { double offset; } rx_gain_calib_table_t; +/*! \brief Clock source types */ +typedef enum { + //! This tells the underlying hardware to use the internal reference + internal=0, + //! This tells the underlying hardware to use the external reference + external=1 +} clock_source_t; + /*! \brief RF frontend parameters set by application */ typedef struct { //! Module ID for this configuration @@ -186,6 +194,8 @@ typedef struct { double rx_bw; //! TX bandwidth in Hz double tx_bw; + //! clock source + clock_source_t clock_source; //! Auto calibration flag int autocal[4]; //! rf devices work with x bits iqs when oai have its own iq format diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 1cbabf5dcc7c55a3636d6e1301060cbd6269c7f6..106fb369db1bb6472a66d479d33a79df566998a7 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -587,7 +587,10 @@ extern "C" { // s->usrp->set_tx_subdev_spec(tx_subdev); // lock mboard clocks - s->usrp->set_clock_source("internal"); + if (openair0_cfg[0].clock_source == internal) + s->usrp->set_clock_source("internal"); + else + s->usrp->set_clock_source("external"); //Setting device type to USRP X300/X310 device->type=USRP_X300_DEV; @@ -643,6 +646,12 @@ extern "C" { // s->usrp->set_clock_source("internal"); // set master clock rate and sample rate for tx & rx for streaming + // lock mboard clocks + if (openair0_cfg[0].clock_source == internal) + s->usrp->set_clock_source("internal"); + else + s->usrp->set_clock_source("external"); + device->type = USRP_B200_DEV; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index fdad1e12c1ff07e1544b5271a872bc7a95d0a3da..8999a717ceee327cd92a1deeaef4159250bdc386 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -654,11 +654,11 @@ void fh_if5_asynch_UL(PHY_VARS_eNB *eNB,int *frame,int *subframe) { } else { if (proc->subframe_rx != *subframe) { - LOG_E(PHY,"subframe_rx %d is not what we expect %d\n",proc->subframe_rx,*subframe); + LOG_E(PHY,"fh_if5_asynch_UL: subframe_rx %d is not what we expect %d\n",proc->subframe_rx,*subframe); exit_fun("Exiting"); } if (proc->frame_rx != *frame) { - LOG_E(PHY,"subframe_rx %d is not what we expect %d\n",proc->frame_rx,*frame); + LOG_E(PHY,"fh_if5_asynch_UL: subframe_rx %d is not what we expect %d\n",proc->frame_rx,*frame); exit_fun("Exiting"); } } @@ -688,11 +688,11 @@ void fh_if4p5_asynch_UL(PHY_VARS_eNB *eNB,int *frame,int *subframe) { } else { if (proc->frame_rx != *frame) { - LOG_E(PHY,"frame_rx %d is not what we expect %d\n",proc->frame_rx,*frame); + LOG_E(PHY,"fh_if4p5_asynch_UL: frame_rx %d is not what we expect %d\n",proc->frame_rx,*frame); exit_fun("Exiting"); } if (proc->subframe_rx != *subframe) { - LOG_E(PHY,"subframe_rx %d is not what we expect %d\n",proc->subframe_rx,*subframe); + LOG_E(PHY,"fh_if4p5_asynch_UL: subframe_rx %d is not what we expect %d\n",proc->subframe_rx,*subframe); exit_fun("Exiting"); } } @@ -728,11 +728,11 @@ void fh_if5_asynch_DL(PHY_VARS_eNB *eNB,int *frame,int *subframe) { } else { if (subframe_tx != *subframe) { - LOG_E(PHY,"subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe); + LOG_E(PHY,"fh_if5_asynch_DL: subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe); exit_fun("Exiting"); } if (frame_tx != *frame) { - LOG_E(PHY,"frame_tx %d is not what we expect %d\n",frame_tx,*frame); + LOG_E(PHY,"fh_if5_asynch_DL: frame_tx %d is not what we expect %d\n",frame_tx,*frame); exit_fun("Exiting"); } } @@ -760,11 +760,11 @@ void fh_if4p5_asynch_DL(PHY_VARS_eNB *eNB,int *frame,int *subframe) { } else { if (frame_tx != *frame) { - LOG_E(PHY,"frame_tx %d is not what we expect %d\n",frame_tx,*frame); + LOG_E(PHY,"fh_if4p5_asynch_DL: frame_tx %d is not what we expect %d\n",frame_tx,*frame); exit_fun("Exiting"); } if (subframe_tx != *subframe) { - LOG_E(PHY,"subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe); + LOG_E(PHY,"fh_if4p5_asynch_DL: subframe_tx %d is not what we expect %d\n",subframe_tx,*subframe); exit_fun("Exiting"); } } @@ -882,6 +882,9 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { fp->samples_per_tti, fp->nb_antennas_rx); + if (rxs != fp->samples_per_tti) + printf("Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); if (proc->first_rx == 1) @@ -892,16 +895,16 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) { // synchronize first reception to frame 0 subframe 0 proc->timestamp_tx = proc->timestamp_rx+(4*fp->samples_per_tti); - //printf("trx_read <- USRP TS %llu (sf %d, f %d, first_rx %d)\n", proc->timestamp_rx,proc->subframe_rx,proc->frame_rx,proc->first_rx); + // printf("trx_read <- USRP TS %lu (offset %d sf %d, f %d, first_rx %d)\n", proc->timestamp_rx,eNB->ts_offset,proc->subframe_rx,proc->frame_rx,proc->first_rx); if (proc->first_rx == 0) { if (proc->subframe_rx != *subframe){ - LOG_E(PHY,"Received Timestamp (%llu) doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d)\n",proc->timestamp_rx,proc->subframe_rx,*subframe); + LOG_E(PHY,"rx_rf: Received Timestamp (%llu) doesn't correspond to the time we think it is (proc->subframe_rx %d, subframe %d)\n",proc->timestamp_rx,proc->subframe_rx,*subframe); exit_fun("Exiting"); } if (proc->frame_rx != *frame) { - LOG_E(PHY,"Received Timestamp (%llu) doesn't correspond to the time we think it is (proc->frame_rx %d frame %d)\n",proc->timestamp_rx,proc->frame_rx,*frame); + LOG_E(PHY,"rx_rf: Received Timestamp (%llu) doesn't correspond to the time we think it is (proc->frame_rx %d frame %d)\n",proc->timestamp_rx,proc->frame_rx,*frame); exit_fun("Exiting"); } } else { diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index d2ba49dcacf41a3a6f3b90e7dba11638e830d59e..eeb06753f3a0f10ef67a6c3416444b9b3b6c01e6 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -168,6 +168,7 @@ volatile int oai_exit = 0; +static clock_source_t clock_source = internal; static char UE_flag=0; unsigned int mmapped_dma=0; @@ -386,6 +387,7 @@ void help (void) { printf(" --loop-memory get softmodem (UE) to loop through memory instead of acquiring from HW\n"); printf(" --mmapped-dma sets flag for improved EXMIMO UE performance\n"); printf(" --single-thread runs lte-softmodem in only one thread\n"); + printf(" --external-clock tells hardware to use an external clock reference\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"); @@ -657,7 +659,7 @@ void *l2l1_task(void *arg) #endif - + static void get_options (int argc, char **argv) { @@ -693,6 +695,7 @@ static void get_options (int argc, char **argv) LONG_OPTION_PHYTEST, LONG_OPTION_MMAPPED_DMA, LONG_OPTION_SINGLE_THREAD, + LONG_OPTION_EXTERNAL_CLOCK, #if T_TRACER LONG_OPTION_T_PORT, LONG_OPTION_T_NOWAIT, @@ -718,6 +721,7 @@ static void get_options (int argc, char **argv) {"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST}, {"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA}, {"single-thread", no_argument, NULL, LONG_OPTION_SINGLE_THREAD}, + {"external-clock", no_argument, NULL, LONG_OPTION_EXTERNAL_CLOCK}, #if T_TRACER {"T_port", required_argument, 0, LONG_OPTION_T_PORT}, {"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT}, @@ -818,7 +822,11 @@ static void get_options (int argc, char **argv) case LONG_OPTION_SINGLE_THREAD: single_thread_flag = 1; break; - + + case LONG_OPTION_EXTERNAL_CLOCK: + clock_source = external; + break; + #if T_TRACER case LONG_OPTION_T_PORT: { extern int T_port; @@ -1325,6 +1333,7 @@ void init_openair0() { openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL; + openair0_cfg[card].clock_source = clock_source; openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx)); openair0_cfg[card].rx_num_channels=min(2,((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));