# How do YOU packet detect?

**URL:** <https://www.ruby-forum.com/t/how-do-you-packet-detect/234439>\
**Category:** GNU Radio\
**Created:** [March 4, 2015, 5:56pm UTC](https://www.ruby-forum.com/t/how-do-you-packet-detect/234439 "2015-03-04T17:56:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 4, 2015, 5:56pm UTC](https://www.ruby-forum.com/t/how-do-you-packet-detect/234439/1 "2015-03-04T17:56:13Z")

</div>

Hi all,

As the subject states, how have you detected packets in your packet  
based  
gnu radio SDR?

The only example I have come across is Tom’s OFDM packet detect in the  
digital examples folder. There, he uses an OFDM specific block to  
generate  
the trigger signal for the Header/Payload demux.

My use case is very basic. I have a QPSK radio that I am using to  
measure  
the performance of different source codes. What I want to do is transmit  
a  
file (USRP N210) from the Tx and on the Rx dump the received signal into  
a  
file only after detection of the start of the file. I don’t want a lot  
of  
garabage data before the file actually starts. To stop the dump, I would  
be  
happy detecting an end of file condition or using a smart preamble with  
the  
file length specified. Doesn’t matter to me.

If you have any advice for my case, I would appreciate that.

v/r,  
Rich

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 4, 2015, 6:59pm UTC](https://www.ruby-forum.com/t/how-do-you-packet-detect/234439/2 "2015-03-04T18:59:45Z")

</div>

Have you looked at the narrowband example scripts? The  
benchmark\_[rx|tx].py  
scripts support packetized QPSK.

On Wed, Mar 4, 2015 at 11:54 AM, Richard B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 4, 2015, 7:55pm UTC](https://www.ruby-forum.com/t/how-do-you-packet-detect/234439/3 "2015-03-04T19:55:26Z")

</div>

No I haven’t. I was hoping to keep this a self contained grc radio,  
because  
it makes my life easier. I will look at the benchmark scripts though.

Thanks,  
Rich

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 4, 2015, 11:05pm UTC](https://www.ruby-forum.com/t/how-do-you-packet-detect/234439/4 "2015-03-04T23:05:58Z")

</div>

Ah, after re-reading the Header/Payload Demux docs, I noticed the  
trigger  
port is optional. The block will trigger on tags connected to the input  
stream.

What seems like the best strategy to me now is this:

1. Detect the header with a correlator and add a tag at the start

2. Feed the output of the correlator into the input port of the  
Header/Payload Demux block

3. Process the out header port and generate a message that feeds into  
the  
message port of the Header/Payload Demux block

4. The Header/Payload Demux block then releases the corresponding number  
of  
payload samples through the payload port.

I haven’t touched messages before so this should be interesting. I  
welcome  
any feedback or common pitfalls to avoid.

Rich

On Wed, Mar 4, 2015 at 10:54 AM, Richard B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 5, 2015, 4:29pm UTC](https://www.ruby-forum.com/t/how-do-you-packet-detect/234439/5 "2015-03-05T16:29:17Z")

</div>

On 04.03.2015 14:04, Richard B. wrote:

> 1. Process the out header port and generate a message that feeds into  
> the message port of the Header/Payload Demux block
> 
> 2. The Header/Payload Demux block then releases the corresponding number  
> of payload samples through the payload port.
> 
> I haven’t touched messages before so this should be interesting. I  
> welcome any feedback or common pitfalls to avoid.

This is indeed the intended strategy for using this block. I haven’t  
managed to try this yet, but I was thinking of using the corr\_and\_sync  
block in conjunction with the HPD for generating the tags.

Also, Tom has an entire branch for doing packet stuff on his github,  
with new features you might want to check out.

Cheers,  
M

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 5, 2015, 10:17pm UTC](https://www.ruby-forum.com/t/how-do-you-packet-detect/234439/6 "2015-03-05T22:17:09Z")

</div>

Oh, what branch might that be? It’s not obvious to me.

Thanks,  
Rich
