discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tag offset question


From: Jeff Long
Subject: Re: tag offset question
Date: Mon, 17 May 2021 11:33:34 -0400

It is possible that one of the blocks in the middle of your flowgraph is not handling the tags properly. What is between the sender and receiver?

On Mon, May 17, 2021 at 11:17 AM Jeff Long <willcode4@gmail.com> wrote:
When there is a rate change, tag offsets are adjusted to match. Otherwise, the tag spacing should stay the same, taking into account that the tags may end up in different calls to work().

On Mon, May 17, 2021 at 11:07 AM jmfriedt <jean-michel.friedt@femto-st.fr> wrote:
I am trying to get an accurate timing of a given sample (1-PPS
transition). To do so, a marker is injected in the AD9831 datastream in
the B210 FPGA. When this tag is detected in the UHD source block, a tag
is created in the stream:

    for (item=0;item<noutput_items;item++)  // check all samples
       {if (ch==0)                          // check if channel 0
          {if (in[item]==_tag_pps_int)      // check marker detection
           {add_item_tag(0,                 // Port number
            nitems_written(0) + item,       // Offset
            pmt::string_to_symbol("1PPS"),  // Key
            pmt::from_double(3.14159));     // Value
 ...

Displaying the item number when the marker is detected, I get things
like 444331/524288 or 364347/524288 (item/noutput_items) which seems
realistic.

Downstream the flowchart, after many other processing blocks, I check
for the tag in the window of samples that were just transferred
  std::vector<gr::tag_t> PPS_tag;
  get_tags_in_window(PPS_tag,0,
         0,             // abs_start,
         noutput_items, // uint64_t abs_end);
         pmt::string_to_symbol("1PPS")) ;
  if (PPS_tag.size() != 0)
     { printf("\n** PPS_tag received: %ld (%ld/%d):
          message=%.9f",PPS_tag.size(), noutput_items,
          to_double(PPS_tag[0].value));
...
and there I *always get* PPS_tag.offset=1.

If on the emitter side I create two tags separated by 42 i.e.
add_item_tag(0,               
            nitems_written(0) + item,       
            pmt::string_to_symbol("1PPS"), 
            pmt::from_double(3.14159));
add_item_tag(0,               
            nitems_written(0) + item + 42,   
            pmt::string_to_symbol("1PPS"),
            pmt::from_double(3.14159));
then the receiver indeed detects PPS_tag.size() = 2 but still
both PPS_tag[0].offset and PPS_tag[1].offset are equal to 1 !
I am obviously misunderstanding the behviour of tag.offset: can anyone
enlighten me on how to identify the index of the sample carrying the
tag ?

Thanks, JM


reply via email to

[Prev in Thread] Current Thread [Next in Thread]