Hi, This seems to be a bug in Capturing timed samples.. Can anyone
suggest ways around this?
Im thinking of adding another 'set-time' before subsequent stream_cmds
, or maybe theres something else I can put in a stream cmd? can the
meta-data structure sent to recv() do anything useful to resolve?
Ive already tried different buffer sizes, rates. its really unusual.
Read below for the details.. THanks for any thoughts!. Dave M.
Since my project code is similar, To explain the BUG, Ive modified
ETTUS example code "rx_timed_samples", to
- SYnc with an external 1PPS
- retrieve and display the USRP time at start and during capture, from
both time-now and time_last_pps functions
Setup: SIngle B210, Ubuntu 18.04, UHD_4.0.0.0-804-gb2527716
, PPS via extern SMA port.( NOTE this is NOT the GPSDO, which is not
populated )
Outcome:
- GOOD: With only one B210 channel capturing, the USRP stays aligned
with 1PPS
- BAD: With both B210 channels capturing, the USRP always time-shifts
from 1PPS after first buffer-fill
________________________________
The essential additions to example code outputs are
t_now=usrp->get_time_now();
t_tmp=usrp->get_time_last_pps();
printf("Actual time:now %8.5f
:AtPPS:%8.5f\n",t_now.get_real_secs(),t_tmp.get_real_secs());
Here's my code output..capture at 5MSPS, 10 secs into future.
WORKS WITH ONE CHANNEL (9.99999 is same at 10.0)
./rx_timed_samples --channels "0" --nsamps 20000 --rate 5000000 --secs
10 --sync pps
Begin streaming 20000 samples, 10.000000 seconds in the future...
Actual time:now 1.00254 :AtPPS: 1.00000. Commence wait.
Actual time:now 10.00083 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.000008 frac secs
Actual time:now 10.00130 :AtPPS: 9.99999
FAILS WITH TWO CHANNELS
./rx_timed_samples --channels "0,1" --nsamps 20000 --rate 5000000
--secs 10 --sync pps
Begin streaming 20000 samples, 10.000000 seconds in the future...
Actual time:now 2.74539 :AtPPS: 2.00000. Commence wait.
Actual time:now 10.00092 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.000010 frac secs
Actual time:now 10.00166 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.000418 frac secs
Actual time:now 10.00202 :AtPPS: 9.27090
Heres the full output...
someone@breakfast:~/uhd/host/build/examples$ ./rx_timed_samples
--channels "0" --nsamps 20000 --rate 5000000 --secs 10 --sync pps
Creating the usrp device with: ...
[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501;
UHD_4.0.0.0-804-gb2527716
<...snip initialization stuff...>
Setting RX Rate: 5.000000 Msps...
[INFO] [B200] Asking for clock rate 40.000000 MHz...
[INFO] [B200] Actually got clock rate 40.000000 MHz.
Actual RX Rate: 5.000000 Msps...
Setting device timestamp to 0...
[INFO] [MULTI_USRP] 1) catch time transition at pps edge
[INFO] [MULTI_USRP] 2) set times next pps (synchronously)
Begin streaming 20000 samples, 10.000000 seconds in the future...
Actual time:now 1.00254 :AtPPS: 1.00000. Commence wait.
Actual time:now 10.00083 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.000008 frac secs
Actual time:now 10.00130 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.000416 frac secs
Actual time:now 10.00164 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.000824 frac secs
Actual time:now 10.00198 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.001232 frac secs
Actual time:now 10.00231 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.001640 frac secs
Actual time:now 10.00269 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.002048 frac secs
Actual time:now 10.00308 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.002456 frac secs
Actual time:now 10.00349 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.002864 frac secs
Actual time:now 10.00391 :AtPPS: 9.99999
Received packet: 2040 samples, 10 full secs, 0.003272 frac secs
Actual time:now 10.00425 :AtPPS: 9.99999
Received packet: 1640 samples, 10 full secs, 0.003680 frac secs
Done!
______________________________________
BAD:
someone@breakfast:~/uhd/host/build/examples$ ./rx_timed_samples
--channels "0,1" --nsamps 20000 --rate 5000000 --secs 10 --sync pps
<...snip initialization stuff...>
Setting RX Rate: 5.000000 Msps...
[INFO] [B200] Asking for clock rate 40.000000 MHz...
[INFO] [B200] Actually got clock rate 40.000000 MHz.
Actual RX Rate: 5.000000 Msps...
Setting device timestamp to 0...
[INFO] [MULTI_USRP] 1) catch time transition at pps edge
[INFO] [MULTI_USRP] 2) set times next pps (synchronously)
[INFO] [B200] Asking for clock rate 20.000000 MHz...
[INFO] [B200] Actually got clock rate 20.000000 MHz.
Begin streaming 20000 samples, 10.000000 seconds in the future...
Actual time:now 2.74539 :AtPPS: 2.00000. Commence wait.
Actual time:now 10.00092 :AtPPS: 9.27090 <<<<<<<<<<<<< THIS SHOULD BE
10.0 !!!!
Received packet: 2040 samples, 10 full secs, 0.000010 frac secs
Actual time:now 10.00166 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.000418 frac secs
Actual time:now 10.00202 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.000826 frac secs
Actual time:now 10.00236 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.001234 frac secs
Actual time:now 10.00269 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.001642 frac secs
Actual time:now 10.00301 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.002050 frac secs
Actual time:now 10.00331 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.002458 frac secs
Actual time:now 10.00365 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.002866 frac secs
Actual time:now 10.00398 :AtPPS: 9.27090
Received packet: 2040 samples, 10 full secs, 0.003274 frac secs
Actual time:now 10.00430 :AtPPS: 9.27090
Received packet: 1640 samples, 10 full secs, 0.003682 frac secs
Done!