Closed RoelandOsaer closed 12 months ago
@RoelandOsaer You didn't specify the arguments you're using to call your scripts. I'm guessing you're not providing a master_clock_rate
argument.
Here's why that matters: If you don't provide a master_clock_rate
argument (MCR), then UHD will choose a master clock rate for you, dynamically. See the manual: https://uhd.readthedocs.io/en/latest/page_usrp_b200.html#b200_auto_mcr
The choice of MCR depends on two things: The sampling rate you want, and how many channels you are using. Because we don't know how many channels you need until you request a streamer, auto-MCR triggers very late in the game (in your script, when the TX streamer is created, but if you were to change the rate afterwards, then it would change the MCR again).
Because you are using 2 channels RX, and 1 channel TX, you will have different MCRs on both devices. UHD will even tell you in the logs (Actually got clock rate XXX MHz
). If your devices are running at different MCRs, then various minor differences in the clocking architecture will lead to different delays. The difference between your USRPs is in the ns range, so that seems reasonable.
Try running both scripts with master_clock_rate=16e6
.
FYI, I'll update the manual to reflect this (it's not obvious, I admit). I'll also close this. If you find that specifying the MCR does not help, please reopen.
Issue Description
When synchronizing multiple USRPs(b210) by using the
usrp->set_time_next_pps(uhd::time_spec_t(0.0));
waiting two seconds to be sure the next pps arrives so every USRPshas its internal timer set to 0 seconds. Afterward, a timed command is set to toggle the gpio pins high after a certain time. Without initilazing the TX streamer on the TX-USRPs the toggle on the gpio pins is done at the exact same time. When the TX streamer is initialized (done before the synchronization) there is a shift in the toggle of the gpio pins between different USRPs. The lines of code that we think are giving the issue are marked in the TX script.Setup Details
tested with UHD version 4.3 and 4.1.0.6 (same issue). Custom FPGA version where only the PPS comes outside on gpio pin 7.
code for RX and TX USRP are below.
Note: the USRPs are waiting for a synchronization signal from a server to start the synchronization on the next pps.
------------------------------------------------------------= script for RX USRP: ------------------------------------------------------------=
------------------------------------------------------------= script for TX USRP: ------------------------------------------------------------=
Expected Behavior
We expect that the initialization of the TX streamer does not have an influence on the timing of the timed commands.
Actual Behaviour
this screenshot comes from the UHD-4.3 with a rate setting of 20MHz
Steps to reproduce the problem
Run the RX and TX script on a separate USRP. Ensure that the PPS and the 10MHz signal are coming from an Octoclock. Run this server script so the USRPs know when to start sync. The server gives a sync message to the USRPs when three devices are connected.
connect a scope to one of the first four gpio pins on the B210 USRP.
------------= server script ------------=
Additional Information