Hi Eric
I did exactly as you told me to do but still I face the same problem. I use gr.packed_to_unpacked_bb(1,gr.GR_LSB_FIRST) to send one bit each time but I still find some data missing in the destination file. When I print the output_items to stdout I find no error and the displayed output is coherent with the expected output. The problem arises only when I try to write this out to a file. I write it to the file in order to test it.
What could be wrong with this code. This is what I do in python.
spread is the gnruadio block that does spreading according to my C++ block.
The input file "/home/murtuza/f" contains only 1 byte which is 0xAA. I repeatedly read this using "True" in the gr.file_source.
>>> from gnuradio import gr,spread
>>> a=gr.file_source(gr.sizeof_char,"/home/murtuza/f",True)
>>> b=gr.packed_to_unpacked(1,gr.GR_LSB_FIRST)
>>> c=gr.glfsr_source_b(3,True,0x05,0x01)
>>> d=gr.glfsr_source_b(3,True,0x06,0x01)
>>> x=gr.xor_bb()
>>> s=spread.spreading_blk_b(3)
>>> ds=gr.file_sink(gr.sizeof_char,"/home/murtuza/newf")
>>> t=gr.top_block()
>>> t.connect(a,b)
>>> t.connect(b,(s,1))
>>> t.connect(c,(x,0))
>>> t.connect(d,(x,1))
>>> t.connect(x,(s,0))
>>> t.connect(s,ds)
>>> t.start()
>>> t.stop()
What do you think can cause this confusing problem ?
Thanks
Ali
On Wed, Oct 1, 2008 at 3:34 PM, Eric Blossom
<address@hidden> wrote:
On Wed, Oct 01, 2008 at 01:30:59PM -0700, Eric Blossom wrote:
> int
> dsss_spreading_blk_b::general_work(int noutput_items,
> gr_vector_int &ninput_items,
> gr_vector_const_void_star &input_items,
> gr_vector_void_star &output_items)
> {
> assert(noutput_items % d_length_PN == 0);
>
> const unsigned char *pn = (const unsigned char *)input_items[0]; // PN
> const unsigned char *data = "" unsigned char *)input_items[1]; // data
> unsigned char *out = (unsigned char *)output_items[0];
>
> for(int pi=0, di=0; pi < noutput_items; pi += d_length_PN, di++){
> int current_data = pn[di]
> for (int j=0; j < d_length_PN; j++){
> out[pi + j] = f(current_data, pn[pi])
Sorry, should be:
> out[pi + j] = f(current_data, pn[pi + j])
> }
> }
>
> consume(0, noutput_items);
> consume(1, noutput_items / d_length_PN)
> }
--
Mir Murtuza Ali
Graduate Student
Center for Wireless Communications
University of Mississippi
University, MS 38677