ptrkrysik / uhd

USRP Hardware Driver Repository
Other
6 stars 2 forks source link

set_time_next_pps and get_time_last_pps don't work #2

Closed jevkri closed 1 month ago

jevkri commented 1 year ago

Hello, seems like I found an issue with the x411 code. Reporting it below. Thanks.

Issue Description

The clock source is set to Internal Using set_time_next_pps doesn't seem to function. Also using get_time_last_pps returns 0 always

Software which is relying on the checks like this are stuck forever uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps(); while (time_last_pps == s->usrp->get_time_last_pps())

For example setting PC clock on next PPS in GNU Radio UHD source will stay forever waiting and doesn't provide any error.

options: parameters: author: '' catch_exceptions: 'True' category: '[GRC Hier Blocks]' cmake_opt: '' comment: '' copyright: '' description: '' gen_cmake: 'On' gen_linking: dynamic generate_options: qt_gui hier_block_src_path: '.:' id: fsf max_nouts: '0' output_language: python placement: (0,0) qt_qss_theme: '' realtime_scheduling: '' run: 'True' run_command: '{python} -u {filename}' run_options: prompt sizing_mode: fixed thread_safe_setters: '' title: Not titled yet window_size: (1000,1000) states: bus_sink: false bus_source: false bus_structure: null coordinate: [8, 8] rotation: 0 state: enabled

blocks:

connections:

metadata: file_format: 1 grc_version: 3.9.8.0

Additional Information

The console output of the gnuradio after this the program never returns an error or continues Executing: /usr/bin/python3 -u /home/test1/fsf.py

[INFO] [UHD] linux; GNU C++ version 9.4.0; Boost_107100; UHD_4.4.0.x411-0-f2901c62 [INFO] [MPMD] Initializing 1 device(s) in parallel with args: mgmt_addr=192.168.0.2,type=x4xx,product=x411,serial=2032374,name=pk-x4xx-2032374,fpga=X4_200,claimed=False,addr=192.168.0.2,master_clock_rate=245.76e6 [WARNING] [MPM.RPCServer] A timeout event occured! [INFO] [MPM.PeriphManager] init() called with device args `fpga=X4_200,master_clock_rate=245.76e6,mgmt_addr=192.168.0.2,name=pk-x4xx-2032374,product=x411,clock_source=mboard,time_source=internal'.

ptrkrysik commented 1 year ago

Source of this problem is that ZCU111 doesn't have internal PPS and 10MHz Ref generator. I don't have any simple/clever hack to solve this hardware related issue.

However I've implemented an option to attach external PPS and 10MHz Ref signals (c12cdf409e5). GPSDO also can be connected externally (ad3f78290bbb). I'm using GPSDO taken from USRP N2x0 that is connected through USB-RS232 adapter at the moment.

Currently 10MHz ref input is on adcio8 (N) and adcio9 (P) (I'm using balun to connect non-symetric 10MHz ref source to this input) and PPS input is on AMS_FPGA_REF_CLK SMA connector (for safety I'm using 3dB attenuator on this input). (c12cdf409e5)

At the same time 10MHz ref should be connected to input of LMK04208 clock generator's input (J109). You need a way to split 10MHz signal source to two inputs. For testing simple SMA Tee worked fine.

Without additional hardware I just removed PPS synchronization from the software that took it for granted (like srsLTE).

jevkri commented 1 year ago

Thanks. I thought it will be an issue. Thanks for all the workarounds provided. I did remove the PPS checks in 5G OAI for example for the same reason.

BTW about possible hacks. I see that sample timestamping still works, like in OAI Idk if PPS can be derived from this.

ArthFink commented 9 months ago

I'm currently facing similar issues with OAI and the x411. Did you manage to resolve the issue without an external PPS and Clock source?

@jevkri

ptrkrysik commented 9 months ago

I have two solutions. One is to change the source code of the program so it doesn't require PPS and external clock.

Another is to add PPS and 10MHz input from Octoclock of GPSDO. The second solution requires addition of a balun connected to ADCIO inputs in order to connect 10MHz signal to FPGA. 10MHz also has to be connected to LMK04208 input. PPS can be connected to one of SMA inputs.

I described this in one of commit messages as far as I remember.

jevkri commented 9 months ago

I'm currently facing similar issues with OAI and the x411. Did you manage to resolve the issue without an external PPS and Clock source?

@jevkri

Hi, basically the solution is to edit usrp_lib.cpp in OAI source and remove several commands, which wait for the pps signal.

https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/radio/USRP/usrp_lib.cpp?ref_type=heads#L198 remove s->usrp->set_time_next_pps(gps_time+1.0, mboard); add s->usrp->set_time_now(gps_time+1.0, mboard);

https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/radio/USRP/usrp_lib.cpp?ref_type=heads#L222 remove this while loop

https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/radio/USRP/usrp_lib.cpp?ref_type=heads#L336 remove this while loop

Editing these lines will allow the OAI code to proceed. There might be still some error remaining, but I can't remember now. Cheers!

ArthFink commented 9 months ago

Thanks for the quick response