[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Setting output buffer to contain one packet
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] Setting output buffer to contain one packet |
Date: |
Sun, 12 Nov 2017 18:52:16 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
Would set_output_multiple() do what you want?
https://gnuradio.org/doc/doxygen/classgr_1_1block.html#a63d67fd758b70c6f2d7b7d4edcec53b3
However, you might want to consider passing your packets as messages,
not as streams.
-- M
On 11/09/2017 07:06 AM, Muhammad Zulqarnain wrote:
> Dear All!
>
> I am new to GNU-Radio. I have previously used MATLAB for packet
> transmission and detection. Here is the problem, I am facing:
>
> I have inserted zeros between the packets and transmitting the same
> packet over and over again. In the packet formation, I have appended two
> preambles side-by-side and using auto-correlation approach to detect
> coarse estimate of frequency and start of the packet. This was already
> done in MATLAB, but in GNURadio I am stuck in buffer things. I want the
> output buffer to contain exactly one packet so I can do processing on
> each packet (i.e. doing synchronization, demodulating etc.)
>
> My approach of doing auto-correlation is similar to Schmidl & Cox
> synchronization but all I find in GNURadio is for OFDM. Where this is a
> case of simple packetized transmission.
>
> As I am inserting zeros between the packets so detection of individual
> packets at the receiver won't be a problem.
>
> I have already set the max output buffer to packet length
> i.e. set_max_noutput_items (495);
>
> Here is what I am doing in work function. but somehow I am not getting
> any output.
>
>
> float curr_sample;
> int i =0;
> int y = 0;
> // Do <+signal processing+>
> while(i<=noutput_items){
> curr_sample = abs(in[y]);
> if (curr_sample >= 0.5 && packet_start == 0){ //0.5 is the
> threshold that signal is coming
> packet_start = 1;
> packet_length_count = 0;
> }
> if (packet_start == 1){
> out[i] = in[y];
> packet_length_count++;
> i++;
> }
> if (curr_sample <= 0.2 && packet_start == 1){ //0.2 is the
> threshold that zero is coming
> packet_start = 0;
> packet_length_count = 0;
> // printf("curr_packet_length: %d \n",packet_length_count);
> return i;
> }
> y++;
> }
> consume_each (y);
>
>
>
> Awaiting reply!
>
> Regards,
> Muhammad Zulqarnain
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>