Hi Robert,

Here is a patch to gr-ettus that adds loopback support and an example
flowgraph. You can apply it using "git am". This may not be what the final
result will look like when merged into gr-ettus, so consider this a
temporary solution.

Jonathon

On Wed, Feb 24, 2021 at 4:14 PM Robert Wilson via USRP-users <
[email protected]> wrote:

> Hello,
>
> OS: Linux Ubuntu 20.04
> GRC: 3.8
> UHD: 4.0
> USRP: X310 with two UBX-160 daughterboards
>
> Attempting to receive and repeat a spectrum with low latency without using
> RX/TX streamers with RFNoC in GnuRadio.
> Currently using the default x310 image core.
> Steps I have taken to do this:
> Shown that I can receive correct signal with a RX-Radio RFNoC Block ->DDC
> RFNoC->Rx Streamer.
> Also shown that I can transmit correct signal via TX Streamer-.>DUC
> RFNoC->TX-Radio RFNoC Block.
> However, when attempting  RX-Radio RFNoC Block ->DDC RFNoC-> DUC
> RFNoC->TX-Radio RFNoC Block, there is no signal output and no TX/RX RX2
> link lights.
> Changing the Block Instances to match the existing default x310 image core
> Static connections made the flow graph run, but again with no lights or
> output.
>
> I found (through this mailing list) relevant material on this, the "Stupid
> RFNoC Tricks: Loopback"  in removing timestamps on received signals.
> https://corvid.io/2017/04/22/stupid-rfnoc-tricks-loopback/
>
> But, the current UHD build does not have the same filesystem or files
> (from what I can tell).
>
> Looking for guidance or reference in order to build this repeater.
>
> Robert
>
>
>
> _______________________________________________
> USRP-users mailing list
> [email protected]
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
From 477e7ddaf1d4cef86f707beaa76c1ae13ddf9ffe Mon Sep 17 00:00:00 2001
From: Jonathon Pendlum <[email protected]>
Date: Sun, 18 Oct 2020 21:56:50 -0400
Subject: [PATCH 1/2] grc: Fix DUC parameters

---
 grc/ettus_rfnoc_duc.block.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/grc/ettus_rfnoc_duc.block.yml b/grc/ettus_rfnoc_duc.block.yml
index 5383902..bf96a5b 100644
--- a/grc/ettus_rfnoc_duc.block.yml
+++ b/grc/ettus_rfnoc_duc.block.yml
@@ -8,7 +8,6 @@ templates:
   make: |-
     ettus.rfnoc_duc(
         self.rfnoc_graph,
-        ${num_chans},
         uhd.device_addr(${block_args}),
         ${device_select},
         ${instance_index})
-- 
2.25.1


From b0011df686835c6be608742a82fd99e59e8e25b5 Mon Sep 17 00:00:00 2001
From: Jonathon Pendlum <[email protected]>
Date: Sun, 18 Oct 2020 22:05:28 -0400
Subject: [PATCH 2/2] rfnoc: Add RX->TX loopback support and example flowgraph

---
 examples/rfnoc/rfnoc_rxtx_loopback.grc | 301 +++++++++++++++++++++++++
 grc/ettus_rfnoc_graph.block.yml        |   6 +
 grc/rfnoc.domain.yml                   |   2 +-
 include/ettus/rfnoc_rx_radio.h         |   6 +
 lib/rfnoc_graph_impl.cc                |   3 +-
 lib/rfnoc_rx_radio_impl.cc             |  15 ++
 lib/rfnoc_rx_radio_impl.h              |   3 +
 7 files changed, 334 insertions(+), 2 deletions(-)
 create mode 100644 examples/rfnoc/rfnoc_rxtx_loopback.grc

diff --git a/examples/rfnoc/rfnoc_rxtx_loopback.grc b/examples/rfnoc/rfnoc_rxtx_loopback.grc
new file mode 100644
index 0000000..5f60746
--- /dev/null
+++ b/examples/rfnoc/rfnoc_rxtx_loopback.grc
@@ -0,0 +1,301 @@
+options:
+  parameters:
+    author: ''
+    category: '[GRC Hier Blocks]'
+    cmake_opt: ''
+    comment: ''
+    copyright: ''
+    description: ''
+    gen_cmake: 'On'
+    gen_linking: dynamic
+    generate_options: qt_gui
+    hier_block_src_path: '.:'
+    id: rfnoc_rxtx_loopback
+    max_nouts: '0'
+    output_language: python
+    placement: (0,0)
+    qt_qss_theme: ''
+    realtime_scheduling: ''
+    run: 'True'
+    run_command: '{python} -u {filename}'
+    run_options: prompt
+    sizing_mode: fixed
+    thread_safe_setters: ''
+    title: RFNoC RX->TX Loopback
+    window_size: ''
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [8, 8]
+    rotation: 0
+    state: enabled
+
+blocks:
+- name: ettus_rfnoc_graph
+  id: ettus_rfnoc_graph
+  parameters:
+    alias: ''
+    clock_source_0: ''
+    clock_source_1: ''
+    clock_source_2: ''
+    clock_source_3: ''
+    clock_source_4: ''
+    clock_source_5: ''
+    clock_source_6: ''
+    clock_source_7: ''
+    comment: 'For loopback, skip propagation
+
+      must be set to True'
+    dev_addr: ''
+    dev_args: ''
+    num_mboards: '1'
+    skip_propagation: 'True'
+    time_source_0: ''
+    time_source_1: ''
+    time_source_2: ''
+    time_source_3: ''
+    time_source_4: ''
+    time_source_5: ''
+    time_source_6: ''
+    time_source_7: ''
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [242, 8]
+    rotation: 0
+    state: true
+- name: rx_freq
+  id: variable_qtgui_range
+  parameters:
+    comment: ''
+    gui_hint: ''
+    label: RX Frequency (Hz)
+    min_len: '200'
+    orient: Qt.Horizontal
+    rangeType: float
+    start: 10e6
+    step: 1e6
+    stop: 6e9
+    value: 2.45e9
+    widget: counter_slider
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [773, 9]
+    rotation: 0
+    state: true
+- name: rx_gain
+  id: variable_qtgui_range
+  parameters:
+    comment: ''
+    gui_hint: ''
+    label: RX Gain (dB)
+    min_len: '200'
+    orient: Qt.Horizontal
+    rangeType: float
+    start: '0'
+    step: '1'
+    stop: '32'
+    value: '0'
+    widget: counter_slider
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [473, 9]
+    rotation: 0
+    state: true
+- name: samp_rate
+  id: variable_qtgui_entry
+  parameters:
+    comment: ''
+    gui_hint: ''
+    label: Sampling Rate (Hz)
+    type: real
+    value: 1e6
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [239, 139]
+    rotation: 0
+    state: true
+- name: tx_freq
+  id: variable_qtgui_range
+  parameters:
+    comment: ''
+    gui_hint: ''
+    label: TX Frequency (Hz)
+    min_len: '200'
+    orient: Qt.Horizontal
+    rangeType: float
+    start: 10e6
+    step: 1e6
+    stop: 6e9
+    value: 2.45e9
+    widget: counter_slider
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [956, 10]
+    rotation: 0
+    state: true
+- name: tx_gain
+  id: variable_qtgui_range
+  parameters:
+    comment: ''
+    gui_hint: ''
+    label: TX Gain (dB)
+    min_len: '200'
+    orient: Qt.Horizontal
+    rangeType: float
+    start: '0'
+    step: '1'
+    stop: '32'
+    value: '0'
+    widget: counter_slider
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [624, 9]
+    rotation: 0
+    state: true
+- name: ettus_rfnoc_ddc_0
+  id: ettus_rfnoc_ddc
+  parameters:
+    affinity: ''
+    alias: ''
+    block_args: ''
+    comment: ''
+    device_select: '-1'
+    freq: '0'
+    instance_index: '0'
+    maxoutbuf: '0'
+    minoutbuf: '0'
+    num_chans: '1'
+    output_rate: samp_rate
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [357, 362]
+    rotation: 0
+    state: enabled
+- name: ettus_rfnoc_duc_0
+  id: ettus_rfnoc_duc
+  parameters:
+    affinity: ''
+    alias: ''
+    block_args: ''
+    comment: ''
+    device_select: '-1'
+    freq: '0'
+    input_rate: samp_rate
+    instance_index: '0'
+    maxoutbuf: '0'
+    minoutbuf: '0'
+    num_chans: '1'
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [745, 362]
+    rotation: 0
+    state: enabled
+- name: ettus_rfnoc_rx_radio_0
+  id: ettus_rfnoc_rx_radio
+  parameters:
+    affinity: ''
+    agc: Default
+    alias: ''
+    antenna: RX2
+    bandwidth: '0'
+    block_args: ''
+    comment: ''
+    dc_offset: 'False'
+    device_select: '-1'
+    frequency: rx_freq
+    gain: rx_gain
+    instance_index: '0'
+    iq_balance: 'False'
+    maxoutbuf: '0'
+    minoutbuf: '0'
+    num_chans: '1'
+    rate: samp_rate
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [13, 306]
+    rotation: 0
+    state: true
+- name: ettus_rfnoc_tx_radio_0
+  id: ettus_rfnoc_tx_radio
+  parameters:
+    affinity: ''
+    agc: Default
+    alias: ''
+    antenna: TX/RX
+    bandwidth: '0'
+    block_args: ''
+    comment: ''
+    device_select: '-1'
+    frequency: tx_freq
+    gain: tx_gain
+    instance_index: '0'
+    num_chans: '1'
+    rate: samp_rate
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [1153, 326]
+    rotation: 0
+    state: true
+- name: snippet_0
+  id: snippet
+  parameters:
+    alias: ''
+    code: 'self.ettus_rfnoc_rx_radio_0.enable_rx_timestamps(False, 0)
+
+      self.ettus_rfnoc_rx_radio_0.start_stream(0)'
+    comment: Disable timestamps and start streaming after flowgraph initialization
+    priority: ''
+    section: main_after_init
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [1176, 13]
+    rotation: 0
+    state: true
+- name: snippet_1
+  id: snippet
+  parameters:
+    alias: ''
+    code: 'self.ettus_rfnoc_rx_radio_0.stop_stream(0)
+
+      self.ettus_rfnoc_rx_radio_0.enable_rx_timestamps(True, 0)'
+    comment: Stop streaming and re-enable timestamps when flowgraph is stopped
+    priority: ''
+    section: main_after_stop
+  states:
+    bus_sink: false
+    bus_source: false
+    bus_structure: null
+    coordinate: [1178, 111]
+    rotation: 0
+    state: true
+
+connections:
+- [ettus_rfnoc_ddc_0, '0', ettus_rfnoc_duc_0, '0']
+- [ettus_rfnoc_duc_0, '0', ettus_rfnoc_tx_radio_0, '0']
+- [ettus_rfnoc_rx_radio_0, '0', ettus_rfnoc_ddc_0, '0']
+
+metadata:
+  file_format: 1
diff --git a/grc/ettus_rfnoc_graph.block.yml b/grc/ettus_rfnoc_graph.block.yml
index 3c0b1a6..ca5822f 100644
--- a/grc/ettus_rfnoc_graph.block.yml
+++ b/grc/ettus_rfnoc_graph.block.yml
@@ -8,6 +8,7 @@ templates:
       from gnuradio import uhd
   var_make: |
       self.rfnoc_graph = ${id} = ettus.rfnoc_graph(uhd.device_addr(",".join((${dev_addr}, ${dev_args}))))
+      self.rfnoc_graph.skip_propagation = ${skip_propagation}
 
 value: ${ 'RFNoC Graph' }
 
@@ -28,6 +29,11 @@ parameters:
   default: 1
   options: [1, 2, 3, 4, 5, 6, 7, 8]
   hide: part
+- id: skip_propagation
+  label: Skip Propagation
+  dtype: bool
+  default: False
+  options: [True, False]
 - id: clock_source_0
   label: 'Mb0: Clock Source'
   dtype: string
diff --git a/grc/rfnoc.domain.yml b/grc/rfnoc.domain.yml
index 5760864..68dcbff 100644
--- a/grc/rfnoc.domain.yml
+++ b/grc/rfnoc.domain.yml
@@ -7,4 +7,4 @@ multiple_connections_per_output: false
 
 templates:
 -   type: [rfnoc, rfnoc]
-    connect: self.rfnoc_graph.connect(self.${ source.parent_block.name }.get_unique_id(), ${ source.key }, self.${ sink.parent_block.name }.get_unique_id(), ${ sink.key }, False)
+    connect: self.rfnoc_graph.connect(self.${ source.parent_block.name }.get_unique_id(), ${ source.key }, self.${ sink.parent_block.name }.get_unique_id(), ${ sink.key }, self.rfnoc_graph.skip_propagation)
\ No newline at end of file
diff --git a/include/ettus/rfnoc_rx_radio.h b/include/ettus/rfnoc_rx_radio.h
index eb9645e..9346b1d 100644
--- a/include/ettus/rfnoc_rx_radio.h
+++ b/include/ettus/rfnoc_rx_radio.h
@@ -53,6 +53,12 @@ public:
                      const int device_select,
                      const int instance);
 
+    virtual void start_stream(const size_t chan) = 0;
+
+    virtual void stop_stream(const size_t chan) = 0;
+
+    virtual void enable_rx_timestamps(const bool enable, const size_t chan) = 0;
+
     //! Set the output sampling rate of the radio block
     //
     // Note: The actual rate of the radio will be coerced to whatever it is
diff --git a/lib/rfnoc_graph_impl.cc b/lib/rfnoc_graph_impl.cc
index c638ba2..192e52c 100644
--- a/lib/rfnoc_graph_impl.cc
+++ b/lib/rfnoc_graph_impl.cc
@@ -74,7 +74,8 @@ public:
         _graph->connect(block_id_t(src_block_id),
                         src_block_port,
                         block_id_t(dst_block_id),
-                        dst_block_port);
+                        dst_block_port,
+                        skip_property_propagation);
     }
 
     void connect(const std::string& block1,
diff --git a/lib/rfnoc_rx_radio_impl.cc b/lib/rfnoc_rx_radio_impl.cc
index 1c3e463..211281b 100644
--- a/lib/rfnoc_rx_radio_impl.cc
+++ b/lib/rfnoc_rx_radio_impl.cc
@@ -51,6 +51,21 @@ rfnoc_rx_radio_impl::~rfnoc_rx_radio_impl() {}
 /******************************************************************************
  * rfnoc_rx_radio API
  *****************************************************************************/
+void rfnoc_rx_radio_impl::start_stream(const size_t chan)
+{
+    return d_radio_ref->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS, chan);
+}
+
+void rfnoc_rx_radio_impl::stop_stream(const size_t chan)
+{
+    return d_radio_ref->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS, chan);
+}
+
+void rfnoc_rx_radio_impl::enable_rx_timestamps(const bool enable, const size_t chan)
+{
+    return d_radio_ref->enable_rx_timestamps(enable, chan);
+}
+
 double rfnoc_rx_radio_impl::set_rate(const double rate)
 {
     return d_radio_ref->set_rate(rate);
diff --git a/lib/rfnoc_rx_radio_impl.h b/lib/rfnoc_rx_radio_impl.h
index 417a953..cf53ec2 100644
--- a/lib/rfnoc_rx_radio_impl.h
+++ b/lib/rfnoc_rx_radio_impl.h
@@ -35,6 +35,9 @@ public:
     ~rfnoc_rx_radio_impl();
 
     /*** API *****************************************************************/
+    void start_stream(const size_t chan);
+    void stop_stream(const size_t chan);
+    void enable_rx_timestamps(const bool enable, const size_t chan);
     double set_rate(const double rate);
     void set_antenna(const std::string& antenna, const size_t chan);
     double set_frequency(const double frequency, const size_t chan);
-- 
2.25.1

_______________________________________________
USRP-users mailing list
[email protected]
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to