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