Background: I have built a conventional demodulator in gnuradio and am trying to send payload data out of the flowgraph to an external Python script. I'm using gnuradio v3.7.12.

It seems to me that the optimal method would be to use the flowgraph to:

  • find the preamble and tag it
  • convert the data following the payload to a pdu
  • send the pdu as a message to the external Python code

I've built a flowgraph that successfully does this using the following blocks: input bitstream->"Correlate Access Code - Tag Stream"->"Repack Bits"->"Tagged Stream to PDU"->"ZMQ PUSH Message Sink".

The problem is that the "Correlate Access Code - Tag Stream" block expects a very specific header between the preamble and the payload: 32 bits containing the payload size (16 bits repeated twice). This is fine if I am the one controlling the input signal. Any other signal I try to receive, however, is not going to have this header field.

So instead of the "Correlate Access Code - Tag Stream" block, I tried to use the "Correlate Access Code - Tag" block, but this block sets the length tag value to 0, which prevents the rest of the signal chain from working correctly. It seems like all I need to do is change the value of the length tag to my expected payload length, but unfortunately, after many hours of scouring the documentation regarding tags, messages and pdus, I have been unable to figure out how to do this.

Am I on the right track? I've attached my working flowgraph (with the "Tag Stream" block) as well as the non-working flowgraph (with the "Tag" block). I tried a number of things (Tagged Stream Align, Stream to Tagged Stream), but I couldn't get anything to work.

Working GRC: https://www.dropbox.com/s/ilv0ry1x4nvqelj/tag_stream_test.grc?dl=0

Non-working GRC (can't set length tag!): https://www.dropbox.com/s/aoueiovuvj9ss8z/tag_test.grc?dl=0

Thanks for any help you can provide. PC


I'm also hit by the same problem, and came up with "Tag Rewrite" python block to update the value. https://gist.github.com/4a65be9c5139eb132f311b68808d36a6

However, even though I was able to update the length, "Repack Bits" block does not seem to pick it up. So while I was able to change the value of the tag, I still haven't accomplished my goal of taking the data out from the stream.

  • $\begingroup$ I was able to solve the problem by creating a custom block based on the Correlate Access Code - Tag Stream block, but deleting the code involving the header length. I then added a property for a fixed length. This block has come in very handy for reverse engineering tasks: github.com/paulgclark/gr-reveng $\endgroup$
    – Friedman
    Mar 22 '21 at 22:00

The only answer I've found to date is creating a custom block for this. Here's my solution: https://github.com/paulgclark/gr-reveng

The "Correlate Access Code - Tag Stream - Fixed Length" block (way too long a name) does not process any header field containing length and just takes a length from a block property that you enter in.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.