[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] embed fix sequence in payload part

From: pratik hetamsaria
Subject: Re: [Discuss-gnuradio] embed fix sequence in payload part
Date: Fri, 29 Jun 2007 20:20:23 +0100 (BST)


i am presently working on tx_voice.py and rx_voice.py  for transmission of audio files. I am interested in finding out the BER . Now, the problem is that a few packets are dropped so i need to keep track of a packet sequence number. I am trying to embed a packet sequence number so that during the time of demodulation i know exactly which bits i should compare. I have looked into the code of packet_utils.py located at python2.4/site-packages/gnuradio and try to embed the sequence number over there in the payload part. What i have understood is that the preamble and access codes are dropped during the time of reception. So, i thought it would be easier to embed it in the payload part. Please correct me if i am wrong.

But when i try adding any sequence then during the time of reception, i receive the errors as i have mentioned. I have seen that there is an option of padding the payload with zeros. So,  after i add  a sequence number, the  length of the payload still remains the same as it was before adding the sequence number (the number of bits padded have changed).So, i dont know what really has changed which causes this error.

What i have added is just one line in the make_packet function of packet_utils.py

def make_packet(payload, samples_per_symbol, bits_per_symbol,
                access_code=default_access_code, pad_for_usrp=True):

    (packed_access_code, padded) = conv_1_0_string_to_packed_binary_string(access_code)
    (packed_preamble, ignore) = conv_1_0_string_to_packed_binary_string(preamble)
    payload = packed_preamble + payload   %LINE ADDED
    payload_with_crc = gru.gen_and_append_crc32(payload)
    pkt = ''.join((packed_access_code, make_header(L), whiten(payload_with_crc), '\x55'))
    if pad_for_usrp:
        pkt = pkt + (_npadding_bytes(len(pkt), samples_per_symbol, bits_per_symbol) * '\x55')

    return pkt

I have not changed anything at the receiving end. Please tell me if i need to do change anything during reception. I have printed the msg length from the pkt.py code at python2.4/site-packages/gnuradio/blksimpl

For comparison of BER i am taking the payload part as reference i.e. i am writing the payload part onto a file and during the time of reception also, i am doing the same. Please tell if there is a better way of doing BER.

thanks for your help
Pratik Hetamsaria
Tom Rondeau <address@hidden> wrote: pratik hetamsaria wrote:
> hi..
> i am trying to embed a fixed sequence which i want to recover during
> demodulation. I have read from the previous archives that it would be
> easier to embed it in the payload part.However, as soon as i add
> anything in the payload part, and try to receive using rx_voice, i get
> an error saying
> terminate called after throwing an instance of 'std::runtime_error'
> what(): msg length is not a multiple of d_itemsize
> Aborted (core dumped)
> What I have understood is that the msg length changes as soon as I add
> something to the payload.If I dont do anything and just run
> rx_voice.py then the msg length comes to be 1687/1720
> I have tried getting the msg length after adding different sequences.
> If i change the code as:
> payload = payload + preamble, the msg length changes to 1719
> Otherwise, If i change as:
> payload = payload + default_access_code
> the msg length changes to 1751
> where default_access_code and preamble are given in packet_utils.py.
> I have not been able to find out the value of d_itemsize or what
> should be its value so that the code runs.
> I would be very grateful for any help.
> Thanking you,
> Pratik Hetamsaria


I'm not entirely sure what you're trying to do. Which example code are
you using? And also, what's the purpose of what you are trying to do?
That might help us set you in the right direction.

Please list the code where you are making the change to add your fixed


Here’s a new way to find what you're looking for - Yahoo! Answers
reply via email to

[Prev in Thread] Current Thread [Next in Thread]