Saturday, July 23, 2022

Re: rx_time

On 2022-07-23 16:53, Daniel R. Marlow wrote:
> Hello,
>
> I am having trouble understanding the 'rx_time' field in the gnuradio metadata. In particular, if I use the following code to unpack the metadata:
>
> self.handle = open(filename, "rb")
> header_str = self.handle.read(parse_file_metadata.HEADER_LENGTH)
> header = pmt.deserialize_str(header_str)
> info = parse_file_metadata.parse_header(header, False)
> print("info[rx_time]={0}".format(info['rx_time']))
>
> The print statement gives:
> info[rx_time]=6634431378.28
>
> I was expecting a time in seconds past the epoch (something in the neighborhood of 1658609226).
>
> Any information on what I am doing wrong would be most appreciated.
>
> Details: B210 with GPS module, Gnuradio 3.7.9, Ubuntu 16.04
>
> Sincerely,
> Dan Marlow
>
>
>
>
> I am using a B210 board with a GPS module.
>
How are you setting the time on the USRP B210?

I have a manually-inserted code snipped, included below that I've used
in the past to set the timestamp clock from the GPS time on a B210:

def lock_to_gps(uhd_src):
    while(not uhd_src.get_mboard_sensor("gps_locked").to_bool()):
        time.sleep(0.1)
    time.sleep(0.2)
    while(not uhd_src.get_mboard_sensor("ref_locked").to_bool()):
        time.sleep(0.1)
    time.sleep(0.2)

    # Spin, waiting for PPS transition
    t = uhd_src.get_time_last_pps()
    while (t == uhd_src.get_time_last_pps()):
        time.sleep(0.05)
    #Set the time from the GPS time
    gps_time = uhd_src.get_mboard_sensor("gps_time").to_int()
    uhd_src.set_time_next_pps(uhd.time_spec(gps_time+1))
    #This sleep is recomended to stabilize the clocks
    time.sleep(1.5)

No comments:

Post a Comment