|
From: | Muhammad Zulqarnain |
Subject: | [Discuss-gnuradio] Setting output buffer to contain one packet |
Date: | Thu, 9 Nov 2017 15:06:48 +0000 |
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
|
[Prev in Thread] | Current Thread | [Next in Thread] |