Merge remote-tracking branch 'origin/fix-tx-timing-offset-issues' into integration_2024_w09
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "executables/nr-softmodem-common.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "common/ran_context.h"
|
||||
@@ -540,7 +541,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
|
||||
|
||||
LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset);
|
||||
|
||||
fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
|
||||
fp->threequarter_fs = get_softmodem_params()->threequarter_fs;
|
||||
LOG_A(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n",
|
||||
Mod_id,
|
||||
gNB_config->cell_config.phy_cell_id.value,
|
||||
|
||||
@@ -81,13 +81,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
|
||||
int i, prach_len;
|
||||
uint16_t first_nonzero_root_idx=0;
|
||||
|
||||
prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset);
|
||||
prach_start = (ue->rx_offset + subframe * ue->frame_parms.samples_per_tti - ue->N_TA_offset);
|
||||
#ifdef PRACH_DEBUG
|
||||
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
|
||||
prach_start,
|
||||
ue->rx_offset,
|
||||
ue->hw_timing_advance,
|
||||
ue->N_TA_offset);
|
||||
LOG_I(PHY, "[UE %d] prach_start %d, rx_offset %d, N_TA_offset %d\n", ue->Mod_id, prach_start, ue->rx_offset, ue->N_TA_offset);
|
||||
#endif
|
||||
|
||||
if (prach_start<0)
|
||||
|
||||
@@ -206,9 +206,19 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
|
||||
int rx_power_tot = 0;
|
||||
unsigned short rx_power_avg_dB;
|
||||
unsigned short rx_power_tot_dB;
|
||||
|
||||
double rx_gain = openair0_cfg[0].rx_gain[0];
|
||||
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
|
||||
RU_t *ru = gNB->RU_list[0];
|
||||
double rx_gain, rx_gain_offset;
|
||||
if (ru && ru->rfdevice.openair0_cfg) {
|
||||
rx_gain = ru->rfdevice.openair0_cfg->rx_gain[0];
|
||||
rx_gain_offset = ru->rfdevice.openair0_cfg->rx_gain_offset[0];
|
||||
} else if (ru && ru->ifdevice.openair0_cfg) {
|
||||
rx_gain = ru->ifdevice.openair0_cfg->rx_gain[0];
|
||||
rx_gain_offset = ru->ifdevice.openair0_cfg->rx_gain_offset[0];
|
||||
} else {
|
||||
LOG_W(NR_PHY, "no device for rx gain, take arbitrary gain = 1)\n");
|
||||
rx_gain = 1;
|
||||
rx_gain_offset = 0;
|
||||
}
|
||||
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
int ch_offset = fp->ofdm_symbol_size * symbol;
|
||||
|
||||
@@ -637,8 +637,6 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
|
||||
///
|
||||
uint32_t total_system_throughput;
|
||||
///
|
||||
int hw_timing_advance;
|
||||
///
|
||||
time_stats_t phy_proc;
|
||||
time_stats_t phy_proc_tx;
|
||||
time_stats_t phy_proc_rx;
|
||||
@@ -873,7 +871,6 @@ typedef struct {
|
||||
int rx_offset; /// Timing offset
|
||||
int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP
|
||||
int timing_advance; ///timing advance signalled from eNB
|
||||
int hw_timing_advance;
|
||||
int N_TA_offset; ///timing offset used in TDD
|
||||
/// Flag to tell if UE is secondary user (cognitive mode)
|
||||
unsigned char is_secondary_ue;
|
||||
|
||||
@@ -721,8 +721,7 @@ typedef struct {
|
||||
int rx_offset; /// Timing offset
|
||||
int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP
|
||||
int time_sync_cell;
|
||||
int timing_advance; ///timing advance signalled from eNB
|
||||
int hw_timing_advance;
|
||||
int timing_advance; /// timing advance signalled from eNB
|
||||
int N_TA_offset; ///timing offset used in TDD
|
||||
/// Flag to tell if UE is secondary user (cognitive mode)
|
||||
unsigned char is_secondary_ue;
|
||||
|
||||
@@ -713,8 +713,6 @@ typedef struct PHY_VARS_eNB_s {
|
||||
uint32_t total_transmitted_bits;
|
||||
uint32_t total_system_throughput;
|
||||
|
||||
int hw_timing_advance;
|
||||
|
||||
time_stats_t phy_proc_tx;
|
||||
time_stats_t phy_proc_rx;
|
||||
time_stats_t rx_prach;
|
||||
|
||||
@@ -175,7 +175,7 @@ struct NR_DL_FRAME_PARMS {
|
||||
/// subcarrier spacing (15,30,60,120)
|
||||
uint32_t subcarrier_spacing;
|
||||
/// 3/4 sampling
|
||||
uint8_t threequarter_fs;
|
||||
int threequarter_fs;
|
||||
/// Size of FFT
|
||||
uint16_t ofdm_symbol_size;
|
||||
/// Number of prefix samples in all but first symbol of slot
|
||||
|
||||
@@ -320,7 +320,7 @@ static void configure_dlsch(NR_UE_DLSCH_t *dlsch0,
|
||||
}
|
||||
}
|
||||
|
||||
void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command_pdu)
|
||||
static void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command_pdu)
|
||||
{
|
||||
|
||||
/* Time Alignment procedure
|
||||
@@ -365,13 +365,19 @@ void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command
|
||||
const double t_subframe = 1.0; // subframe duration of 1 msec
|
||||
const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe);
|
||||
|
||||
ue->ta_slot = (ta_command_pdu->ta_slot + ul_tx_timing_adjustment) % slots_per_frame;
|
||||
if (ta_command_pdu->ta_slot + ul_tx_timing_adjustment > slots_per_frame)
|
||||
ue->ta_frame = (ta_command_pdu->ta_frame + 1) % 1024;
|
||||
else
|
||||
if (ta_command_pdu->is_rar) {
|
||||
ue->ta_slot = ta_command_pdu->ta_slot;
|
||||
ue->ta_frame = ta_command_pdu->ta_frame;
|
||||
|
||||
ue->ta_command = ta_command_pdu->ta_command;
|
||||
ue->timing_advance = 0;
|
||||
ue->ta_command = ta_command_pdu->ta_command + 31; // To use TA adjustment algo in ue_ta_procedures()
|
||||
} else {
|
||||
ue->ta_slot = (ta_command_pdu->ta_slot + ul_tx_timing_adjustment) % slots_per_frame;
|
||||
if (ta_command_pdu->ta_slot + ul_tx_timing_adjustment > slots_per_frame)
|
||||
ue->ta_frame = (ta_command_pdu->ta_frame + 1) % 1024;
|
||||
else
|
||||
ue->ta_frame = ta_command_pdu->ta_frame;
|
||||
ue->ta_command = ta_command_pdu->ta_command;
|
||||
}
|
||||
LOG_D(PHY,"TA command received in Frame.Slot %d.%d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n",
|
||||
ta_command_pdu->ta_frame, ta_command_pdu->ta_slot, ue->ta_frame, ue->ta_slot);
|
||||
}
|
||||
|
||||
@@ -232,15 +232,14 @@ int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
|
||||
// - If the current tx frame and slot match the TA configuration
|
||||
// then timing advance is processed and set to be applied in the next UL transmission
|
||||
// - Application of timing adjustment according to TS 38.213 p4.2
|
||||
// todo:
|
||||
// - handle RAR TA application as per ch 4.2 TS 38.213
|
||||
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx)
|
||||
{
|
||||
if (frame_tx == ue->ta_frame && slot_tx == ue->ta_slot) {
|
||||
|
||||
uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size;
|
||||
|
||||
// convert time factor "16 * 64 * T_c / (2^mu)" in N_TA calculation in TS38.213 section 4.2 to samples by multiplying with samples per second
|
||||
// convert time factor "16 * 64 * T_c / (2^mu)" in N_TA calculation in TS38.213 section 4.2 to samples by multiplying with
|
||||
// samples per second
|
||||
// 16 * 64 * T_c / (2^mu) * samples_per_second
|
||||
// = 16 * T_s / (2^mu) * samples_per_second
|
||||
// = 16 * 1 / (15 kHz * 2048) / (2^mu) * (15 kHz * 2^mu * ofdm_symbol_size)
|
||||
@@ -250,7 +249,8 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx)
|
||||
|
||||
ue->timing_advance += (ue->ta_command - 31) * bw_scaling;
|
||||
|
||||
LOG_D(PHY, "[UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
|
||||
LOG_D(PHY,
|
||||
"[UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
|
||||
ue->Mod_id,
|
||||
frame_tx,
|
||||
slot_tx,
|
||||
|
||||
@@ -1151,8 +1151,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue,
|
||||
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
ulsch_start = ue->rx_offset + subframe_tx * frame_parms->samples_per_tti
|
||||
- ue->hw_timing_advance - ue->timing_advance - ue->N_TA_offset + 5;
|
||||
ulsch_start = ue->rx_offset + subframe_tx * frame_parms->samples_per_tti - ue->timing_advance - ue->N_TA_offset + 5;
|
||||
|
||||
if(ulsch_start < 0)
|
||||
ulsch_start = ulsch_start + (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti);
|
||||
@@ -1210,16 +1209,6 @@ void ulsch_common_procedures(PHY_VARS_UE *ue,
|
||||
((short *)ue->common_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l];
|
||||
((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1];
|
||||
}
|
||||
|
||||
/*
|
||||
only for debug
|
||||
LOG_I(PHY,"ul-signal [subframe: %d, ulsch_start %d, TA: %d, rxOffset: %d, timing_advance: %d, hw_timing_advance: %d]\n",subframe_tx, ulsch_start, ue->N_TA_offset, ue->rx_offset, ue->timing_advance, ue->hw_timing_advance);
|
||||
if( (crash == 1) && (subframe_tx == 0) )
|
||||
{
|
||||
LOG_E(PHY,"***** DUMP TX Signal [ulsch_start %d] *****\n",ulsch_start);
|
||||
LOG_M("txBuff.m","txSignal",&ue->common_vars.txdata[aa][ulsch_start],frame_parms->samples_per_tti,1,1);
|
||||
}
|
||||
*/
|
||||
} //nb_antennas_tx
|
||||
|
||||
if ( LOG_DEBUGFLAG(UE_TIMING)) {
|
||||
|
||||
@@ -552,6 +552,8 @@ int main(int argc, char *argv[])
|
||||
gNB = RC.gNB[0];
|
||||
gNB->ofdm_offset_divisor = UINT_MAX;
|
||||
gNB->num_pusch_symbols_per_thread = 1;
|
||||
gNB->RU_list[0] = calloc(1, sizeof(**gNB->RU_list));
|
||||
gNB->RU_list[0]->rfdevice.openair0_cfg = openair0_cfg;
|
||||
|
||||
initFloatingCoresTpool(threadCnt, &gNB->threadPool, false, "gNB-tpool");
|
||||
initNotifiedFIFO(&gNB->respDecode);
|
||||
|
||||
Reference in New Issue
Block a user