I want to make sure my multiple USRPs are streaming inputs synchronously with constant and fixed phase offsets. This is the extension to my: previous question -- the occurrence of constant and fixed phase shift within a USRP and constant but random phase shift between USRPs for each run even using Octoclock. Thus far my solution is to manually measure it in GRC and then compensate for it post-processing the data. It works fine, but I want to make my life easier.
I went through some referred links and NI does have an instruction for doing so using UHD commands:NI Examples: Synchronizing USRP Events Using Timed Commands in UHDext, and I know in GNU-radio's generated python script these UHD commands are imported.
Update: After looking at the documents again and testing with uhd time commands in gnu-radio-generated python scripts, if I understand the mechanism correctly, the phase offset between each daughter board would have to be calibrated. My goal now is to make sure that there will be a constant and fix phase offset across different X310 devices every time I run the script. The following part from ettus, which teaches how to set up synchronous streaming is (suspected) to achieve the goal:
The final step in configuring our system is to set up synchronous streaming from both radios. For this example, we'll set up synchronous Rx streaming using the following code:
// create a receive streamer
uhd::stream_args_t stream_args("fc32", wire); // complex floats
stream_args.channels = "0,1,2,3";
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
// setup streaming
uhd::stream_cmd_t
stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
stream_cmd.stream_now = false;
stream_cmd.time_spec = uhd::time_spec_t(usrp->get_time_now() +
uhd::time_spec_t(1.0));
rx_stream->issue_stream_cmd(stream_cmd);
Our system will begin to stream data 1s after the time returned by usrp->get_time_now().
I am not sure how should I write the C++ above into the python script that the gnu-radio is generated, or is there a better way to create synchronous streaming? I have been referring to gnu-radio UHD documentation but it is pretty difficult to understand how to use the stream cmd.