Thank you Marcus for the feedback. Indeed I realized just after sending the
post that I had omitted to use the external 10 MHz reference for clocking the
FPGA. Although I had suspicions on the result, I have waited to return to the
lab and run the experiment again with the correct settings before replying.

> Looking at the script, it looks like you've set the *time* source to 
> "external",  but are still relying on the internal
>    clock for the actual reference clock that is used to drive everything 
> internally--including the ADCs, FPGA
>    DSP bits, etc.

Corrected now, although I believe for the short measurement duration (3 seconds
for each run) the TCXO should be close enough to the White Rabbit grand master
reference to drift by a few samples at most (a 1 ppm frequency fluctuation 
would 
lead to 3 us fluctuation after 3 s at most, or 15 samples at the end of the 
record
or 5 samples after 1 s when timestamping the first 1-PPS rising edge).

> The "1PPS" on USRPs is used ONLY as a 1-time synchronization point for 
> resetting the timestamp clocks to a known value
>    *at a known time* (the 1PPS pulse).   That timestamp register "ticks 
> over" based on either the internal reference clock,
>    or an external one, but you haven't requested external reference clock.

As I understand using the internal reference instead of the external means I 
loose
the alignement of the 1PPS edge with the clock driving the FPGA and hence might
be off by +/-1 sample or +/-200 ns when sampling at 5 MS/s. Here I observe again
4 ms fluctuations of the 1PPS edge detection (bottom chart) overnight, the full 
experiment duration being 11 hours here.
Another thing I fail to understand is that when I look at the timestamp (stat 
-c %y) of 
the file last access time (top chart) I do get the sawtooth shape of the timer 
control by 
NTP and I do get the sawtooth amplitude as inverse of the linux kernel timer 
rate so I'd 
say that the record starts at the right time with respect to the 1-PPS rising 
edge (otherwise
the file timestamp would be randomly distributed, which is not the case, see 
inset)
but I fail to understand how the 1PPS edge detection in the IQ stream (bottom 
chart) can 
fluctuate so much if the IQ file last storage time is consistent.

Thanks.


_______________________________________________
USRP-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
# Title: cm4_x310
# GNU Radio version: 3.10.5.1

from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
from gnuradio.fft import window
import sys
import signal
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
from gnuradio import eng_notation
from gnuradio import uhd
import time




class cm4_x310(gr.top_block):

    def __init__(self):
        gr.top_block.__init__(self, "cm4_x310", catch_exceptions=True)

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 5e6

        ##################################################
        # Blocks
        ##################################################

        self.uhd_usrp_source_1 = uhd.usrp_source(
            ",".join(("", '')),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=list(range(0,2)),
            ),
        )
        self.uhd_usrp_source_1.set_clock_source('external', 0)
        self.uhd_usrp_source_1.set_time_source('external', 0)
        self.uhd_usrp_source_1.set_subdev_spec('A:0 B:0', 0)
        self.uhd_usrp_source_1.set_samp_rate(samp_rate)
        self.uhd_usrp_source_1.set_time_unknown_pps(uhd.time_spec(0))

        self.uhd_usrp_source_1.set_center_freq(0, 0)
        self.uhd_usrp_source_1.set_gain(0, 0)

        self.uhd_usrp_source_1.set_center_freq(0, 1)
        self.uhd_usrp_source_1.set_gain(0, 1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_gr_complex*1, 1)
        self.blocks_head_0 = blocks.head(gr.sizeof_gr_complex*1, 
(int(6*samp_rate)))
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, 
'/tmp/data.bin', False)
        self.blocks_file_sink_0.set_unbuffered(False)


        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_head_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_interleave_0, 0), (self.blocks_head_0, 0))
        self.connect((self.uhd_usrp_source_1, 1), (self.blocks_interleave_0, 1))
        self.connect((self.uhd_usrp_source_1, 0), (self.blocks_interleave_0, 0))


    def get_samp_rate(self):
        return self.samp_rate

    def set_samp_rate(self, samp_rate):
        self.samp_rate = samp_rate
        self.blocks_head_0.set_length((int(6*self.samp_rate)))
        self.uhd_usrp_source_1.set_samp_rate(self.samp_rate)




def main(top_block_cls=cm4_x310, options=None):
    tb = top_block_cls()

    def sig_handler(sig=None, frame=None):
        tb.stop()
        tb.wait()

        sys.exit(0)

    signal.signal(signal.SIGINT, sig_handler)
    signal.signal(signal.SIGTERM, sig_handler)

    tb.start()

    tb.wait()


if __name__ == '__main__':
    main()

Attachment: 230720.pdf
Description: Adobe PDF document

_______________________________________________
USRP-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to