Commit 9fb2f736 authored by Raymond Knopp's avatar Raymond Knopp

fronthaul bugfixes for IF4p5 2x2 antenna configuration, testing with TM2

parent e47829af
......@@ -79,17 +79,15 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
if (eth->flags == ETH_RAW_IF4p5_MODE) {
packet_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
} else {
packet_header = (IF4p5_header_t *)(tx_buffer);
data_block = (uint16_t*)(tx_buffer + sizeof_IF4p5_header_t);
}
if (eth->flags == ETH_RAW_IF4p5_MODE) packet_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
else packet_header = (IF4p5_header_t *)(tx_buffer);
gen_IF4p5_dl_header(packet_header, frame, subframe);
AssertFatal(txdataF[0]!=NULL,"txdataF_BF[0] is null\n");
for (symbol_id=0; symbol_id<nsym; symbol_id++) {
if (eth->flags == ETH_RAW_IF4p5_MODE) data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
else data_block = (uint16_t*)(tx_buffer + sizeof_IF4p5_header_t);
for (int antenna_id=0; antenna_id<ru->nb_tx; antenna_id++) {
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &txdataF[antenna_id][blockoffsetF+element_id];
......@@ -98,6 +96,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
i = (uint16_t*) &txdataF[antenna_id][slotoffsetF+element_id];
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw_if4p5[*i]) | (lin2alaw_if4p5[*(i+1)]<<8);
}
data_block+=db_fulllength;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 0 );
packet_header->frame_status &= ~(0x7);
......@@ -133,20 +132,20 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
blockoffsetF += (fp->ofdm_symbol_size*(fp->symbols_per_tti-nsym));
}
if (eth->flags == ETH_RAW_IF4p5_MODE) {
packet_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
} else {
packet_header = (IF4p5_header_t *)(tx_buffer);
data_block = (uint16_t*)(tx_buffer + sizeof_IF4p5_header_t);
}
if (eth->flags == ETH_RAW_IF4p5_MODE) packet_header = (IF4p5_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES);
else packet_header = (IF4p5_header_t *)(tx_buffer);
gen_IF4p5_ul_header(packet_header, packet_type, frame, subframe);
if (packet_type == IF4p5_PULFFT) {
for (symbol_id=fp->symbols_per_tti-nsym; symbol_id<fp->symbols_per_tti; symbol_id++) {
uint32_t *rx0 = (uint32_t*) &rxdataF[0][blockoffsetF];
uint32_t *rx1 = (uint32_t*) &rxdataF[0][slotoffsetF];
if (eth->flags == ETH_RAW_IF4p5_MODE) data_block = (uint16_t*)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t);
else data_block = (uint16_t*)(tx_buffer + sizeof_IF4p5_header_t);
for (int aaid=0;aaid<ru->nb_rx;aaid++) {
uint32_t *rx0 = (uint32_t*) &rxdataF[aaid][blockoffsetF];
uint32_t *rx1 = (uint32_t*) &rxdataF[aaid][slotoffsetF];
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SEND_IF4_SYMBOL, symbol_id );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 1 );
......@@ -178,6 +177,8 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
d[7] = ((uint16_t) lin2alaw_if4p5[i[14]]) | ((uint16_t)(lin2alaw_if4p5[i[15]]<<8));
}
data_block+=db_fulllength;
}
stop_meas(&ru->compression);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF, 0 );
packet_header->frame_status &= ~(0x07);
......@@ -349,8 +350,10 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
*i = alaw2lin_if4p5[ (data_block[element_id+db_halflength] & 0xff) ];
*(i+1) = alaw2lin_if4p5[ (data_block[element_id+db_halflength]>>8) ];
}
data_block+=db_fulllength;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );
} else if (*packet_type == IF4p5_PULFFT) {
db_fulllength/=ru->nb_rx;
db_halflength/=ru->nb_rx;
......@@ -378,6 +381,7 @@ void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint
LOG_D(PHY,"PULFFT_IF4p5: CC_id %d : frame %d, subframe %d (symbol %d)=> %d dB\n",ru->idx,*frame,*subframe,*symbol_number,
dB_fixed(signal_energy((int*)&rxdataF[antenna_id][slotoffsetF],db_halflength)+
signal_energy((int*)&rxdataF[antenna_id][blockoffsetF],db_halflength)));
data_block+=db_fulllength;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF, 0 );
} else if (*packet_type >= IF4p5_PRACH &&
......
......@@ -48,6 +48,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t *avg_preamble_energy,
uint16_t Nf,
uint8_t tdd_mapindex
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
......@@ -467,6 +468,8 @@ void rx_prach0(PHY_VARS_eNB *eNB,
}
*max_preamble_energy=0;
*avg_preamble_energy=0;
uint64_t avg_en=0;
for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
if (LOG_DEBUGFLAG(PRACH)) {
......@@ -611,7 +614,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
// compute energy and accumulate over receive antennas and repetitions for BR
for (i=0; i<2048; i++)
prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[i<<1] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[i<<1] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>8;
} else {
idft256(prachF,prach_ifft_tmp,1);
log2_ifft_size = 8;
......@@ -647,6 +650,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
for (i=0; i<NCS2; i++) {
lev = (int32_t)prach_ifft[(preamble_shift2+i)];
avg_en += lev;
levdB = dB_fixed_times10(lev);
if (levdB>*max_preamble_energy) {
......@@ -664,10 +668,10 @@ void rx_prach0(PHY_VARS_eNB *eNB,
*max_preamble,br_flag,ce_level,levdB,lev);
}
}
}
} ///ncs2
}
}// preamble_index
*avg_preamble_energy=dB_fixed(avg_en/64);
if (LOG_DUMPFLAG(PRACH)) {
int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840));
......@@ -706,6 +710,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t *avg_preamble_energy,
uint16_t Nf,
uint8_t tdd_mapindex,
uint8_t br_flag) {
......@@ -713,7 +718,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
int prach_mask=0;
if (br_flag == 0) {
rx_prach0(eNB,ru,max_preamble,max_preamble_energy,max_preamble_delay,Nf,tdd_mapindex,0,0);
rx_prach0(eNB,ru,max_preamble,max_preamble_energy,max_preamble_delay,avg_preamble_energy,Nf,tdd_mapindex,0,0);
} else { // This is procedure for eMTC, basically handling the repetitions
prach_mask = is_prach_subframe(&eNB->frame_parms,eNB->proc.frame_prach_br,eNB->proc.subframe_prach_br);
......@@ -727,7 +732,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
// increment repetition number
eNB->prach_vars_br.repetition_number[i]++;
// do basic PRACH reception
rx_prach0(eNB,ru,max_preamble,max_preamble_energy,max_preamble_delay,Nf,tdd_mapindex,1,i);
rx_prach0(eNB,ru,max_preamble,max_preamble_energy,max_preamble_delay,avg_preamble_energy,Nf,tdd_mapindex,1,i);
// if last repetition, clear counter
if (eNB->prach_vars_br.repetition_number[i] == eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[i]) {
......
......@@ -577,6 +577,7 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay,
uint16_t *avg_preamble_energy,
uint16_t Nf, uint8_t tdd_mapindex
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,
......
......@@ -465,6 +465,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
}
}
ue->common_vars.freq_offset=0;
/* Consider this is a false detection if the offset is > 1000 Hz */
if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) )
{
......
......@@ -59,7 +59,7 @@ void prach_procedures(PHY_VARS_eNB *eNB
int br_flag
#endif
) {
uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4],avg_preamble_energy[4];
uint16_t i;
int frame,subframe;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
......@@ -106,18 +106,21 @@ void prach_procedures(PHY_VARS_eNB *eNB
&max_preamble[0],
&max_preamble_energy[0],
&max_preamble_delay[0],
&avg_preamble_energy[0],
frame,
0
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,br_flag
#endif
);
LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : BR %d Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : BR %d Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d), threshold %d, I0 %d\n",
frame,subframe,br_flag,
max_preamble[0],
max_preamble_energy[0]/10,
max_preamble_delay[0],
eNB->prach_energy_counter);
eNB->prach_energy_counter,
eNB->measurements.prach_I0+eNB->prach_DTX_threshold,
eNB->measurements.prach_I0);
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
if (br_flag==1) {
......@@ -201,7 +204,7 @@ void prach_procedures(PHY_VARS_eNB *eNB
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
} // max_preamble_energy > prach_I0 + 100
else {
eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((avg_preamble_energy[0]*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
......
......@@ -24,6 +24,9 @@
#include <stdio.h>
#include "PHY/TOOLS/tools_defs.h"
#include "rf.h"
#include "common/utils/LOG/log.h"
void dac(double *s_re[2],
double *s_im[2],
int32_t **input,
......@@ -56,7 +59,7 @@ void dac(double *s_re[2],
V /= (meas_length);
#ifdef DEBUG_DAC
printf("DAC: 10*log10(V)=%f (%f)\n",10*log10(V),V);
LOG_I(OCM,"DAC: 10*log10(V)=%f (%f)\n",10*log10(V),V);
#endif
if (V) {
......@@ -107,21 +110,20 @@ double dac_fixed_gain(double *s_re[2],
}
#ifdef DEBUG_DAC
LOG_I(OCM,"DAC: amp %f, amp1 %f dB (%d,%d), tx_power target %f (actual %f %f),length %d,pos %d\n",
20*log10(amp),
20*log10(*amp1p),
input_offset,
input_offset_meas,
txpwr_dBm,
10*log10((double)signal_energy((int32_t*)&input[0][input_offset_meas],length_meas)/NB_RE),
10*log10((double)signal_energy((int32_t*)&input[1][input_offset_meas],length_meas)/NB_RE),
length,
input_offset_meas);
// printf("DAC: amp %f, amp1 %f dB (%d,%d), tx_power %f (%f),length %d,pos %d\n",20*log10(amp),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm,length, 10*log10((double)signal_energy((int32_t*)&input[0][input_offset_meas],length_meas)/NB_RE),input_offset_meas);
/*
if (nb_tx_antennas==2)
amp1 = AMP/2;
else if (nb_tx_antennas==4)
amp1 = ((AMP*ONE_OVER_SQRT2_Q15)>>16);
else //assume (nb_tx_antennas==1)
amp1 = ((AMP*ONE_OVER_SQRT2_Q15)>>15);
amp1 = amp1*sqrt(512.0/300.0); //account for loss due to null carriers
//printf("DL: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm);
*/
#endif
// printf("DAC: amp/amp1p %f amp1 %f dB (%d,%d), tx_power %f\n",amp/(*amp1p),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm);
for (i=0; i<length; i++) {
for (aa=0; aa<nb_tx_antennas; aa++) {
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(*amp1p);
......@@ -129,7 +131,8 @@ double dac_fixed_gain(double *s_re[2],
}
}
// printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0));
#ifdef DEBUG_DAC
LOG_I(OCM,"ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0));
#endif
return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0)/NB_RE);
}
......@@ -45,6 +45,7 @@
#define RF
//#define DEBUG_SIM 1
......@@ -116,7 +117,8 @@ void do_DL_sig(sim_t *sim,
// sf_offset = (subframe*frame_parms->samples_per_tti) + offset;
sf_offset = (subframe*frame_parms->samples_per_tti);
LOG_D(OCM,">>>>>>>>>>>>>>>>>TXPATH: RU %d : DL_sig reading TX for subframe %d (sf_offset %d, length %d) from %p\n",ru_id,subframe,sf_offset,length,txdata[0]+sf_offset);
for (int aid=0;aid<RC.ru[ru_id]->nb_tx;aid++)
LOG_D(OCM,">>>>>>>>>>>>>>>>>TXPATH: RU %d : DL_sig reading TX%d for subframe %d (sf_offset %d, length %d) from %p\n",ru_id,aid,subframe,sf_offset,length,txdata[0]+sf_offset);
int length_meas = frame_parms->ofdm_symbol_size;
if (sf_offset+length <= frame_parms->samples_per_tti*10) {
......@@ -165,8 +167,9 @@ void do_DL_sig(sim_t *sim,
frame_parms->N_RB_DL*12);
}
#ifdef DEBUG_SIM
LOG_D(OCM,"[SIM][DL] subframe %d: txp (time) %d dB\n",
subframe,dB_fixed(signal_energy(&txdata[0][sf_offset],length_meas)));
for (int aid=0;aid<RC.ru[ru_id]->nb_tx;aid++)
LOG_D(OCM,"[SIM][DL] subframe %d: txp%d (time) %d dB\n",
subframe,aid,dB_fixed(signal_energy(&txdata[aid][sf_offset],length_meas)));
LOG_D(OCM,"[SIM][DL] RU %d (CCid %d): tx_pwr %.1f dBm/RE (target %d dBm/RE), for subframe %d\n",
ru_id,CC_id,
......
......@@ -28,6 +28,7 @@
#include "sim.h"
//#define DEBUG_CH
uint8_t multipath_channel_nosigconv(channel_desc_t *desc)
{
......
......@@ -39,7 +39,7 @@ eNBs =
Nid_cell = 0;
N_RB_DL = 50;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antenna_ports = 2;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
......@@ -105,7 +105,7 @@ eNBs =
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
ue_TransmissionMode = 2;
}
);
......@@ -193,8 +193,8 @@ RUs = (
remote_portd = 50001;
local_rf = "no"
tr_preference = "udp_if4p5"
nb_tx = 1
nb_rx = 1
nb_tx = 2
nb_rx = 2
att_tx = 0
att_rx = 0;
eNB_instances = [0];
......@@ -212,13 +212,13 @@ THREAD_STRUCT = (
);
log_config = {
global_log_level ="info";
global_log_level ="debug";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_level ="debug";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_level ="debug";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
......
......@@ -9,8 +9,8 @@ RUs = (
remote_portd = 50001;
local_rf = "yes"
tr_preference = "udp_if4p5";
nb_tx = 1;
nb_rx = 1;
nb_tx = 2;
nb_rx = 2;
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
bands = [7,13];
......
......@@ -927,6 +927,7 @@ void *ru_thread_prach( void *param ) {
NULL,
NULL,
NULL,
NULL,
proc->frame_prach,
0
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
......@@ -965,6 +966,7 @@ void *ru_thread_prach_br( void *param ) {
NULL,
NULL,
NULL,
NULL,
proc->frame_prach_br,
0,
1);
......@@ -1135,18 +1137,18 @@ void wakeup_L1s(RU_t *ru) {
//LOG_I(PHY,"RU mask is now %x, time is %lu\n",proc->RU_mask[ru->proc.subframe_rx], t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec);
if (proc->RU_mask[ru->proc.subframe_rx] == (1<<eNB->num_RU)-1) { // all RUs have provided their information so continue on and wakeup eNB top
LOG_D(PHY, "ru_mask is %d \n ", proc->RU_mask[ru->proc.subframe_rx]);
LOG_D(PHY, "the number of RU is %d, the current ru is RU %d \n ", (1<<eNB->num_RU)-1, ru->idx);
LOG_D(PHY, "ru->proc.subframe_rx is %d \n", ru->proc.subframe_rx);
LOG_D(PHY,"ru_mask is %d \n ", proc->RU_mask[ru->proc.subframe_rx]);
LOG_D(PHY,"the number of RU is %d, the current ru is RU %d \n ", (1<<eNB->num_RU)-1, ru->idx);
LOG_D(PHY,"ru->proc.subframe_rx is %d \n", ru->proc.subframe_rx);
LOG_D(PHY,"Reseting mask frame %d, subframe %d, this is RU %d\n",ru->proc.frame_rx, ru->proc.subframe_rx, ru->idx);
proc->RU_mask[ru->proc.subframe_rx] = 0;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_MASK_RU, proc->RU_mask[ru->proc.subframe_rx]);
clock_gettime(CLOCK_MONOTONIC,&t);
//stop_meas(&proc->ru_arrival_time);
AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000,
/* AssertFatal(t.tv_nsec < proc->t[ru->proc.subframe_rx].tv_nsec+5000000,
"Time difference for subframe %d (Frame %d) => %lu > 5ms, this is RU %d\n",
ru->proc.subframe_rx, ru->proc.frame_rx, t.tv_nsec - proc->t[ru->proc.subframe_rx].tv_nsec, ru->idx);
*/
// VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.frame_rx);
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_L1S_RU+ru->idx, ru->proc.subframe_rx);
AssertFatal(0==pthread_mutex_unlock(&proc->mutex_RU),"");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment