diff --git a/examples/cdc_phy_bladeRF.grc b/examples/cdc_phy_bladeRF.grc new file mode 100644 index 0000000000000000000000000000000000000000..0dd7dd26fb4d9fd5e11c319b99818b9de21c89c1 --- /dev/null +++ b/examples/cdc_phy_bladeRF.grc @@ -0,0 +1,828 @@ +options: + parameters: + author: '' + catch_exceptions: 'True' + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: cdc_phy_test_bRF + 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: Not titled yet + window_size: (1000,1000) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 8] + rotation: 0 + state: enabled + +blocks: +- name: excess_bw + id: variable + parameters: + comment: '' + value: '0.35' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [256, 12.0] + rotation: 0 + state: enabled +- name: nbytes + id: variable + parameters: + comment: '' + value: '32' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [168, 188.0] + rotation: 0 + state: enabled +- name: rf_freq + id: variable + parameters: + comment: '' + value: 915e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [352, 12.0] + rotation: 0 + state: enabled +- name: rx_gain + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 0, 1, 1, 1 + label: Rx Gain (dB) + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '-24' + step: '1' + stop: '66' + value: '30' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [600, 116.0] + rotation: 0 + state: true +- name: samp_rate + id: variable + parameters: + comment: '' + value: 1e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [440, 12.0] + rotation: 0 + state: enabled +- name: sps + id: variable + parameters: + comment: '' + value: '2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 12] + rotation: 0 + state: enabled +- name: tx_gain + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: 0, 0, 1, 1 + label: Tx Gain (dB) + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '-24' + step: '1' + stop: '66' + value: '30' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [456, 116.0] + rotation: 0 + state: true +- name: bladeRF_sink_0 + id: bladeRF_sink + parameters: + affinity: '' + alias: '' + bias_tee0: 'False' + bias_tee1: 'False' + bw: samp_rate + comment: '' + dac: '10000' + dc_calibration: LPF_TUNING + device_id: '0' + fpga_image: '' + fpga_reload: 'False' + freq: rf_freq + gain0: tx_gain + gain1: '10' + if_gain0: '0' + if_gain1: '20' + in_clk: ONBOARD + lpf_mode: disabled + maxoutbuf: '0' + metadata: 'False' + minoutbuf: '0' + nchan: '1' + out_clk: 'False' + ref_clk: '38400000' + sample_rate: samp_rate + sampling: internal + show_pmic: 'False' + smb: '0' + tamer: internal + trigger0: 'False' + trigger1: 'False' + trigger_role0: master + trigger_role1: master + trigger_signal0: J51_1 + trigger_signal1: J51_1 + use_dac: 'False' + use_ref_clk: 'False' + verbosity: warning + xb200: none + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [456, 244.0] + rotation: 0 + state: enabled +- name: bladeRF_source_0 + id: bladeRF_source + parameters: + affinity: '' + alias: '' + bias_tee0: 'False' + bias_tee1: 'False' + bw: samp_rate + comment: '' + dac: '10000' + dc_calibration: LPF_TUNING + dc_offset_mode0: '2' + dc_offset_mode1: '0' + device_id: '0' + fpga_image: '' + fpga_reload: 'False' + freq: rf_freq + gain0: rx_gain + gain1: '10' + gain_mode0: 'False' + gain_mode1: 'False' + if_gain0: '0' + if_gain1: '20' + in_clk: ONBOARD + iq_balance_mode0: '2' + iq_balance_mode1: '0' + lpf_mode: disabled + maxoutbuf: '0' + metadata: 'False' + minoutbuf: '0' + nchan: '1' + out_clk: 'False' + ref_clk: '38400000' + sample_rate: samp_rate + sampling: internal + show_pmic: 'False' + smb: '0' + tamer: internal + trigger0: 'False' + trigger1: 'False' + trigger_role0: master + trigger_role1: master + trigger_signal0: J51_1 + trigger_signal1: J51_1 + use_dac: 'False' + use_ref_clk: 'False' + verbosity: warning + xb200: none + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [600, 244.0] + rotation: 0 + state: enabled +- name: blocks_message_debug_0 + id: blocks_message_debug + parameters: + affinity: '' + alias: '' + comment: '' + en_uvec: 'True' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [816, 168.0] + rotation: 180 + state: enabled +- name: blocks_message_strobe_0 + id: blocks_message_strobe + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + msg: pmt.cons(pmt.PMT_NIL, pmt.make_u8vector(nbytes, 0x00)) + period: '500' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [72, 252.0] + rotation: 180 + state: true +- name: blocks_uchar_to_float_0 + id: blocks_uchar_to_float + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1072, 424.0] + rotation: 0 + state: true +- name: cdc_insert_burst_c_0 + id: cdc_insert_burst_c + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [304, 328.0] + rotation: 0 + state: true +- name: phy_rx_0 + id: phy_rx + parameters: + affinity: '' + alias: '' + comment: '' + excess_bw: excess_bw + maxoutbuf: '0' + minoutbuf: '0' + sps: sps + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [808, 272.0] + rotation: 0 + state: true +- name: phy_tx_0 + id: phy_tx + parameters: + affinity: '' + alias: '' + comment: '' + excess_bw: excess_bw + maxoutbuf: '0' + minoutbuf: '0' + phasing: '20' + sps: sps + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [72, 324.0] + rotation: 0 + state: true +- name: qtgui_const_sink_x_0_0 + id: qtgui_const_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: '"blue"' + color10: '"red"' + color2: '"red"' + color3: '"red"' + color4: '"red"' + color5: '"red"' + color6: '"red"' + color7: '"red"' + color8: '"red"' + color9: '"red"' + comment: '' + grid: 'False' + gui_hint: 3, 0, 1, 1 + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '0' + marker10: '0' + marker2: '0' + marker3: '0' + marker4: '0' + marker5: '0' + marker6: '0' + marker7: '0' + marker8: '0' + marker9: '0' + name: '"Symbol Sync"' + nconnections: '1' + size: 64 + (4 + nbytes + 4)*8 + style1: '0' + style10: '0' + style2: '0' + style3: '0' + style4: '0' + style5: '0' + style6: '0' + style7: '0' + style8: '0' + style9: '0' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_TAG + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '"corr_est"' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + xmax: '2' + xmin: '-2' + ymax: '2' + ymin: '-2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1072, 228.0] + rotation: 0 + state: enabled +- name: qtgui_const_sink_x_0_0_0 + id: qtgui_const_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: '"blue"' + color10: '"red"' + color2: '"red"' + color3: '"red"' + color4: '"red"' + color5: '"red"' + color6: '"red"' + color7: '"red"' + color8: '"red"' + color9: '"red"' + comment: '' + grid: 'False' + gui_hint: 3, 1, 1, 1 + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + legend: 'True' + marker1: '0' + marker10: '0' + marker2: '0' + marker3: '0' + marker4: '0' + marker5: '0' + marker6: '0' + marker7: '0' + marker8: '0' + marker9: '0' + name: '"Costas Loop"' + nconnections: '1' + size: 64 + (4 + nbytes + 4)*8 + style1: '0' + style10: '0' + style2: '0' + style3: '0' + style4: '0' + style5: '0' + style6: '0' + style7: '0' + style8: '0' + style9: '0' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_TAG + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '"corr_est"' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + xmax: '2' + xmin: '-2' + ymax: '2' + ymin: '-2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1072, 316.0] + rotation: 0 + state: enabled +- name: qtgui_time_sink_x_0 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 2, 0, 1, 2 + label1: Signal 1 + label10: Signal 10 + label2: Signal 2 + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '"Preamble Correlation"' + nconnections: '1' + size: '256' + srate: '1' + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_TAG + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '"corr_est"' + type: float + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '1.5' + ymin: '0' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1072, 492.0] + rotation: 0 + state: enabled +- name: qtgui_time_sink_x_0_0 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 4, 0, 1, 2 + label1: Signal 1 + label10: Signal 10 + label2: Signal 2 + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '"Payload Bytes"' + nconnections: '1' + size: nbytes + 4 + srate: '1' + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_TAG + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '"packet_len"' + type: float + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '256' + ymin: '-1' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1232, 396.0] + rotation: 0 + state: enabled +- name: qtgui_time_sink_x_2 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'True' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 1, 0, 1, 2 + label1: Signal 1 + label10: Signal 10 + label2: Signal 2 + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '"AGC"' + nconnections: '1' + size: sps*(11 + 20 + 64 + (4 + nbytes +4)*8) + srate: samp_rate + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.01' + tr_mode: qtgui.TRIG_MODE_TAG + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '"corr_est"' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '1' + ymin: '-1' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [792, 468.0] + rotation: 180 + state: true + +connections: +- [bladeRF_source_0, '0', phy_rx_0, '0'] +- [blocks_message_strobe_0, strobe, phy_tx_0, sdu] +- [blocks_uchar_to_float_0, '0', qtgui_time_sink_x_0_0, '0'] +- [cdc_insert_burst_c_0, '0', bladeRF_sink_0, '0'] +- [phy_rx_0, '0', qtgui_const_sink_x_0_0, '0'] +- [phy_rx_0, '1', qtgui_const_sink_x_0_0_0, '0'] +- [phy_rx_0, '2', blocks_uchar_to_float_0, '0'] +- [phy_rx_0, '3', qtgui_time_sink_x_0, '0'] +- [phy_rx_0, '4', qtgui_time_sink_x_2, '0'] +- [phy_rx_0, pdu, blocks_message_debug_0, print] +- [phy_tx_0, burst, cdc_insert_burst_c_0, burst] + +metadata: + file_format: 1 diff --git a/examples/cdc_phy_loopback.grc b/examples/cdc_phy_loopback.grc index 756e3324b0bf2a7ec0f8e51c1039f6c220c02ec1..b28a3b74b450f37ea8b2db1627b8269571be0d6c 100644 --- a/examples/cdc_phy_loopback.grc +++ b/examples/cdc_phy_loopback.grc @@ -51,9 +51,9 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [288, 316.0] + coordinate: [536, 284.0] rotation: 0 - state: true + state: enabled - name: excess_bw id: variable parameters: @@ -66,6 +66,18 @@ blocks: coordinate: [256, 12.0] rotation: 0 state: enabled +- name: nbytes + id: variable + parameters: + comment: '' + value: '32' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [352, 12.0] + rotation: 0 + state: enabled - name: phase_rot id: variable_qtgui_range parameters: @@ -84,9 +96,21 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [400, 316.0] + coordinate: [648, 284.0] rotation: 0 - state: true + state: enabled +- name: samp_rate + id: variable + parameters: + comment: '' + value: '32000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [424, 12.0] + rotation: 0 + state: enabled - name: sps id: variable parameters: @@ -110,9 +134,9 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [856, 8.0] - rotation: 0 - state: true + coordinate: [880, 16.0] + rotation: 180 + state: enabled - name: blocks_message_strobe_1 id: blocks_message_strobe parameters: @@ -121,101 +145,131 @@ blocks: comment: '' maxoutbuf: '0' minoutbuf: '0' - msg: pmt.intern("TEST") + msg: pmt.cons(pmt.PMT_NIL, pmt.make_u8vector(nbytes, 0x00)) period: '500' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [352, 116.0] + coordinate: [80, 116.0] rotation: 180 state: true -- name: channels_channel_model_0 - id: channels_channel_model +- name: blocks_throttle_0 + id: blocks_throttle parameters: affinity: '' alias: '' - block_tags: 'False' comment: '' - epsilon: '1.001' - freq_offset: '0.0' + ignoretag: 'True' maxoutbuf: '0' minoutbuf: '0' - noise_voltage: '0.0' - seed: '0' - taps: np.exp(1j*phase_rot)*10**(amp_gain) + samples_per_second: samp_rate + type: complex + vlen: '1' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [304, 188.0] + coordinate: [464, 196.0] rotation: 0 - state: true -- name: import_0 - id: import + state: enabled +- name: blocks_uchar_to_float_0 + id: blocks_uchar_to_float parameters: + affinity: '' alias: '' comment: '' - imports: import numpy as np + maxoutbuf: '0' + minoutbuf: '0' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [288, 444.0] + coordinate: [1136, 272.0] rotation: 0 state: true -- name: pdu_random_pdu_0 - id: pdu_random_pdu +- name: cdc_insert_burst_c_0 + id: cdc_insert_burst_c parameters: affinity: '' alias: '' comment: '' - length_modulo: '2' - mask: '0xFF' maxoutbuf: '0' - maxsize: '64' minoutbuf: '0' - minsize: '64' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [80, 100.0] - rotation: 180 + coordinate: [312, 200.0] + rotation: 0 state: true +- name: channels_channel_model_0 + id: channels_channel_model + parameters: + affinity: '' + alias: '' + block_tags: 'False' + comment: '' + epsilon: '1.0' + freq_offset: '0.0' + maxoutbuf: '0' + minoutbuf: '0' + noise_voltage: '0.001' + seed: '0' + taps: np.exp(1j*phase_rot)*10**(amp_gain) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [632, 156.0] + rotation: 0 + state: enabled +- name: import_0 + id: import + parameters: + alias: '' + comment: '' + imports: import numpy as np + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [456, 284.0] + rotation: 0 + state: enabled - name: phy_rx_0 id: phy_rx parameters: affinity: '' alias: '' comment: '' - excess_bw: '0.350' + excess_bw: excess_bw maxoutbuf: '0' minoutbuf: '0' - sps: '2' + sps: sps states: bus_sink: false bus_source: false bus_structure: null - coordinate: [552, 152.0] + coordinate: [872, 120.0] rotation: 0 - state: true + state: enabled - name: phy_tx_0 id: phy_tx parameters: affinity: '' alias: '' comment: '' - excess_bw: '0.350' + excess_bw: excess_bw maxoutbuf: '0' minoutbuf: '0' phasing: '20' - sps: '2' + sps: sps states: bus_sink: false bus_source: false bus_structure: null - coordinate: [80, 232.0] + coordinate: [80, 196.0] rotation: 0 state: true - name: qtgui_const_sink_x_0 @@ -247,7 +301,7 @@ blocks: color9: '"red"' comment: '' grid: 'False' - gui_hint: '' + gui_hint: 2, 0, 1, 1 label1: '' label10: '' label2: '' @@ -271,7 +325,7 @@ blocks: marker9: '0' name: '"Symbol Sync"' nconnections: '1' - size: '256' + size: 64 + (4 + nbytes + 4)*8 style1: '0' style10: '0' style2: '0' @@ -307,7 +361,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [800, 116.0] + coordinate: [1136, 76.0] rotation: 0 state: enabled - name: qtgui_const_sink_x_0_0 @@ -339,7 +393,7 @@ blocks: color9: '"red"' comment: '' grid: 'False' - gui_hint: '' + gui_hint: 2, 1, 1, 1 label1: '' label10: '' label2: '' @@ -363,7 +417,7 @@ blocks: marker9: '0' name: '"Costas Loop"' nconnections: '1' - size: '256' + size: 64 + (4 + nbytes + 4)*8 style1: '0' style10: '0' style2: '0' @@ -399,7 +453,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [800, 196.0] + coordinate: [1136, 164.0] rotation: 0 state: enabled - name: qtgui_time_sink_x_0 @@ -433,7 +487,7 @@ blocks: ctrlpanel: 'False' entags: 'True' grid: 'False' - gui_hint: '' + gui_hint: 1, 0, 1, 2 label1: Signal 1 label10: Signal 10 label2: Signal 2 @@ -496,7 +550,104 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [832, 276.0] + coordinate: [1136, 348.0] + rotation: 0 + state: enabled +- name: qtgui_time_sink_x_0_0 + id: qtgui_time_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 3, 0, 1, 2 + label1: Signal 1 + label10: Signal 10 + label2: Signal 2 + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '"Payload Bytes"' + nconnections: '1' + size: nbytes + 4 + srate: '1' + stemplot: 'False' + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_TAG + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '"packet_len"' + type: float + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '256' + ymin: '-1' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1304, 244.0] rotation: 0 state: enabled - name: qtgui_time_sink_x_1 @@ -530,7 +681,7 @@ blocks: ctrlpanel: 'False' entags: 'True' grid: 'False' - gui_hint: '' + gui_hint: 0, 0, 1, 2 label1: Signal 1 label10: Signal 10 label2: Signal 2 @@ -554,7 +705,7 @@ blocks: marker9: '-1' name: '"AGC"' nconnections: '1' - size: '1024' + size: sps*(11 + 20 + 64 + (4 + nbytes + 4)*8) srate: '1' stemplot: 'False' style1: '1' @@ -593,20 +744,23 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [816, 372.0] - rotation: 0 - state: true + coordinate: [856, 316.0] + rotation: 180 + state: enabled connections: -- [blocks_message_strobe_1, strobe, pdu_random_pdu_0, generate] +- [blocks_message_strobe_1, strobe, phy_tx_0, sdu] +- [blocks_throttle_0, '0', channels_channel_model_0, '0'] +- [blocks_uchar_to_float_0, '0', qtgui_time_sink_x_0_0, '0'] +- [cdc_insert_burst_c_0, '0', blocks_throttle_0, '0'] - [channels_channel_model_0, '0', phy_rx_0, '0'] -- [pdu_random_pdu_0, pdus, phy_tx_0, sdu] - [phy_rx_0, '0', qtgui_const_sink_x_0, '0'] - [phy_rx_0, '1', qtgui_const_sink_x_0_0, '0'] +- [phy_rx_0, '2', blocks_uchar_to_float_0, '0'] - [phy_rx_0, '3', qtgui_time_sink_x_0, '0'] - [phy_rx_0, '4', qtgui_time_sink_x_1, '0'] - [phy_rx_0, pdu, blocks_message_debug_0, print] -- [phy_tx_0, '0', channels_channel_model_0, '0'] +- [phy_tx_0, burst, cdc_insert_burst_c_0, burst] metadata: file_format: 1 diff --git a/examples/cdc_phy_rx.grc b/examples/cdc_phy_rx.grc index 65862b8ca694db4f7575b34c0e0c7b245ba6fba9..11c347ae713b70336546b33ffd03adc0c50d80e4 100644 --- a/examples/cdc_phy_rx.grc +++ b/examples/cdc_phy_rx.grc @@ -127,7 +127,7 @@ blocks: comment: '' maxoutbuf: '0' minoutbuf: '0' - tagname: amp_est + tagname: chan_est_inv vlen: '1' states: bus_sink: false @@ -272,7 +272,7 @@ blocks: comment: '' constellation: digital.constellation_bpsk().base() damping: '1.0' - loop_bw: 0.045/2 + loop_bw: '0.0157' max_dev: '1.5' maxoutbuf: '0' minoutbuf: '0' diff --git a/examples/cdc_phy_tx.grc b/examples/cdc_phy_tx.grc index bd2e60bb1a514d3014cc0feec19def028e15bbbd..fc70ec9e66855cca0c7d9fc1891e06959be48590 100644 --- a/examples/cdc_phy_tx.grc +++ b/examples/cdc_phy_tx.grc @@ -108,28 +108,27 @@ blocks: coordinate: [192, 316.0] rotation: 0 state: true -- name: blocks_tagged_stream_mux_0 - id: blocks_tagged_stream_mux +- name: blocks_tagged_stream_multiply_length_0 + id: blocks_tagged_stream_multiply_length parameters: affinity: '' alias: '' + c: sps comment: '' lengthtagname: packet_len maxoutbuf: '0' minoutbuf: '0' - ninputs: '2' - tag_preserve_head_pos: '0' - type: byte + type: complex vlen: '1' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [1016, 128.0] + coordinate: [1208, 320.0] rotation: 0 state: true -- name: cdc_tag_tx_burst_cc_0 - id: cdc_tag_tx_burst_cc +- name: blocks_tagged_stream_mux_0 + id: blocks_tagged_stream_mux parameters: affinity: '' alias: '' @@ -137,12 +136,15 @@ blocks: lengthtagname: packet_len maxoutbuf: '0' minoutbuf: '0' - scalar: sps + ninputs: '2' + tag_preserve_head_pos: '0' + type: byte + vlen: '1' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [1168, 308.0] + coordinate: [1032, 136.0] rotation: 0 state: true - name: digital_additive_scrambler_bb_0 @@ -237,7 +239,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [768, 116.0] + coordinate: [776, 116.0] rotation: 0 state: true - name: excess_bw @@ -258,24 +260,6 @@ blocks: rotation: 0 state: true - name: pad_sink_0 - id: pad_sink - parameters: - affinity: '' - alias: '' - comment: '' - label: iq - num_streams: '1' - optional: 'False' - type: complex - vlen: '1' - states: - bus_sink: false - bus_source: false - bus_structure: null - coordinate: [1400, 316.0] - rotation: 0 - state: true -- name: pad_sink_1 id: pad_sink parameters: affinity: '' @@ -284,13 +268,13 @@ blocks: label: burst num_streams: '1' optional: 'True' - type: complex + type: message vlen: '1' states: bus_sink: false bus_source: false bus_structure: null - coordinate: [936, 404.0] + coordinate: [1736, 332.0] rotation: 0 state: true - name: pad_sink_1_0 @@ -348,6 +332,23 @@ blocks: coordinate: [344, 164.0] rotation: 0 state: true +- name: pdu_tagged_stream_to_pdu_0 + id: pdu_tagged_stream_to_pdu + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + tag: packet_len + type: complex + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1504, 332.0] + rotation: 0 + state: true - name: phasing id: parameter parameters: @@ -415,7 +416,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1248, 140.0] + coordinate: [1264, 148.0] rotation: 0 state: true - name: virtual_source_0 @@ -434,11 +435,10 @@ blocks: connections: - [blocks_repack_bits_bb_0, '0', digital_chunks_to_symbols_xx_0, '0'] +- [blocks_tagged_stream_multiply_length_0, '0', pdu_tagged_stream_to_pdu_0, '0'] - [blocks_tagged_stream_mux_0, '0', virtual_sink_0, '0'] -- [cdc_tag_tx_burst_cc_0, '0', pad_sink_0, '0'] - [digital_additive_scrambler_bb_0, '0', blocks_tagged_stream_mux_0, '1'] - [digital_additive_scrambler_bb_0, '0', digital_protocol_formatter_bb_0, '0'] -- [digital_burst_shaper_xx_0, '0', pad_sink_1, '0'] - [digital_burst_shaper_xx_0, '0', root_raised_cosine_filter_0, '0'] - [digital_chunks_to_symbols_xx_0, '0', digital_burst_shaper_xx_0, '0'] - [digital_chunks_to_symbols_xx_0, '0', pad_sink_1_0, '0'] @@ -446,7 +446,8 @@ connections: - [digital_protocol_formatter_bb_0, '0', blocks_tagged_stream_mux_0, '0'] - [pad_source_0, out, digital_crc32_async_bb_0, in] - [pdu_pdu_to_tagged_stream_0, '0', digital_additive_scrambler_bb_0, '0'] -- [root_raised_cosine_filter_0, '0', cdc_tag_tx_burst_cc_0, '0'] +- [pdu_tagged_stream_to_pdu_0, pdus, pad_sink_0, in] +- [root_raised_cosine_filter_0, '0', blocks_tagged_stream_multiply_length_0, '0'] - [virtual_source_0, '0', blocks_repack_bits_bb_0, '0'] metadata: diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index 31c18d1e357264535f1c633bdfce9b43ef1b4b9d..63f095b0a6c8946419de11c6622b68f7605df3eb 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -9,5 +9,6 @@ install(FILES cdc_tag_tx_burst_cc.block.yml cdc_preamble_detect_cc.block.yml cdc_phy_tx.block.yml - cdc_phy_rx.block.yml DESTINATION share/gnuradio/grc/blocks + cdc_phy_rx.block.yml + cdc_insert_burst_c.block.yml DESTINATION share/gnuradio/grc/blocks ) diff --git a/grc/cdc_insert_burst_c.block.yml b/grc/cdc_insert_burst_c.block.yml new file mode 100644 index 0000000000000000000000000000000000000000..b8e67a6475a02514195a7c9930d90bbd62dfeab8 --- /dev/null +++ b/grc/cdc_insert_burst_c.block.yml @@ -0,0 +1,21 @@ +id: cdc_insert_burst_c +label: Insert Burst +category: '[CDC]' + +templates: + imports: from gnuradio import cdc + make: cdc.insert_burst_c() + +inputs: +- label: burst + domain: message + dtype: message + optional: True + +outputs: +- label: out + domain: stream + dtype: complex + optional: False + +file_format: 1 diff --git a/grc/cdc_phy_tx.block.yml b/grc/cdc_phy_tx.block.yml index 6fc7bbc5bd5d2e87268d34fa14a505b814a8f23b..b1769f7c99c59aac46773f8d91c7d666e08938cb 100644 --- a/grc/cdc_phy_tx.block.yml +++ b/grc/cdc_phy_tx.block.yml @@ -26,12 +26,9 @@ inputs: optional: true outputs: -- label: iq - dtype: complex - vlen: 1 - label: burst - dtype: complex - vlen: 1 + domain: message + dtype: message optional: true - label: symbols dtype: complex @@ -39,7 +36,7 @@ outputs: optional: true templates: - imports: from gnuradio import cdc + imports: from gnuradio import cdc make: cdc.phy_tx(excess_bw=${excess_bw}, phasing=${phasing}, sps=${sps}) callbacks: - set_excess_bw(${excess_bw}) diff --git a/include/gnuradio/cdc/CMakeLists.txt b/include/gnuradio/cdc/CMakeLists.txt index 75345f8917ac7f03559dc9a6e7902775d0c975de..09498fcc6592f3460af778b4616b54bbb5642519 100644 --- a/include/gnuradio/cdc/CMakeLists.txt +++ b/include/gnuradio/cdc/CMakeLists.txt @@ -12,5 +12,6 @@ install(FILES api.h tag_tx_burst_cc.h - preamble_detect_cc.h DESTINATION include/gnuradio/cdc + preamble_detect_cc.h + insert_burst_c.h DESTINATION include/gnuradio/cdc ) diff --git a/include/gnuradio/cdc/insert_burst_c.h b/include/gnuradio/cdc/insert_burst_c.h new file mode 100644 index 0000000000000000000000000000000000000000..e84f97aec43fa9fb4785be60ea1a4aa70759b4e6 --- /dev/null +++ b/include/gnuradio/cdc/insert_burst_c.h @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2023 University of Melbourne. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#ifndef INCLUDED_CDC_INSERT_BURST_C_H +#define INCLUDED_CDC_INSERT_BURST_C_H + +#include <gnuradio/cdc/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { +namespace cdc { + +/*! + * \brief <+description of block+> + * \ingroup cdc + * + */ +class CDC_API insert_burst_c : virtual public gr::sync_block { +public: + typedef std::shared_ptr<insert_burst_c> sptr; + + static sptr make(); +}; + +} // namespace cdc +} // namespace gr + +#endif /* INCLUDED_CDC_INSERT_BURST_C_H */ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 3028ecff7ded67488521408cb7b003b4d0f90a33..9e28825fd259fd5d92832b89f61843e13c417630 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -10,11 +10,10 @@ # Setup library ######################################################################## include(GrPlatform) #define LIB_SUFFIX - list(APPEND cdc_sources tag_tx_burst_cc_impl.cc preamble_detect_cc_impl.cc -) + insert_burst_c_impl.cc ) set(cdc_sources "${cdc_sources}" PARENT_SCOPE) if(NOT cdc_sources) diff --git a/lib/insert_burst_c_impl.cc b/lib/insert_burst_c_impl.cc new file mode 100644 index 0000000000000000000000000000000000000000..4fca37c08371f4fa4c5bfc9aa1c7d73e6b26af98 --- /dev/null +++ b/lib/insert_burst_c_impl.cc @@ -0,0 +1,69 @@ +/* -*- c++ -*- */ +/* + * Copyright 2023 University of Melbourne. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include "insert_burst_c_impl.h" +#include <gnuradio/io_signature.h> + +namespace gr { +namespace cdc { + +insert_burst_c::sptr insert_burst_c::make() { + return gnuradio::make_block_sptr<insert_burst_c_impl>(); +} + +insert_burst_c_impl::insert_burst_c_impl() + : gr::sync_block("insert_burst_c", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 1, sizeof(gr_complex))), + d_length(0), + d_offset(0) +{ + message_port_register_in(pmt::mp("burst")); +} + +insert_burst_c_impl::~insert_burst_c_impl() {} + +int insert_burst_c_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { + auto out = static_cast<gr_complex *>(output_items[0]); + int count = 0; + + // check for new burst + if (d_length == 0) { + pmt::pmt_t msg(delete_head_nowait(pmt::mp("burst"))); + if (msg.get() != NULL) { + d_burst = pmt::cdr(msg); + d_length = pmt::blob_length(d_burst) / sizeof(gr_complex); + d_offset = 0; + } + } + + // output burst if we have one + if (d_length > 0) { + size_t io(0); + const gr_complex *vec = c32vector_elements(d_burst, io); + count = std::min(noutput_items, d_length - d_offset); + + memcpy(out, vec, count*sizeof(gr_complex)); + + out += count; + d_offset += count; + if (d_offset >= d_length) { + d_burst.reset(); + d_length = 0; + } + } + + // output zeros for any remaining samples + memset((void *)out, 0, (noutput_items - count)*sizeof(gr_complex)); + + return noutput_items; +} + +} /* namespace cdc */ +} /* namespace gr */ diff --git a/lib/insert_burst_c_impl.h b/lib/insert_burst_c_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..e2d8316c34520e21b7a2607fdb0d35392c050f5d --- /dev/null +++ b/lib/insert_burst_c_impl.h @@ -0,0 +1,35 @@ +/* -*- c++ -*- */ +/* + * Copyright 2023 University of Melbourne. + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#ifndef INCLUDED_CDC_INSERT_BURST_C_IMPL_H +#define INCLUDED_CDC_INSERT_BURST_C_IMPL_H + +#include <gnuradio/cdc/insert_burst_c.h> +#include <pmt/pmt.h> + +namespace gr { +namespace cdc { + +class insert_burst_c_impl : public insert_burst_c { +private: + pmt::pmt_t d_burst; + int d_length; + int d_offset; + +public: + insert_burst_c_impl(); + ~insert_burst_c_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +} // namespace cdc +} // namespace gr + +#endif /* INCLUDED_CDC_INSERT_BURST_C_IMPL_H */ diff --git a/lib/preamble_detect_cc_impl.cc b/lib/preamble_detect_cc_impl.cc index d00f47e63cc83e8966ae1128c8868748016bf536..16cdb8046646fabedfbc200a717dd7a8aef4f1b4 100644 --- a/lib/preamble_detect_cc_impl.cc +++ b/lib/preamble_detect_cc_impl.cc @@ -133,7 +133,7 @@ int preamble_detect_cc_impl::work(int noutput_items, // initialize moving average filter d_y_accum = 0; - for (int i = 0; i < hist_len; i++) { + for (unsigned int i = 0; i < hist_len; i++) { d_y_accum += d_y_mag[i]; } @@ -156,9 +156,8 @@ int preamble_detect_cc_impl::work(int noutput_items, if (corr_mag[i] > threshold) { // single-tap (inverse) channel estimate gr_complex chan_est = d_corr[i] * d_scale; - double amp_est = 1.0 / std::abs(chan_est); - double phase_est = std::arg(chan_est); - + gr_complex chan_est_inv = conj(chan_est) / (chan_est * conj(chan_est)); + // time phase estimate - center-of-mass (3 samples) float m1 = corr_mag[i-1]; float m2 = corr_mag[i+0]; @@ -179,12 +178,12 @@ int preamble_detect_cc_impl::work(int noutput_items, pmt::from_double(corr_mag[i]), d_src_id); add_item_tag(ch, offset + d_mark_delay, - pmt::intern("amp_est"), - pmt::from_complex(amp_est), + pmt::intern("chan_est_inv"), + pmt::from_complex(chan_est_inv), d_src_id); add_item_tag(ch, offset + d_mark_delay, - pmt::intern("phase_est"), // reset Costas Loop to zero phase - pmt::from_double(phase_est), + pmt::intern("phase_est"), + pmt::from_double(0.0), // reset Costas Loop to zero phase d_src_id); add_item_tag(ch, offset + d_mark_delay, pmt::intern("time_est"), diff --git a/python/cdc/bindings/CMakeLists.txt b/python/cdc/bindings/CMakeLists.txt index e223334924bf41f77e13caff1689de334c9f6e38..2e33c2239bc862793cbcd77ad96bdb885203d445 100644 --- a/python/cdc/bindings/CMakeLists.txt +++ b/python/cdc/bindings/CMakeLists.txt @@ -27,10 +27,10 @@ include(GrPybind) ######################################################################## # Python Bindings ######################################################################## - list(APPEND cdc_python_files tag_tx_burst_cc_python.cc - preamble_detect_cc_python.cc python_bindings.cc) + preamble_detect_cc_python.cc + insert_burst_c_python.cc python_bindings.cc) GR_PYBIND_MAKE_OOT(cdc ../../.. diff --git a/python/cdc/bindings/docstrings/insert_burst_c_pydoc_template.h b/python/cdc/bindings/docstrings/insert_burst_c_pydoc_template.h new file mode 100644 index 0000000000000000000000000000000000000000..669412abb705be18ddad4743cd08ae633464975a --- /dev/null +++ b/python/cdc/bindings/docstrings/insert_burst_c_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2023 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr,cdc, __VA_ARGS__ ) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + + + static const char *__doc_gr_cdc_insert_burst_c = R"doc()doc"; + + + static const char *__doc_gr_cdc_insert_burst_c_insert_burst_c = R"doc()doc"; + + + static const char *__doc_gr_cdc_insert_burst_c_make = R"doc()doc"; + + diff --git a/python/cdc/bindings/insert_burst_c_python.cc b/python/cdc/bindings/insert_burst_c_python.cc new file mode 100644 index 0000000000000000000000000000000000000000..dacfa73ebfadd9ac2d43609299958f2ce9dcc339 --- /dev/null +++ b/python/cdc/bindings/insert_burst_c_python.cc @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(insert_burst_c.h) */ +/* BINDTOOL_HEADER_FILE_HASH(993cbe534820c2e3aa3580dd71c90d9c) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/cdc/insert_burst_c.h> +// pydoc.h is automatically generated in the build directory +#include <insert_burst_c_pydoc.h> + +void bind_insert_burst_c(py::module& m) +{ + + using insert_burst_c = ::gr::cdc::insert_burst_c; + + + py::class_<insert_burst_c, gr::sync_block, gr::block, gr::basic_block, + std::shared_ptr<insert_burst_c>>(m, "insert_burst_c", D(insert_burst_c)) + + .def(py::init(&insert_burst_c::make), + D(insert_burst_c,make) + ) + + + + + ; + + + + +} + + + + + + + + diff --git a/python/cdc/bindings/python_bindings.cc b/python/cdc/bindings/python_bindings.cc index 914900bfbe15652e06bbcb6ee32c960f36b652c6..d11cd00ddf619a9fcbe904299916a1cc97ec4dfc 100644 --- a/python/cdc/bindings/python_bindings.cc +++ b/python/cdc/bindings/python_bindings.cc @@ -23,6 +23,7 @@ namespace py = pybind11; // BINDING_FUNCTION_PROTOTYPES( void bind_tag_tx_burst_cc(py::module& m); void bind_preamble_detect_cc(py::module& m); + void bind_insert_burst_c(py::module& m); // ) END BINDING_FUNCTION_PROTOTYPES @@ -53,5 +54,6 @@ PYBIND11_MODULE(cdc_python, m) // BINDING_FUNCTION_CALLS( bind_tag_tx_burst_cc(m); bind_preamble_detect_cc(m); + bind_insert_burst_c(m); // ) END BINDING_FUNCTION_CALLS } \ No newline at end of file diff --git a/python/cdc/phy_rx.py b/python/cdc/phy_rx.py index 7d08049e426b4d01fc6baf058e7734b0b39d93c6..1bc5349ef9ac8e8d8a04c76aa2d484fb7b153b3c 100644 --- a/python/cdc/phy_rx.py +++ b/python/cdc/phy_rx.py @@ -56,7 +56,7 @@ class phy_rx(gr.hier_block2): self.digital_symbol_sync_xx_0 = digital.symbol_sync_cc( digital.TED_EARLY_LATE, sps, - 0.045/2, + 0.0157, 1.0, 1.0, 1.5, @@ -73,7 +73,7 @@ class phy_rx(gr.hier_block2): self.digital_additive_scrambler_bb_0 = digital.additive_scrambler_bb(0x8A, 0x7F, 7, count=0, bits_per_byte=8, reset_tag_key="packet_len") self.cdc_preamble_detect_cc_0 = cdc.preamble_detect_cc(modulated_sync_word, 0.5, 0) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(constel.bits_per_symbol(), 8, "packet_len", True, gr.GR_MSB_FIRST) - self.blocks_multiply_by_tag_value_cc_0 = blocks.multiply_by_tag_value_cc('amp_est', 1) + self.blocks_multiply_by_tag_value_cc_0 = blocks.multiply_by_tag_value_cc('chan_est_inv', 1) ################################################## diff --git a/python/cdc/phy_tx.py b/python/cdc/phy_tx.py index dbcbb99fc82cfc9158aa65267c855406482aea36..f5163fa68eeda7538097bafcf0234881f9d3552e 100644 --- a/python/cdc/phy_tx.py +++ b/python/cdc/phy_tx.py @@ -9,7 +9,6 @@ # GNU Radio version: 3.10.1.1 from gnuradio import blocks -from gnuradio import cdc from gnuradio import digital from gnuradio import filter from gnuradio.filter import firdes @@ -30,9 +29,10 @@ class phy_tx(gr.hier_block2): gr.hier_block2.__init__( self, "CDC PHY Tx", gr.io_signature(0, 0, 0), - gr.io_signature.makev(3, 3, [gr.sizeof_gr_complex*1, gr.sizeof_gr_complex*1, gr.sizeof_gr_complex*1]), + gr.io_signature(1, 1, gr.sizeof_gr_complex*1), ) self.message_port_register_hier_in("sdu") + self.message_port_register_hier_out("burst") ################################################## # Parameters @@ -60,14 +60,15 @@ class phy_tx(gr.hier_block2): 1.0, excess_bw, num_taps)) + self.pdu_tagged_stream_to_pdu_0 = pdu.tagged_stream_to_pdu(gr.types.complex_t, 'packet_len') self.pdu_pdu_to_tagged_stream_0 = pdu.pdu_to_tagged_stream(gr.types.byte_t, 'packet_len') self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb(header_format, "packet_len") self.digital_crc32_async_bb_0 = digital.crc32_async_bb(False) self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(constel.points(), 1) self.digital_burst_shaper_xx_0 = digital.burst_shaper_cc(firdes.window(window.WIN_HANN, phasing, 0), 0, num_taps//2, True, "packet_len") self.digital_additive_scrambler_bb_0 = digital.additive_scrambler_bb(0x8A, 0x7F, 7, count=0, bits_per_byte=8, reset_tag_key="packet_len") - self.cdc_tag_tx_burst_cc_0 = cdc.tag_tx_burst_cc('packet_len', sps) self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(gr.sizeof_char*1, 'packet_len', 0) + self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length(gr.sizeof_gr_complex*1, 'packet_len', sps) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(8, constel.bits_per_symbol(), "packet_len", False, gr.GR_MSB_FIRST) @@ -76,18 +77,18 @@ class phy_tx(gr.hier_block2): ################################################## self.msg_connect((self.digital_crc32_async_bb_0, 'out'), (self.pdu_pdu_to_tagged_stream_0, 'pdus')) self.msg_connect((self, 'sdu'), (self.digital_crc32_async_bb_0, 'in')) + self.msg_connect((self.pdu_tagged_stream_to_pdu_0, 'pdus'), (self, 'burst')) self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0)) + self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.pdu_tagged_stream_to_pdu_0, 0)) self.connect((self.blocks_tagged_stream_mux_0, 0), (self.blocks_repack_bits_bb_0, 0)) - self.connect((self.cdc_tag_tx_burst_cc_0, 0), (self, 0)) self.connect((self.digital_additive_scrambler_bb_0, 0), (self.blocks_tagged_stream_mux_0, 1)) self.connect((self.digital_additive_scrambler_bb_0, 0), (self.digital_protocol_formatter_bb_0, 0)) - self.connect((self.digital_burst_shaper_xx_0, 0), (self, 1)) self.connect((self.digital_burst_shaper_xx_0, 0), (self.root_raised_cosine_filter_0, 0)) self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.digital_burst_shaper_xx_0, 0)) - self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self, 2)) + self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self, 0)) self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_tagged_stream_mux_0, 0)) self.connect((self.pdu_pdu_to_tagged_stream_0, 0), (self.digital_additive_scrambler_bb_0, 0)) - self.connect((self.root_raised_cosine_filter_0, 0), (self.cdc_tag_tx_burst_cc_0, 0)) + self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0)) def get_excess_bw(self): @@ -109,6 +110,7 @@ class phy_tx(gr.hier_block2): def set_sps(self, sps): self.sps = sps self.set_num_taps(11*self.sps) + self.blocks_tagged_stream_multiply_length_0.set_scalar(self.sps) self.root_raised_cosine_filter_0.set_taps(firdes.root_raised_cosine(1.0, self.sps, 1.0, self.excess_bw, self.num_taps)) def get_constel(self):