Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZhouShuya
OpenXG-RAN
Commits
fc657e21
Commit
fc657e21
authored
Mar 17, 2018
by
Luis Ariza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solving synchronization problems
parent
1dd2940f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
46 deletions
+82
-46
openair1/PHY/LTE_TRANSPORT/initial_sync.c
openair1/PHY/LTE_TRANSPORT/initial_sync.c
+40
-3
openair2/RRC/LITE/rrc_UE.c
openair2/RRC/LITE/rrc_UE.c
+0
-1
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+26
-26
targets/SIMU/USER/oaisim_functions.c
targets/SIMU/USER/oaisim_functions.c
+16
-16
No files found.
openair1/PHY/LTE_TRANSPORT/initial_sync.c
View file @
fc657e21
...
...
@@ -868,7 +868,7 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
// uint16_t Nid_cell_fdd_ncp=0,Nid_cell_fdd_ecp=0,Nid_cell_tdd_ncp=0,Nid_cell_tdd_ecp=0;
LTE_DL_FRAME_PARMS
*
frame_parms
=
&
ue
->
frame_parms
;
int
ret
=-
1
;
//
int aarx,rx_power=0;
int
aarx
,
rx_power
=
0
;
/*#ifdef OAI_USRP
__m128i *rxdata128;
#endif*/
...
...
@@ -879,6 +879,7 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
//frame_parms->frame_type=FDD;
frame_parms
->
frame_type
=
PHY_vars_eNB_g
[
0
][
0
]
->
frame_parms
.
frame_type
;
frame_parms
->
Ncp
=
PHY_vars_eNB_g
[
0
][
0
]
->
frame_parms
.
Ncp
;
init_frame_parms
(
frame_parms
,
1
);
//frame_parms->N_RB_DL=PHY_vars_eNB_g[0][0]->frame_parms.N_RB_DL;
// cellid
...
...
@@ -889,11 +890,20 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
// lte-gold
lte_gold
(
frame_parms
,
ue
->
lte_gold_table
[
0
],
frame_parms
->
Nid_cell
);
ret
=
pbch_detection_freq
(
ue
,
mode
);
init_frame_parms
(
frame_parms
,
1
);
//
init_frame_parms(frame_parms,1);
//printf("dumping enb frame params\n");
//dump_frame_parms(&PHY_vars_eNB_g[0][0]->frame_parms);
//printf("dumping ue frame params\n");
//dump_frame_parms(frame_parms);
if
(
ret
==-
1
)
{
frame_parms
->
frame_type
=
PHY_vars_eNB_g
[
0
][
0
]
->
frame_parms
.
frame_type
;
frame_parms
->
Ncp
=
PHY_vars_eNB_g
[
0
][
0
]
->
frame_parms
.
Ncp
;
init_frame_parms
(
frame_parms
,
1
);
frame_parms
->
nushift
=
frame_parms
->
Nid_cell
%
6
;
lte_gold
(
frame_parms
,
ue
->
lte_gold_table
[
0
],
frame_parms
->
Nid_cell
);
ret
=
pbch_detection
(
ue
,
mode
);
}
if
(
ret
==
0
)
{
// fake first PBCH found so indicate sync to higher layers and configure frame parameters
//printf("[UE%d] frame_type is %c\n",ue->Mod_id, ue->rx_offset);
...
...
@@ -971,7 +981,34 @@ int initial_sync_freq(PHY_VARS_UE *ue, runmode_t mode)
openair0_cfg
[
0
].
rx_freq
[
0
]
-
ue
->
common_vars
.
freq_offset
,
ue
->
common_vars
.
freq_offset
);
#endif
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain
(
ue
,
dB_fixed
(
ue
->
measurements
.
rssi
),
0
);
#endif
#endif
#endif
}
else
{
#ifdef DEBUG_INITIAL_SYNC
LOG_I
(
PHY
,
"[UE%d] Initial sync : PBCH not ok
\n
"
,
ue
->
Mod_id
);
LOG_I
(
PHY
,
"[UE%d] Initial sync : Estimated PSS position %d, Nid2 %d
\n
"
,
ue
->
Mod_id
,
sync_pos
,
ue
->
common_vars
.
eNb_id
);
/* LOG_I(PHY,"[UE%d] Initial sync: (metric fdd_ncp %d (%d), metric fdd_ecp %d (%d), metric_tdd_ncp %d (%d), metric_tdd_ecp %d (%d))\n",
ue->Mod_id,
metric_fdd_ncp,Nid_cell_fdd_ncp,
metric_fdd_ecp,Nid_cell_fdd_ecp,
metric_tdd_ncp,Nid_cell_tdd_ncp,
metric_tdd_ecp,Nid_cell_tdd_ecp);*/
LOG_I
(
PHY
,
"[UE%d] Initial sync : Estimated Nid_cell %d, Frame_type %d
\n
"
,
ue
->
Mod_id
,
frame_parms
->
Nid_cell
,
frame_parms
->
frame_type
);
#endif
ue
->
UE_mode
[
0
]
=
NOT_SYNCHED
;
ue
->
pbch_vars
[
0
]
->
pdu_errors_last
=
ue
->
pbch_vars
[
0
]
->
pdu_errors
;
ue
->
pbch_vars
[
0
]
->
pdu_errors
++
;
ue
->
pbch_vars
[
0
]
->
pdu_errors_conseq
++
;
}
return
ret
;
}
openair2/RRC/LITE/rrc_UE.c
View file @
fc657e21
...
...
@@ -2737,7 +2737,6 @@ int decode_BCCH_DLSCH_Message(
decode_SI
(
ctxt_pP
,
eNB_index
);
}
break
;
case
BCCH_DL_SCH_MessageType__c1_PR_NOTHING
:
...
...
targets/RT/USER/lte-ue.c
View file @
fc657e21
...
...
@@ -161,7 +161,6 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_
}
CPU_FREE
(
cset
);
#endif
// Lock memory from swapping. This is a process wide call (not constraint to this thread).
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
);
pthread_setname_np
(
pthread_self
(),
name
);
...
...
@@ -588,7 +587,11 @@ static void *UE_thread_synch_freq(void *arg) {
case
pbch
:
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial frequency Synch (mode %d), initial_synch is %d
\n
"
,
UE
->
mode
,
initial_sync_freq
(
UE
,
UE
->
mode
));
#if DISABLE_LOG_X
printf
(
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
#else
LOG_I
(
PHY
,
"[UE thread Synch] Running Initial Synch (mode %d)
\n
"
,
UE
->
mode
);
#endif
//Pushed N_RB_DL, PHICH_CONFIG, FRAME_NUMBER
if
(
initial_sync_freq
(
UE
,
UE
->
mode
)
==
0
)
{
...
...
@@ -669,13 +672,13 @@ static void *UE_thread_synch_freq(void *arg) {
UE
->
is_synchronized
=
1
;
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
/*
if( UE->mode == rx_dump_frame ) {
if
(
UE
->
mode
==
rx_dump_frame
)
{
FILE
*
fd
;
if
((
UE
->
proc
.
proc_rxtx
[
0
].
frame_rx
&
1
)
==
0
)
{
// this guarantees SIB1 is present
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
fwrite((void*)&UE->common_vars.
rxdata
[0][0],
fwrite
((
void
*
)
&
UE
->
common_vars
.
common_vars_rx_data_per_thread
[
0
].
rxdataF
[
0
][
0
],
sizeof
(
int32_t
),
10*
UE->frame_parms.samples_per_tti
,
10
*
(
UE
->
frame_parms
.
ofdm_symbol_size
*
UE
->
frame_parms
.
symbols_per_tti
)
,
fd
);
LOG_I
(
PHY
,
"Dummping Frame ... bye bye
\n
"
);
fclose
(
fd
);
...
...
@@ -690,9 +693,9 @@ static void *UE_thread_synch_freq(void *arg) {
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
}
}*/
}
/*} else {
}
}
else
{
// initial sync failed
// calculate new offset and try again
if
(
UE
->
UE_scan_carrier
==
1
)
{
...
...
@@ -704,9 +707,9 @@ static void *UE_thread_synch_freq(void *arg) {
LOG_I
(
PHY
,
"[initial_sync] No cell synchronization found, abandoning
\n
"
);
FILE
*
fd
;
if
((
fd
=
fopen
(
"rxsig_frame0.dat"
,
"w"
))
!=
NULL
)
{
fwrite((void*)&UE->common_vars.
rxdata
[0][0],
fwrite
((
void
*
)
&
UE
->
common_vars
.
common_vars_rx_data_per_thread
[
0
].
rxdataF
[
0
][
0
],
sizeof
(
int32_t
),
10*
UE->frame_parms.samples_per_tti
,
10
*
(
UE
->
frame_parms
.
ofdm_symbol_size
*
UE
->
frame_parms
.
symbols_per_tti
)
,
fd
);
LOG_I
(
PHY
,
"Dummping Frame ... bye bye
\n
"
);
fclose
(
fd
);
...
...
@@ -716,11 +719,19 @@ static void *UE_thread_synch_freq(void *arg) {
return
&
UE_thread_synch_retval
;
// not reached
}
}
LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n",
#if DISABLE_LOG_X
printf
(
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
freq_offset
,
UE
->
rx_total_gain_dB
,
downlink_frequency
[
0
][
0
]
+
freq_offset
,
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
]
+
freq_offset
);
#else
LOG_I
(
PHY
,
"[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)
\n
"
,
freq_offset
,
UE
->
rx_total_gain_dB
,
downlink_frequency
[
0
][
0
]
+
freq_offset
,
downlink_frequency
[
0
][
0
]
+
uplink_frequency_offset
[
0
][
0
]
+
freq_offset
);
#endif
for
(
i
=
0
;
i
<
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_num_channels
;
i
++
)
{
openair0_cfg
[
UE
->
rf_map
.
card
].
rx_freq
[
UE
->
rf_map
.
chain
+
i
]
=
downlink_frequency
[
CC_id
][
i
]
+
freq_offset
;
...
...
@@ -729,7 +740,7 @@ static void *UE_thread_synch_freq(void *arg) {
if
(
UE
->
UE_scan_carrier
==
1
)
openair0_cfg
[
UE
->
rf_map
.
card
].
autocal
[
UE
->
rf_map
.
chain
+
i
]
=
1
;
}
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
*/
UE
->
rfdevice
.
trx_set_freq_func
(
&
UE
->
rfdevice
,
&
openair0_cfg
[
0
],
0
);
}
// initial_sync=0
break
;
case
si
:
...
...
@@ -1183,8 +1194,6 @@ void *UE_thread_freq(void *arg) {
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
if
(
threads
.
iq
!=
-
1
)
CPU_SET
(
threads
.
iq
,
&
cpuset
);
init_thread
(
100000
,
500000
,
FIFO_PRIORITY
,
&
cpuset
,
...
...
@@ -1209,16 +1218,13 @@ void *UE_thread_freq(void *arg) {
AssertFatal
(
0
==
pthread_mutex_lock
(
&
UE
->
proc
.
mutex_synch
),
""
);
int
instance_cnt_synch
=
UE
->
proc
.
instance_cnt_synch
;
int
is_synchronized
=
UE
->
is_synchronized
;
//printf("[ue_thread] UE is synchronized: %d, instance_cnt_synch: %d\n",is_synchronized,instance_cnt_synch);
AssertFatal
(
0
==
pthread_mutex_unlock
(
&
UE
->
proc
.
mutex_synch
),
""
);
if
(
is_synchronized
==
0
)
{
if
(
instance_cnt_synch
<
0
)
{
// we can invoke the synch
// grab 10 ms of signal and wakeup synch thread
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
{
rxp_freq
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
common_vars_rx_data_per_thread
[
0
].
rxdataF
[
i
][
0
];
}
if
(
UE
->
mode
!=
loop_through_memory
)
{
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
*
UE
->
frame_parms
.
symbols_per_tti
*
10
==
...
...
@@ -1266,7 +1272,7 @@ void *UE_thread_freq(void *arg) {
start_rx_stream
=
1
;
//printf("[ue_thread] UE is synch and start_rx_stream change from 0 to %d, UE->rx_offset %d \n",start_rx_stream,UE->rx_offset);
if
(
UE
->
mode
!=
loop_through_memory
)
{
/*
if (UE->no_timing_correction==0) {//no_timing_correction is loaded to 1 in oaisim_functions.c
if
(
UE
->
no_timing_correction
==
0
)
{
//no_timing_correction is loaded to 1 in oaisim_functions.c
LOG_I
(
PHY
,
"Resynchronizing RX by %d samples (mode = %d)
\n
"
,
UE
->
rx_offset
,
UE
->
mode
);
AssertFatal
(
UE
->
rx_offset
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
...
...
@@ -1274,13 +1280,7 @@ void *UE_thread_freq(void *arg) {
(
void
**
)
UE
->
common_vars
.
common_vars_rx_data_per_thread
[
0
].
rxdataF
,
UE
->
rx_offset
,
UE
->
frame_parms
.
nb_antennas_rx
),
""
);
AssertFatal(UE->rx_offset ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
×tamp,
(void**)UE->common_vars.common_vars_rx_data_per_thread[1].rxdataF,
UE->rx_offset,
UE->frame_parms.nb_antennas_rx),"");
}*/
}
UE
->
rx_offset
=
0
;
UE
->
time_sync_cell
=
0
;
//UE->proc.proc_rxtx[0].frame_rx++;
...
...
targets/SIMU/USER/oaisim_functions.c
View file @
fc657e21
...
...
@@ -1073,7 +1073,7 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
*
ptimestamp
=
last_eNB_rx_timestamp
[
eNB_id
][
CC_id
];
int
do_ofdm_mod
=
PHY_vars_UE_g
[
0
][
CC_id
]
->
do_ofdm_mod
;
int
do_ofdm_mod
=
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
do_ofdm_mod
;
uint32_t
frame
;
//int n_ra_prb;
...
...
@@ -1126,7 +1126,7 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
//printf("is Prach generated? %d, is prach_subframe? %d, frame %d, subframe %d, mode %d\n",PHY_vars_UE_g[0][CC_id]->generate_prach,is_prach_subframe(frame_parms,frame,subframe),frame,subframe,PHY_vars_UE_g[0][CC_id]->UE_mode[eNB_id]);
if
(
do_ofdm_mod
)
{
for
(
UE_id
=
0
;
UE_id
<
NB_UE_INST
;
UE_id
++
){
for
(
UE_id
=
NB_UE_INST
-
1
;
UE_id
>=
0
;
UE_id
--
){
if
(
is_prach_subframe
(
&
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
frame_parms
,
frame
,
subframe
)
&&
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
generate_prach
)
{
start_meas
(
&
UE2eNB
[
UE_id
][
eNB_id
][
CC_id
]
->
UL_PRACH_channel
);
...
...
@@ -1400,7 +1400,7 @@ void init_devices(void){
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
rfdevice
.
trx_stop_func
=
eNB_trx_stop
;
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
rfdevice
.
trx_set_freq_func
=
eNB_trx_set_freq
;
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
rfdevice
.
trx_set_gains_func
=
eNB_trx_set_gains
;
if
(
PHY_vars_UE_g
[
0
][
0
]
->
do_ofdm_mod
)
if
(
PHY_vars_UE_g
[
0
][
CC_id
]
->
do_ofdm_mod
)
current_eNB_rx_timestamp
[
eNB_id
][
CC_id
]
=
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
frame_parms
.
ofdm_symbol_size
*
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
frame_parms
.
symbols_per_tti
;
else
current_eNB_rx_timestamp
[
eNB_id
][
CC_id
]
=
PHY_vars_eNB_g
[
eNB_id
][
CC_id
]
->
frame_parms
.
samples_per_tti
;
...
...
@@ -1416,7 +1416,7 @@ void init_devices(void){
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
rfdevice
.
trx_stop_func
=
UE_trx_stop
;
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
rfdevice
.
trx_set_freq_func
=
UE_trx_set_freq
;
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
rfdevice
.
trx_set_gains_func
=
UE_trx_set_gains
;
if
(
PHY_vars_UE_g
[
0
][
0
]
->
do_ofdm_mod
)
if
(
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
do_ofdm_mod
)
current_UE_rx_timestamp
[
UE_id
][
CC_id
]
=
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
frame_parms
.
ofdm_symbol_size
*
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
frame_parms
.
symbols_per_tti
;
else
current_UE_rx_timestamp
[
UE_id
][
CC_id
]
=
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
frame_parms
.
samples_per_tti
;
...
...
@@ -1611,16 +1611,16 @@ void init_openair2(void)
void
init_ocm
(
void
)
{
module_id_t
UE_id
,
eNB_id
;
int
CC_id
;
module_id_t
UE_id
=
0
,
eNB_id
=
0
;
int
CC_id
=
0
;
/* Added for PHY abstraction */
char
*
frame_type
=
"unknown"
;
int
do_ofdm_mod
=
PHY_vars_UE_g
[
0
][
0
]
->
do_ofdm_mod
;
int
do_ofdm_mod
=
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
do_ofdm_mod
;
int
nb_rb
,
n_samples
;
nb_rb
=
PHY_vars_UE_g
[
0
][
0
]
->
frame_parms
.
N_RB_DL
;
nb_rb
=
PHY_vars_UE_g
[
UE_id
][
CC_id
]
->
frame_parms
.
N_RB_DL
;
n_samples
=
nb_rb
*
12
+
1
;
switch
(
oai_emulation
.
info
.
frame_type
[
0
])
{
...
...
@@ -1699,14 +1699,14 @@ void init_ocm(void)
forgetting_factor
,
0
,
0
);
if
(
do_ofdm_mod
)
{
/*
if (do_ofdm_mod)
{
*/
random_channel_freq
(
eNB2UE
[
eNB_id
][
UE_id
][
CC_id
],
abstraction_flag
);
//Find a(l)
freq_channel_SSE_float
(
eNB2UE
[
eNB_id
][
UE_id
][
CC_id
],
nb_rb
,
n_samples
);
//Find desc->chF
}
/*
}
else
random_channel
(
eNB2UE
[
eNB_id
][
UE_id
][
CC_id
],
abstraction_flag
);
random_channel(eNB2UE[eNB_id][UE_id][CC_id],abstraction_flag);
*/
LOG_D
(
OCM
,
"[SIM] Initializing channel (%s, %d) from UE %d to eNB %d
\n
"
,
oai_emulation
.
environment_system_config
.
fading
.
small_scale
.
selected_option
,
map_str_to_int
(
small_scale_names
,
oai_emulation
.
environment_system_config
.
fading
.
small_scale
.
selected_option
),
UE_id
,
eNB_id
);
...
...
@@ -1720,13 +1720,13 @@ void init_ocm(void)
forgetting_factor
,
0
,
0
);
if
(
do_ofdm_mod
)
{
/*
if (do_ofdm_mod)
{
*/
random_channel_freq
(
UE2eNB
[
UE_id
][
eNB_id
][
CC_id
],
abstraction_flag
);
//Find a(l)
freq_channel_SSE_float
(
UE2eNB
[
UE_id
][
eNB_id
][
CC_id
],
nb_rb
,
n_samples
);
//Find desc->chF
}
/*
}
else
random_channel
(
UE2eNB
[
UE_id
][
eNB_id
][
CC_id
],
abstraction_flag
);
random_channel(UE2eNB[UE_id][eNB_id][CC_id],abstraction_flag);
*/
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
//UE2eNB[UE_id][eNB_id] = eNB2UE[eNB_id][UE_id];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment