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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
5679e4a3
Commit
5679e4a3
authored
Mar 22, 2022
by
Florian Kaltenberger
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
making SFN dependent on GPS time (when available)
parent
828387c5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
executables/nr-ru.c
executables/nr-ru.c
+8
-1
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+6
-6
No files found.
executables/nr-ru.c
View file @
5679e4a3
...
...
@@ -604,6 +604,7 @@ void *emulatedRF_thread(void *param) {
void
rx_rf
(
RU_t
*
ru
,
int
*
frame
,
int
*
slot
)
{
RU_proc_t
*
proc
=
&
ru
->
proc
;
NR_DL_FRAME_PARMS
*
fp
=
ru
->
nr_frame_parms
;
openair0_config_t
*
cfg
=
&
ru
->
openair0_cfg
;
void
*
rxp
[
ru
->
nb_rx
];
unsigned
int
rxs
;
int
i
;
...
...
@@ -653,7 +654,13 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
}
}
proc
->
frame_rx
=
(
proc
->
timestamp_rx
/
(
fp
->
samples_per_subframe
*
10
))
&
1023
;
//compute system frame number (SFN) according to O-RAN-WG4-CUS.0-v02.00 (using alpha=beta=0)
// this assumes that the USRP has been synchronized to the GPS time
// OAI uses timestamps in sample time stored in int64_t, but it will fit in double precision for many years to come.
double
gps_sec
=
((
double
)
ts
)
/
cfg
->
sample_rate
;
proc
->
frame_rx
=
((
int64_t
)
(
gps_sec
/
0
.
01
))
&
1023
;
//proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_subframe*10))&1023;
proc
->
tti_rx
=
fp
->
get_slot_from_timestamp
(
proc
->
timestamp_rx
,
fp
);
// synchronize first reception to frame 0 subframe 0
LOG_D
(
PHY
,
"RU %d/%d TS %llu , frame %d, slot %d.%d / %d
\n
"
,
...
...
targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
View file @
5679e4a3
...
...
@@ -203,8 +203,8 @@ static int sync_to_gps(openair0_device *device) {
//Set to GPS time
uhd
::
time_spec_t
gps_time
=
uhd
::
time_spec_t
(
time_t
(
s
->
usrp
->
get_mboard_sensor
(
"gps_time"
,
mboard
).
to_int
()));
//
s->usrp->set_time_next_pps(gps_time+1.0, mboard);
s
->
usrp
->
set_time_next_pps
(
uhd
::
time_spec_t
(
0.0
));
s
->
usrp
->
set_time_next_pps
(
gps_time
+
1.0
,
mboard
);
//
s->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
//Wait for it to apply
//The wait is 2 seconds because N-Series has a known issue where
//the time at the last PPS does not properly update at the PPS edge
...
...
@@ -215,10 +215,10 @@ static int sync_to_gps(openair0_device *device) {
uhd
::
time_spec_t
time_last_pps
=
s
->
usrp
->
get_time_last_pps
(
mboard
);
std
::
cout
<<
"USRP time: "
<<
(
boost
::
format
(
"%0.9f"
)
%
time_last_pps
.
get_real_secs
())
<<
std
::
endl
;
std
::
cout
<<
"GPSDO time: "
<<
(
boost
::
format
(
"%0.9f"
)
%
gps_time
.
get_real_secs
())
<<
std
::
endl
;
//
if (gps_time.get_real_secs() == time_last_pps.get_real_secs())
//
std::cout << std::endl << "SUCCESS: USRP time synchronized to GPS time" << std::endl << std::endl;
//
else
//
std::cerr << std::endl << "ERROR: Failed to synchronize USRP time to GPS time" << std::endl << std::endl;
if
(
gps_time
.
get_real_secs
()
==
time_last_pps
.
get_real_secs
())
std
::
cout
<<
std
::
endl
<<
"SUCCESS: USRP time synchronized to GPS time"
<<
std
::
endl
<<
std
::
endl
;
else
std
::
cerr
<<
std
::
endl
<<
"ERROR: Failed to synchronize USRP time to GPS time"
<<
std
::
endl
<<
std
::
endl
;
}
if
(
num_gps_locked
==
num_mboards
and
num_mboards
>
1
)
{
...
...
FANG WANG
@wf
mentioned in commit
f85ccaa0
·
Mar 29, 2022
mentioned in commit
f85ccaa0
mentioned in commit f85ccaa007ab4f88fdde6b3c7a5765e4449647ee
Toggle commit list
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