Skip to content

Instantly share code, notes, and snippets.

@marcusmueller
Created January 28, 2025 14:51
Show Gist options
  • Select an option

  • Save marcusmueller/28bfc2ded06d85016b46f18b19df41ce to your computer and use it in GitHub Desktop.

Select an option

Save marcusmueller/28bfc2ded06d85016b46f18b19df41ce to your computer and use it in GitHub Desktop.
Reproducing Issue #7696
options:
parameters:
author: Barry Duggan
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: no_gui
hier_block_src_path: '.:'
id: pkt_53
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: pkt_53
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [24, 16.0]
rotation: 0
state: enabled
blocks:
- name: samp_rate
id: variable
parameters:
comment: ''
value: '32000'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [184, 16.0]
rotation: 0
state: enabled
- name: blocks_message_debug_0_0
id: blocks_message_debug
parameters:
affinity: ''
alias: ''
comment: ''
en_uvec: 'True'
log_level: info
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [648, 56.0]
rotation: 0
state: disabled
- name: blocks_message_debug_0_0_0
id: blocks_message_debug
parameters:
affinity: ''
alias: ''
comment: ''
en_uvec: 'True'
log_level: info
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [792, 360.0]
rotation: 0
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.init_u8vector(9,(71,78,85,32,82,97,100,105,111)))
period: '2000'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [128, 216.0]
rotation: 0
state: enabled
- name: blocks_throttle2_0
id: blocks_throttle2
parameters:
affinity: ''
alias: ''
comment: ''
ignoretag: 'True'
limit: auto
maximum: '0.1'
maxoutbuf: '0'
minoutbuf: '0'
samples_per_second: samp_rate
type: byte
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [848, 216.0]
rotation: 0
state: enabled
- name: digital_crc_append_0
id: digital_crc_append
parameters:
affinity: ''
alias: ''
comment: ''
final_xor: '0xFFFFFFFF'
initial_value: '0xFFFFFFFF'
input_reflected: 'True'
maxoutbuf: '0'
minoutbuf: '0'
num_bits: '32'
poly: '0x4C11DB7'
result_reflected: 'True'
skip_header_bytes: '0'
swap_endianness: 'False'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [368, 224.0]
rotation: 0
state: true
- name: digital_crc_check_0
id: digital_crc_check
parameters:
affinity: ''
alias: ''
comment: ''
discard_crc: 'False'
final_xor: '0xFFFFFFFF'
initial_value: '0xFFFFFFFF'
input_reflected: 'True'
maxoutbuf: '0'
minoutbuf: '0'
num_bits: '32'
poly: '0x4C11DB7'
result_reflected: 'True'
skip_header_bytes: '0'
swap_endianness: 'False'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [512, 392.0]
rotation: 0
state: enabled
- name: pdu_pdu_to_tagged_stream_0_0
id: pdu_pdu_to_tagged_stream
parameters:
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
tag: packet_len
type: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [624, 224.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: byte
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [272, 400.0]
rotation: 0
state: enabled
- name: virtual_sink_1
id: virtual_sink
parameters:
alias: ''
comment: ''
stream_id: pkt_out
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1008, 224.0]
rotation: 0
state: true
- name: virtual_source_1
id: virtual_source
parameters:
alias: ''
comment: ''
stream_id: pkt_out
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [104, 400.0]
rotation: 0
state: true
connections:
- [blocks_message_strobe_0, strobe, digital_crc_append_0, in]
- [blocks_throttle2_0, '0', virtual_sink_1, '0']
- [digital_crc_append_0, out, blocks_message_debug_0_0, print]
- [digital_crc_append_0, out, pdu_pdu_to_tagged_stream_0_0, pdus]
- [digital_crc_check_0, ok, blocks_message_debug_0_0_0, print]
- [pdu_pdu_to_tagged_stream_0_0, '0', blocks_throttle2_0, '0']
- [pdu_tagged_stream_to_pdu_0, pdus, digital_crc_check_0, in]
- [virtual_source_1, '0', pdu_tagged_stream_to_pdu_0, '0']
metadata:
file_format: 1
grc_version: 3.10.9.2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
# Title: pkt_53
# Author: Barry Duggan
# GNU Radio version: v3.11.0.0git-893-gfdfbb1da
from gnuradio import blocks
import pmt
from gnuradio import blocks, gr
from gnuradio import digital
from gnuradio import gr
from gnuradio.filter import firdes
from gnuradio.fft import window
import sys
import signal
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
from gnuradio import eng_notation
from gnuradio import gr, pdu
import threading
class pkt_53(gr.top_block):
def __init__(self):
gr.top_block.__init__(self, "pkt_53", catch_exceptions=True)
self.flowgraph_started = threading.Event()
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 32000
##################################################
# Blocks
##################################################
self.pdu_tagged_stream_to_pdu_0 = pdu.tagged_stream_to_pdu(gr.types.byte_t, 'packet_len')
self.pdu_pdu_to_tagged_stream_0_0 = pdu.pdu_to_tagged_stream(gr.types.byte_t, 'packet_len')
self.digital_crc_check_0 = digital.crc_check(32, 0x4C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, True, True, False, False, 0)
self.digital_crc_append_0 = digital.crc_append(32, 0x4C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, True, True, False, 0)
self.blocks_throttle2_0 = blocks.throttle( gr.sizeof_char*1, samp_rate, True, 0 if "auto" == "auto" else max( int(float(0.1) * samp_rate) if "auto" == "time" else int(0.1), 1) )
self.blocks_message_strobe_0 = blocks.message_strobe(pmt.cons(pmt.PMT_NIL,pmt.init_u8vector(9,(71,78,85,32,82,97,100,105,111))), 2000)
self.blocks_message_debug_0_0_0 = blocks.message_debug(True, gr.log_levels.info)
##################################################
# Connections
##################################################
self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.digital_crc_append_0, 'in'))
self.msg_connect((self.digital_crc_append_0, 'out'), (self.pdu_pdu_to_tagged_stream_0_0, 'pdus'))
self.msg_connect((self.digital_crc_check_0, 'ok'), (self.blocks_message_debug_0_0_0, 'print'))
self.msg_connect((self.pdu_tagged_stream_to_pdu_0, 'pdus'), (self.digital_crc_check_0, 'in'))
self.connect((self.blocks_throttle2_0, 0), (self.pdu_tagged_stream_to_pdu_0, 0))
self.connect((self.pdu_pdu_to_tagged_stream_0_0, 0), (self.blocks_throttle2_0, 0))
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.blocks_throttle2_0.set_sample_rate(self.samp_rate)
def main(top_block_cls=pkt_53, options=None):
tb = top_block_cls()
def sig_handler(sig=None, frame=None):
tb.stop()
tb.wait()
sys.exit(0)
signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)
tb.start()
tb.flowgraph_started.set()
try:
input('Press Enter to quit: ')
except EOFError:
pass
tb.stop()
tb.wait()
if __name__ == '__main__':
main()
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment