[Discuss-gnuradio] call the work() method

2014-05-31 Thread xianda
Hi all:
 I know every block should have it's work or general_work function.And 
i know it's used by scheduler.
 Now I want to write my c++ code just call work function.Is right to do 
it?
 If ok,can someone explain how to call work function?
 Thanks.
Best regards___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Unable to log in usrpe 110 to get access to gnuradio on screen?

2014-05-31 Thread Wafa Elhajhmida
thank you,

In fact, it works on OTG usb port.
Best regards,

Wafa HAJ HMIDA


2014-05-28 17:46 GMT+02:00 Nick Foster bistrom...@gmail.com:

 Wafa,

 Try using a USB hub for the mouse instead of plugging it directly into the
 E100. E100 is picky about USB and doesn't support USB1.1 devices directly
 connected to the ports. This is a Linux HCI driver issue related to OTG
 support in the Overo.

 It's mentioned in the E100 FAQ:
 http://code.ettus.com/redmine/ettus/projects/usrpe1xx/wiki/FAQ#What-kind-of-USB-devices-can-I-connect-to-the-my-E1x0-series

 --n


 On Wed, May 28, 2014 at 6:43 AM, West, Nathan n...@ostatemail.okstate.edu
  wrote:

 On Wed, May 28, 2014 at 8:03 AM, Wafa Elhajhmida
 wafa.elhaj.hm...@gmail.com wrote:
  Please any suggestion is appreciated.
 
  Thanks in advance.
 
  Best regards,
 
  Wafa HAJ HMIDA
 
 
 
 
  2014-05-28 11:16 GMT+02:00 Wafa Elhajhmida wafa.elhaj.hm...@gmail.com
 :
 
  Hi,
 
  I made a reboot of the usrp e110. I got on the screen a button login.
 
  But I'm unable to login with a mouse. In fact, the mouse doesn't work
 on
  usrp. But the mouse works well on my laptop.
 
  In fact, I even connected the mouse directly to a usrp e100 with a
 cable
  which is provided by Ettus(on host port).
 
  According to you what can be the problem ?
 
  Best regards,
 
  Wafa HAJ HMIDA
 
 
 
  ___
  Discuss-gnuradio mailing list
  Discuss-gnuradio@gnu.org
  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
 

 First of all, your method of asking questions is ineffective. For a
 guide on how to get better help read this:
 http://www.catb.org/esr/faqs/smart-questions.html . I would especially
 like to point you to Choose your forum carefully where this
 particular email violates at least 3 (and possibly 4 based on
 perspective) of the first 4 bullet points. There's no need for this to
 be cross-listed to 3 mailing lists, a corporate support account, and 2
 individuals. Also, this e-mail has nothing to do with GNU Radio.

 Second, I have no idea why your mouse doesn't work. If it used to
 work, you did something, and now it doesn't work then whatever you did
 probably had a side affect of breaking your mouse.

 Finally, based on your previous mailing list posts and irc chats you
 seem overwhelmed. My only real comment here is that you probably need
 more help/support than anyone can give over a mailing list. Perhaps
 you would be better off backing up from your final goal and learning
 more about GNU Radio on a standard PC and then try porting your work
 to an embedded device. Alternatively maybe you could also take some
 time to learn more about embedded systems (there's lots of classes
 on-line and every university should have a couple). It might also help
 if you hired someone to come in and do some work for you and you could
 learn from them on the job.

 Nathan

 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Dynamically changing input index of Selector block.

2014-05-31 Thread Marcus Müller
Problem being is that as soon as the head block signals done, the
flowgraph might come to a halt, effectively breaking the skip head
subgraph;
how many samples are still produced after head is done depends on timing
and buffer size...
I think that's why Mike recommended the M in N, so you only have one
runtime-limiting block in your flowgraph.

Greetings,
Marcus

On 31.05.2014 05:31, Activecat wrote:
 On Fri, May 30, 2014 at 10:20 PM, Mike Jameson mike.jame...@ettus.com
 wrote:

 FYI, the head block copies the first N items to the output then signals
 done:
 http://gnuradio.org/doc/doxygen/classgr_1_1blocks_1_1head.html

 Instead of using the Head block, the Keep M in N block should do the
 trick.

 You know your requirements well, let's pick whichever suits you best.



 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] sampling rate of a customized signal source

2014-05-31 Thread Marcus Müller
Hi Pengyu, Activecat!

These are very good considerations!
I just wanted to add, since this comes up rather frequently, that in
digital signal processing like GNU Radio,
there is no factual sampling rate. So if you calculate a signal,
it's frequency can only be measured by the number of samples a period of
that signal takes.

So I'm a little confused about your customized module, either it is pure
software, in which case you, Pengyu, set the sampling rate,
calculate how many samples equal 1ms etc (like Activecat explained), or
it is a hardware source, in which case there should be some driver etc
to tell you about
your sampling rate. Samples do not carry any additional information
such as sampling rate, they are just numbers.

Greetings,
Marcus

On 31.05.2014 06:15, Activecat wrote:
 Hi Pengyu,
 There are few considerations:

  On Sat, May 31, 2014 at 4:19 AM, Pengyu Zhang zhange...@gmail.com wrote:

 Hi All,
 How to determine the sampling rate of a customized signal source?

 I designed a customized signal source which should output two 1ms pulses
 every 10ms. If I do not know the sampling rate of the customized module, I
 do not know how many elements I should put into the out* buffer for
 generating the two 1ms pulses.


 To make the discussion easy, let's assume there is rate-limiting block (eg.
 throttle, USRP etc) in your flowgraph.

 1).  When your parameters above are described in time (example 1ms, 10ms
 etc), it is very likely that you will need to configure Sample Rate
 (which is samp_rate) as one of the variables of your custom block setting.

 2).  If you need 1ms pulses, this means your samp_rate must not be lower
 than 1kHz.
   In fact your samp_rate must be multiple of 1kHz.
   You may want to put a runtime check on this.

 3).  When you say should output two 1ms pulses every 10ms, does it mean
 it output one 1ms pulse every 5ms ?
   Let me assume yes to proceed with the discussion.

 Says, the amplitude of the pulse is 1V.

 4).  When samp_rate=1kHz, then your custom block will output one 1V and
 four 0V in every five outputs.
  This means you need to set_output_multiple(5)

 5).  When samp_rate=10kHz, then your custom block will output ten 1V and
 forty 0V in every fifty outputs.
   This means you need to set_output_multiple(50).

 6).  To generalize item 4 and 5 above, you need to
   set_output_multiple( samp_rate / 200 );

  (many more)

 This gives you some idea to start with, the rest is up to you to figure out.
 Good luck.



 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread Marcus Müller
Hi Xianda,

  I know every block should have it's work or general_work 
 function.And i know it's used by scheduler.
Right!
  Now I want to write my c++ code just call work function.Is right to 
 do it?
I hope I understand you correctly:
You want to write a C++ program that calls your work function?

As usual, it would be quite helpful if you explained *why* you would
want to do this!

Short Answer:
*Usually* you don't do that, so it's not right to do.
Long Answer:
You can not generally do this because a block can only exist within GNU
Radio, and relies on GNU Radio scheduler mechanisms.
If you however, wrote a work() that only uses the the input_items,
output_items buffers and only relies on noutput_items as runtime
information,
than that's technically possible. I would *not* recommend that, though.
Better write a new function, e.g. signal_processing(in,out, howmany)
in a non-block class
and call that from your work() as well as from your new C++ program.
  If ok,can someone explain how to call work function?
It's a C++ method, and the function signature is
int work
http://gnuradio.org/doc/doxygen/classgr_1_1sync__block.html#a38942c5d8bee5232404ab71ada9a3956
(int noutput_items, gr_vector_const_void_star
http://gnuradio.org/doc/doxygen/gnuradio-runtime_2include_2gnuradio_2types_8h.html#a9852a3d906d823cb70eb9c29e7f2a43d
input_items, gr_vector_void_star
http://gnuradio.org/doc/doxygen/gnuradio-runtime_2include_2gnuradio_2types_8h.html#acd3f499576e769966ea44554b359d949
output_items)
(from the official documentation,
http://gnuradio.org/doc/doxygen/classgr_1_1sync__block.html)
You could call it like you would call every other method. Since I assume
you already know how input_ and output_items should look like from
writing a work() function,
I don't understand where the how to call question comes from.

Best Regards,
Marcus Müller
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread Martin Braun
On 31 May 2014 11:57, Marcus Müller marcus.muel...@ettus.com wrote:

 Hi Xianda,


  I know every block should have it's work or general_work
function.And i know it's used by scheduler

For the record, a block that only uses message passing doesn't need a work
function - not that that's what you're looking for here.

M
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread xianda
Hi:
Thank you so much.
For example,I write a simple c++ program which can use the 
gnuradio/fft/fft.h.But i also want to use 
gnuradio/digital/ofdm_cyclic_prefixer.h.
But the ofdm_cyclic_prefixer is a block.It has work function.
I attached my document.
#include fstream
#include vector
#include gnuradio/gr_complex.h
#include gnuradio/fft/fft.h
#include gnuradio/digital/ofdm_cyclic_prefixer.h

std::vectorstd::complexfloat * buff1(64);//read data
std::vectorstd::complexfloat * buff2(64);//write data

std::ifstream infile(a.dat,std::ifstream::binary);
std::ofstream outfile(b.dat,std::ofstream::binary);

int main(){
while(not infile.eof())
{
infile.read((char*)buff1.front(),buff1.size()*sizeof(std::complexfloat));

gr::fft::fft_complex *buff=new gr::fft::fft_complex(64,0);
gr_complex *bu=buff-get_inbuf();
memcpy(bu,buff1.front(),buff1.size()*sizeof(std::complexfloat));
buff-execute();
gr_complex *out=buff-get_outbuf();
memcpy(buff2.front(),out,buff2.size()*sizeof(std::complexfloat));

outfile.write((char*)buff2.front(),buff2.size()*sizeof(std::complexfloat));
}

infile.close();
outfile.close();
}
Can you help me?
Thanks
Best regards,
xianda

At 2014-05-31 05:56:29, Marcus Müller marcus.muel...@ettus.com wrote:
Hi Xianda,


 I know every block should have it's work or general_work function.And 
i know it's used by scheduler.
Right!


 Now I want to write my c++ code just call work function.Is right to do 
it?
I hope I understand you correctly:
You want to write a C++ program that calls your work function?

As usual, it would be quite helpful if you explained *why* you would want to do 
this!

Short Answer:
*Usually* you don't do that, so it's not right to do.
Long Answer:
You can not generally do this because a block can only exist within GNU Radio, 
and relies on GNU Radio scheduler mechanisms.
If you however, wrote a work() that only uses the the input_items, output_items 
buffers and only relies on noutput_items as runtime information,
than that's technically possible. I would *not* recommend that, though. Better 
write a new function, e.g. signal_processing(in,out, howmany) in a non-block 
class
and call that from your work() as well as from your new C++ program.


 If ok,can someone explain how to call work function?
It's a C++ method, and the function signature is
int work (int noutput_items, gr_vector_const_void_star input_items, 
gr_vector_void_star output_items)
(from the official documentation, 
http://gnuradio.org/doc/doxygen/classgr_1_1sync__block.html)
You could call it like you would call every other method. Since I assume you 
already know how input_ and output_items should look like from writing a work() 
function,
I don't understand where the how to call question comes from.

Best Regards,
Marcus Müller
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread xianda
Hi:
Thank you so much.
I just want to write c++ code to realize (fft block+OFDM Cyclic Prefixer).
And I attached my code which just realize ifft but the OFDM Cyclic Prefixer 
has it's work function.
#include fstream
#include vector
#include gnuradio/gr_complex.h
#include gnuradio/fft/fft.h
#include gnuradio/digital/ofdm_cyclic_prefixer.h

std::vectorstd::complexfloat * buff1(64);//read data
std::vectorstd::complexfloat * buff2(64);//write data

std::ifstream infile(a.dat,std::ifstream::binary);
std::ofstream outfile(b.dat,std::ofstream::binary);

int main(){
while(not infile.eof())
{
infile.read((char*)buff1.front(),buff1.size()*sizeof(std::complexfloat));

gr::fft::fft_complex *buff=new gr::fft::fft_complex(64,0);
gr_complex *bu=buff-get_inbuf();
memcpy(bu,buff1.front(),buff1.size()*sizeof(std::complexfloat));
buff-execute();
gr_complex *out=buff-get_outbuf();
memcpy(buff2.front(),out,buff2.size()*sizeof(std::complexfloat));

outfile.write((char*)buff2.front(),buff2.size()*sizeof(std::complexfloat));
}

infile.close();
outfile.close();
}

Thank you.
Best regards,
xianda

At 2014-05-31 06:33:35, Martin Braun martin.br...@ettus.com wrote:



On 31 May 2014 11:57, Marcus Müller marcus.muel...@ettus.com wrote:

 Hi Xianda,


  I know every block should have it's work or general_work 
 function.And i know it's used by scheduler

For the record, a block that only uses message passing doesn't need a work 
function - not that that's what you're looking for here.


M___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread Marcus Müller
Hi Xianda,

 I just want to write c++ code to realize (fft block+OFDM Cyclic
Prefixer).

Sorry, I still did not understand. I only understand your C++, so here's
my comments:

The code you posted has really nothing to do with gr::block;
gr::fft:fft_complex is *not* a gr::block, and has no work()!
http://gnuradio.org/doc/doxygen/classgr_1_1fft_1_1fft__complex.html

Also, I don't see the need to #include
gnuradio/digital/ofdm_cyclic_prefixer.h. Is this a mistake or was it
intentional?

fft_complex really just a convenience wrapper around FFTW.
I haven't tried to test your code, and you could read() directly into
the get_inbuf() buffer, and write directly from your get_outbuf()
buffer, but it looks ok.

Again: gr::fft:fft_complex is not a block! it is used from within
fft_complex_vcc (which is a block).
All it does is use the FFTW library to perform FFTs, you can do that
yourself without using GNU Radio at all. Only use it when you are
developing a GNU Radio program!

Greetings,
Marcus


On 31.05.2014 13:21, xianda wrote:
 Hi:
 Thank you so much.
 I just want to write c++ code to realize (fft block+OFDM Cyclic Prefixer).
 And I attached my code which just realize ifft but the OFDM Cyclic Prefixer 
 has it's work function.
 #include fstream
 #include vector
 #include gnuradio/gr_complex.h
 #include gnuradio/fft/fft.h
 #include gnuradio/digital/ofdm_cyclic_prefixer.h

 std::vectorstd::complexfloat * buff1(64);//read data
 std::vectorstd::complexfloat * buff2(64);//write data

 std::ifstream infile(a.dat,std::ifstream::binary);
 std::ofstream outfile(b.dat,std::ofstream::binary);

 int main(){
 while(not infile.eof())
 {
 infile.read((char*)buff1.front(),buff1.size()*sizeof(std::complexfloat));

 gr::fft::fft_complex *buff=new gr::fft::fft_complex(64,0);
 gr_complex *bu=buff-get_inbuf();
 memcpy(bu,buff1.front(),buff1.size()*sizeof(std::complexfloat));
 buff-execute();
 gr_complex *out=buff-get_outbuf();
 memcpy(buff2.front(),out,buff2.size()*sizeof(std::complexfloat));

 outfile.write((char*)buff2.front(),buff2.size()*sizeof(std::complexfloat));
 }

 infile.close();
 outfile.close();
 }

 Thank you.
 Best regards,
 xianda

 At 2014-05-31 06:33:35, Martin Braun martin.br...@ettus.com wrote:



 On 31 May 2014 11:57, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,


  I know every block should have it's work or general_work 
 function.And i know it's used by scheduler
 For the record, a block that only uses message passing doesn't need a work 
 function - not that that's what you're looking for here.


 M


 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread Marcus Müller
Hi Xianda,

some of your emails are really hard to read due to your email client
writing non-standard-compliant HTML mail. Could you disable
HTML/multimedia mail?

 What I want to do is that  read symbols from file and perform fft and insert 
 cp and then transmit to the usrp.
ok, thanks for clarifying that!

Just as the fft and OFDM Cyclic Prefixer do!

Well, the fft block doesn't read from a file, and ofdm cyclic prefixer does not 
transmit, but I get your point.

 The easy way is use the gnuradio/fft/fft.h and 
 gnuradio/digital/ofdm_cyclic_prefixer.h;

No!
In GNU Radio, you build flow graphs out of existing blocks, whenever possible. 
So you want to use

[file source] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink ]

by instantiating these blocks, and connecting them to a GNU Radio flow graph. 
Then you let GNU Radio run that flow graph. 
There's no need to write your own block, so far. Actually, you can do this 
without writing a single line of code just by constructing
above flow graph in gnuradio-companion. That will generate the flowgraph  setup 
and starting program in python.

If you need to add more functionality, you usually just add another block to 
this chain, but from what you've said there will be no need to do this.


 But as you said fft_complex_vcc is a block. But now how can i call it in my 
 code?

You don't, see my previous post on calling work().


Greetings,
Marcus



On 31.05.2014 13:53, xianda wrote:
 Hi:br/  Thank you so much.br/  What I want to do is that  read 
 symbols from file and perform fft and insert cp and then transmit to the 
 usrp.Just as the fft and OFDM Cyclic Prefixer do!br/  The easy way 
 is use thelt;gnuradio/fft/fft.hgt; and 
 lt;gnuradio/digital/ofdm_cyclic_prefixer.hgt;.But as you said 
 fft_complex_vcc is a block.But now how can i call it in my code?(It's a 
 block.It has work function.)Can i add it's work function in my code?Thank 
 you.br/Best regards,br/xianda
 At 2014-05-31 07:36:24, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,

 I just want to write c++ code to realize (fft block+OFDM Cyclic
 Prefixer).

 Sorry, I still did not understand. I only understand your C++, so here's
 my comments:

 The code you posted has really nothing to do with gr::block;
 gr::fft:fft_complex is *not* a gr::block, and has no work()!
 http://gnuradio.org/doc/doxygen/classgr_1_1fft_1_1fft__complex.html

 Also, I don't see the need to #include
 gnuradio/digital/ofdm_cyclic_prefixer.h. Is this a mistake or was it
 intentional?

 fft_complex really just a convenience wrapper around FFTW.
 I haven't tried to test your code, and you could read() directly into
 the get_inbuf() buffer, and write directly from your get_outbuf()
 buffer, but it looks ok.

 Again: gr::fft:fft_complex is not a block! it is used from within
 fft_complex_vcc (which is a block).
 All it does is use the FFTW library to perform FFTs, you can do that
 yourself without using GNU Radio at all. Only use it when you are
 developing a GNU Radio program!

 Greetings,
 Marcus


 On 31.05.2014 13:21, xianda wrote:
 Hi:
 Thank you so much.
 I just want to write c++ code to realize (fft block+OFDM Cyclic 
 Prefixer).
 And I attached my code which just realize ifft but the OFDM Cyclic 
 Prefixer has it's work function.
 #include fstream
 #include vector
 #include gnuradio/gr_complex.h
 #include gnuradio/fft/fft.h
 #include gnuradio/digital/ofdm_cyclic_prefixer.h

 std::vectorstd::complexfloat * buff1(64);//read data
 std::vectorstd::complexfloat * buff2(64);//write data

 std::ifstream infile(a.dat,std::ifstream::binary);
 std::ofstream outfile(b.dat,std::ofstream::binary);

 int main(){
 while(not infile.eof())
 {
 infile.read((char*)buff1.front(),buff1.size()*sizeof(std::complexfloat));

 gr::fft::fft_complex *buff=new gr::fft::fft_complex(64,0);
 gr_complex *bu=buff-get_inbuf();
 memcpy(bu,buff1.front(),buff1.size()*sizeof(std::complexfloat));
 buff-execute();
 gr_complex *out=buff-get_outbuf();
 memcpy(buff2.front(),out,buff2.size()*sizeof(std::complexfloat));

 outfile.write((char*)buff2.front(),buff2.size()*sizeof(std::complexfloat));
 }

 infile.close();
 outfile.close();
 }

 Thank you.
 Best regards,
 xianda

 At 2014-05-31 06:33:35, Martin Braun martin.br...@ettus.com wrote:



 On 31 May 2014 11:57, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,


  I know every block should have it's work or general_work 
 function.And i know it's used by scheduler
 For the record, a block that only uses message passing doesn't need a work 
 function - not that that's what you're looking for here.


 M


 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


___

Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread xianda
Hi:
 Thank you so much for your kindly reply.
 Sorry for my poor English.
 The reason why i directly write the c++ code is that I want to use the uhd 
to control my two usrps send simultaneously.
 The aim i want to reach is that read symbol from file and perform ifft and 
insert cp and then transmit.Just like you write:
 [file source 1] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 1]
[file source 2] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 2]
I can control them simutanously.Use some class like uhd::usrp::multi_usrp.
Which is the best way to realize it?Use the c++ or write python flow 
graph?Thanks.
Thank you so much.
Best regards,
xianda








At 2014-05-31 08:25:53, Marcus Müller marcus.muel...@ettus.com wrote:
Hi Xianda,

some of your emails are really hard to read due to your email client
writing non-standard-compliant HTML mail. Could you disable
HTML/multimedia mail?

 What I want to do is that  read symbols from file and perform fft and insert 
 cp and then transmit to the usrp.
ok, thanks for clarifying that!

Just as the fft and OFDM Cyclic Prefixer do!

Well, the fft block doesn't read from a file, and ofdm cyclic prefixer does 
not transmit, but I get your point.

 The easy way is use the gnuradio/fft/fft.h and 
 gnuradio/digital/ofdm_cyclic_prefixer.h;

No!
In GNU Radio, you build flow graphs out of existing blocks, whenever possible. 
So you want to use

[file source] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink ]

by instantiating these blocks, and connecting them to a GNU Radio flow graph. 
Then you let GNU Radio run that flow graph. 
There's no need to write your own block, so far. Actually, you can do this 
without writing a single line of code just by constructing
above flow graph in gnuradio-companion. That will generate the flowgraph  
setup and starting program in python.

If you need to add more functionality, you usually just add another block to 
this chain, but from what you've said there will be no need to do this.


 But as you said fft_complex_vcc is a block. But now how can i call it in my 
 code?

You don't, see my previous post on calling work().


Greetings,
Marcus



On 31.05.2014 13:53, xianda wrote:
 Hi:br/  Thank you so much.br/  What I want to do is that  read 
 symbols from file and perform fft and insert cp and then transmit to the 
 usrp.Just as the fft and OFDM Cyclic Prefixer do!br/  The easy way 
 is use thelt;gnuradio/fft/fft.hgt; and 
 lt;gnuradio/digital/ofdm_cyclic_prefixer.hgt;.But as you said 
 fft_complex_vcc is a block.But now how can i call it in my code?(It's a 
 block.It has work function.)Can i add it's work function in my code?Thank 
 you.br/Best regards,br/xianda
 At 2014-05-31 07:36:24, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,

 I just want to write c++ code to realize (fft block+OFDM Cyclic
 Prefixer).

 Sorry, I still did not understand. I only understand your C++, so here's
 my comments:

 The code you posted has really nothing to do with gr::block;
 gr::fft:fft_complex is *not* a gr::block, and has no work()!
 http://gnuradio.org/doc/doxygen/classgr_1_1fft_1_1fft__complex.html

 Also, I don't see the need to #include
 gnuradio/digital/ofdm_cyclic_prefixer.h. Is this a mistake or was it
 intentional?

 fft_complex really just a convenience wrapper around FFTW.
 I haven't tried to test your code, and you could read() directly into
 the get_inbuf() buffer, and write directly from your get_outbuf()
 buffer, but it looks ok.

 Again: gr::fft:fft_complex is not a block! it is used from within
 fft_complex_vcc (which is a block).
 All it does is use the FFTW library to perform FFTs, you can do that
 yourself without using GNU Radio at all. Only use it when you are
 developing a GNU Radio program!

 Greetings,
 Marcus


 On 31.05.2014 13:21, xianda wrote:
 Hi:
 Thank you so much.
 I just want to write c++ code to realize (fft block+OFDM Cyclic 
 Prefixer).
 And I attached my code which just realize ifft but the OFDM Cyclic 
 Prefixer has it's work function.
 #include fstream
 #include vector
 #include gnuradio/gr_complex.h
 #include gnuradio/fft/fft.h
 #include gnuradio/digital/ofdm_cyclic_prefixer.h

 std::vectorstd::complexfloat * buff1(64);//read data
 std::vectorstd::complexfloat * buff2(64);//write data

 std::ifstream infile(a.dat,std::ifstream::binary);
 std::ofstream outfile(b.dat,std::ofstream::binary);

 int main(){
 while(not infile.eof())
 {
 infile.read((char*)buff1.front(),buff1.size()*sizeof(std::complexfloat));

 gr::fft::fft_complex *buff=new gr::fft::fft_complex(64,0);
 gr_complex *bu=buff-get_inbuf();
 memcpy(bu,buff1.front(),buff1.size()*sizeof(std::complexfloat));
 buff-execute();
 gr_complex *out=buff-get_outbuf();
 memcpy(buff2.front(),out,buff2.size()*sizeof(std::complexfloat));

 outfile.write((char*)buff2.front(),buff2.size()*sizeof(std::complexfloat));
 }

 infile.close();
 outfile.close();
 }

 Thank you.
 Best regards,
 xianda

 At 2014-05-31 

Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread Marcus Müller
Hi!

The gr-uhd USRP sink can represent multiple USRPs at once.
If you have a recent GNU Radio version, in gnuradio-companion your UHD:
USRP Sink block will have a Documentation tab.
There is an example that specifies two USRP addresses. This will
automatically enable you to transmit the contents of both files
simultaneously [1].
You should start with the gnuradio-companion, which will generate
easy-to-read Python code.
Usually, you don't need to write your own blocks to interface with USRPs.

Greetings,
Marcus

[1] Simultaneously does not mean coherently!

On 31.05.2014 14:48, xianda wrote:
 Hi:
  Thank you so much for your kindly reply.
  Sorry for my poor English.
  The reason why i directly write the c++ code is that I want to use the 
 uhd to control my two usrps send simultaneously.
  The aim i want to reach is that read symbol from file and perform ifft 
 and insert cp and then transmit.Just like you write:
  [file source 1] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 1]
 [file source 2] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 2]
 I can control them simutanously.Use some class like uhd::usrp::multi_usrp.
 Which is the best way to realize it?Use the c++ or write python flow 
 graph?Thanks.
 Thank you so much.
 Best regards,
 xianda








 At 2014-05-31 08:25:53, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,

 some of your emails are really hard to read due to your email client
 writing non-standard-compliant HTML mail. Could you disable
 HTML/multimedia mail?

 What I want to do is that  read symbols from file and perform fft and 
 insert cp and then transmit to the usrp.
 ok, thanks for clarifying that!

 Just as the fft and OFDM Cyclic Prefixer do!
 Well, the fft block doesn't read from a file, and ofdm cyclic prefixer does 
 not transmit, but I get your point.

 The easy way is use the gnuradio/fft/fft.h and 
 gnuradio/digital/ofdm_cyclic_prefixer.h;
 No!
 In GNU Radio, you build flow graphs out of existing blocks, whenever 
 possible. So you want to use

 [file source] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink ]

 by instantiating these blocks, and connecting them to a GNU Radio flow 
 graph. Then you let GNU Radio run that flow graph. 
 There's no need to write your own block, so far. Actually, you can do this 
 without writing a single line of code just by constructing
 above flow graph in gnuradio-companion. That will generate the flowgraph  
 setup and starting program in python.

 If you need to add more functionality, you usually just add another block to 
 this chain, but from what you've said there will be no need to do this.


 But as you said fft_complex_vcc is a block. But now how can i call it in my 
 code?
 You don't, see my previous post on calling work().


 Greetings,
 Marcus



 On 31.05.2014 13:53, xianda wrote:
 Hi:br/  Thank you so much.br/  What I want to do is that  read 
 symbols from file and perform fft and insert cp and then transmit to the 
 usrp.Just as the fft and OFDM Cyclic Prefixer do!br/  The easy 
 way is use thelt;gnuradio/fft/fft.hgt; and 
 lt;gnuradio/digital/ofdm_cyclic_prefixer.hgt;.But as you said 
 fft_complex_vcc is a block.But now how can i call it in my code?(It's a 
 block.It has work function.)Can i add it's work function in my code?Thank 
 you.br/Best regards,br/xianda
 At 2014-05-31 07:36:24, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,

 I just want to write c++ code to realize (fft block+OFDM Cyclic
 Prefixer).

 Sorry, I still did not understand. I only understand your C++, so here's
 my comments:

 The code you posted has really nothing to do with gr::block;
 gr::fft:fft_complex is *not* a gr::block, and has no work()!
 http://gnuradio.org/doc/doxygen/classgr_1_1fft_1_1fft__complex.html

 Also, I don't see the need to #include
 gnuradio/digital/ofdm_cyclic_prefixer.h. Is this a mistake or was it
 intentional?

 fft_complex really just a convenience wrapper around FFTW.
 I haven't tried to test your code, and you could read() directly into
 the get_inbuf() buffer, and write directly from your get_outbuf()
 buffer, but it looks ok.

 Again: gr::fft:fft_complex is not a block! it is used from within
 fft_complex_vcc (which is a block).
 All it does is use the FFTW library to perform FFTs, you can do that
 yourself without using GNU Radio at all. Only use it when you are
 developing a GNU Radio program!

 Greetings,
 Marcus


 On 31.05.2014 13:21, xianda wrote:
 Hi:
 Thank you so much.
 I just want to write c++ code to realize (fft block+OFDM Cyclic 
 Prefixer).
 And I attached my code which just realize ifft but the OFDM Cyclic 
 Prefixer has it's work function.
 #include fstream
 #include vector
 #include gnuradio/gr_complex.h
 #include gnuradio/fft/fft.h
 #include gnuradio/digital/ofdm_cyclic_prefixer.h

 std::vectorstd::complexfloat * buff1(64);//read data
 std::vectorstd::complexfloat * buff2(64);//write data

 std::ifstream 

Re: [Discuss-gnuradio] Dynamically changing input index of Selector block.

2014-05-31 Thread Activecat
On Sat, May 31, 2014 at 5:37 PM, Marcus Müller marcus.muel...@ettus.com
wrote:

  Problem being is that as soon as the head block signals done, the
 flowgraph might come to a halt, effectively breaking the skip head
 subgraph;


Thanks for highlighting this.
Now I recall that the Head block return -1 when it is done.
This makes a very good sense to use alternative likes M in N block.
Thanks.
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread xianda
Hi
 Thank you so much for your patient instructions.
 Yes ,I know the UHD:USRP Sink can specifies two USRP addresses.But the 
symbol i try to transmit to the usrp is different.
They may be should in two flow graph.
[file source 1] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 1]
[file source 2] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 2]
Can i realize it in grc?Or should i write the c++ code?
Thank you.Thank you.
Best regards,
xianda








At 2014-05-31 09:15:03, Marcus Müller marcus.muel...@ettus.com wrote:
Hi!

The gr-uhd USRP sink can represent multiple USRPs at once.
If you have a recent GNU Radio version, in gnuradio-companion your UHD:
USRP Sink block will have a Documentation tab.
There is an example that specifies two USRP addresses. This will
automatically enable you to transmit the contents of both files
simultaneously [1].
You should start with the gnuradio-companion, which will generate
easy-to-read Python code.
Usually, you don't need to write your own blocks to interface with USRPs.

Greetings,
Marcus

[1] Simultaneously does not mean coherently!

On 31.05.2014 14:48, xianda wrote:
 Hi:
  Thank you so much for your kindly reply.
  Sorry for my poor English.
  The reason why i directly write the c++ code is that I want to use the 
 uhd to control my two usrps send simultaneously.
  The aim i want to reach is that read symbol from file and perform ifft 
 and insert cp and then transmit.Just like you write:
  [file source 1] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 
 1]
 [file source 2] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink 2]
 I can control them simutanously.Use some class like uhd::usrp::multi_usrp.
 Which is the best way to realize it?Use the c++ or write python flow 
 graph?Thanks.
 Thank you so much.
 Best regards,
 xianda








 At 2014-05-31 08:25:53, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,

 some of your emails are really hard to read due to your email client
 writing non-standard-compliant HTML mail. Could you disable
 HTML/multimedia mail?

 What I want to do is that  read symbols from file and perform fft and 
 insert cp and then transmit to the usrp.
 ok, thanks for clarifying that!

 Just as the fft and OFDM Cyclic Prefixer do!
 Well, the fft block doesn't read from a file, and ofdm cyclic prefixer does 
 not transmit, but I get your point.

 The easy way is use the gnuradio/fft/fft.h and 
 gnuradio/digital/ofdm_cyclic_prefixer.h;
 No!
 In GNU Radio, you build flow graphs out of existing blocks, whenever 
 possible. So you want to use

 [file source] -- [ (I)FFT ] -- [ cyclic prefixer ] -- [ USRP sink ]

 by instantiating these blocks, and connecting them to a GNU Radio flow 
 graph. Then you let GNU Radio run that flow graph. 
 There's no need to write your own block, so far. Actually, you can do this 
 without writing a single line of code just by constructing
 above flow graph in gnuradio-companion. That will generate the flowgraph  
 setup and starting program in python.

 If you need to add more functionality, you usually just add another block 
 to this chain, but from what you've said there will be no need to do this.


 But as you said fft_complex_vcc is a block. But now how can i call it in 
 my code?
 You don't, see my previous post on calling work().


 Greetings,
 Marcus



 On 31.05.2014 13:53, xianda wrote:
 Hi:br/  Thank you so much.br/  What I want to do is that  read 
 symbols from file and perform fft and insert cp and then transmit to the 
 usrp.Just as the fft and OFDM Cyclic Prefixer do!br/  The easy 
 way is use thelt;gnuradio/fft/fft.hgt; and 
 lt;gnuradio/digital/ofdm_cyclic_prefixer.hgt;.But as you said 
 fft_complex_vcc is a block.But now how can i call it in my code?(It's a 
 block.It has work function.)Can i add it's work function in my code?Thank 
 you.br/Best regards,br/xianda
 At 2014-05-31 07:36:24, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,

 I just want to write c++ code to realize (fft block+OFDM Cyclic
 Prefixer).

 Sorry, I still did not understand. I only understand your C++, so here's
 my comments:

 The code you posted has really nothing to do with gr::block;
 gr::fft:fft_complex is *not* a gr::block, and has no work()!
 http://gnuradio.org/doc/doxygen/classgr_1_1fft_1_1fft__complex.html

 Also, I don't see the need to #include
 gnuradio/digital/ofdm_cyclic_prefixer.h. Is this a mistake or was it
 intentional?

 fft_complex really just a convenience wrapper around FFTW.
 I haven't tried to test your code, and you could read() directly into
 the get_inbuf() buffer, and write directly from your get_outbuf()
 buffer, but it looks ok.

 Again: gr::fft:fft_complex is not a block! it is used from within
 fft_complex_vcc (which is a block).
 All it does is use the FFTW library to perform FFTs, you can do that
 yourself without using GNU Radio at all. Only use it when you are
 developing a GNU Radio program!

 Greetings,
 Marcus


 

Re: [Discuss-gnuradio] call the work() method

2014-05-31 Thread xianda
Hi:br/  Thank you so much.br/  What I want to do is that  read 
symbols from file and perform fft and insert cp and then transmit to the 
usrp.Just as the fft and OFDM Cyclic Prefixer do!br/  The easy way is 
use thelt;gnuradio/fft/fft.hgt; and 
lt;gnuradio/digital/ofdm_cyclic_prefixer.hgt;.But as you said fft_complex_vcc 
is a block.But now how can i call it in my code?(It's a block.It has work 
function.)Can i add it's work function in my code?Thank you.br/Best 
regards,br/xianda
At 2014-05-31 07:36:24, Marcus Müller marcus.muel...@ettus.com wrote:
Hi Xianda,

 I just want to write c++ code to realize (fft block+OFDM Cyclic
Prefixer).

Sorry, I still did not understand. I only understand your C++, so here's
my comments:

The code you posted has really nothing to do with gr::block;
gr::fft:fft_complex is *not* a gr::block, and has no work()!
http://gnuradio.org/doc/doxygen/classgr_1_1fft_1_1fft__complex.html

Also, I don't see the need to #include
gnuradio/digital/ofdm_cyclic_prefixer.h. Is this a mistake or was it
intentional?

fft_complex really just a convenience wrapper around FFTW.
I haven't tried to test your code, and you could read() directly into
the get_inbuf() buffer, and write directly from your get_outbuf()
buffer, but it looks ok.

Again: gr::fft:fft_complex is not a block! it is used from within
fft_complex_vcc (which is a block).
All it does is use the FFTW library to perform FFTs, you can do that
yourself without using GNU Radio at all. Only use it when you are
developing a GNU Radio program!

Greetings,
Marcus


On 31.05.2014 13:21, xianda wrote:
 Hi:
 Thank you so much.
 I just want to write c++ code to realize (fft block+OFDM Cyclic 
 Prefixer).
 And I attached my code which just realize ifft but the OFDM Cyclic 
 Prefixer has it's work function.
 #include fstream
 #include vector
 #include gnuradio/gr_complex.h
 #include gnuradio/fft/fft.h
 #include gnuradio/digital/ofdm_cyclic_prefixer.h

 std::vectorstd::complexfloat * buff1(64);//read data
 std::vectorstd::complexfloat * buff2(64);//write data

 std::ifstream infile(a.dat,std::ifstream::binary);
 std::ofstream outfile(b.dat,std::ofstream::binary);

 int main(){
 while(not infile.eof())
 {
 infile.read((char*)buff1.front(),buff1.size()*sizeof(std::complexfloat));

 gr::fft::fft_complex *buff=new gr::fft::fft_complex(64,0);
 gr_complex *bu=buff-get_inbuf();
 memcpy(bu,buff1.front(),buff1.size()*sizeof(std::complexfloat));
 buff-execute();
 gr_complex *out=buff-get_outbuf();
 memcpy(buff2.front(),out,buff2.size()*sizeof(std::complexfloat));

 outfile.write((char*)buff2.front(),buff2.size()*sizeof(std::complexfloat));
 }

 infile.close();
 outfile.close();
 }

 Thank you.
 Best regards,
 xianda

 At 2014-05-31 06:33:35, Martin Braun martin.br...@ettus.com wrote:



 On 31 May 2014 11:57, Marcus Müller marcus.muel...@ettus.com wrote:
 Hi Xianda,


  I know every block should have it's work or general_work 
 function.And i know it's used by scheduler
 For the record, a block that only uses message passing doesn't need a work 
 function - not that that's what you're looking for here.


 M


 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] sampling rate of a customized signal source

2014-05-31 Thread Activecat
On Sat, May 31, 2014 at 11:47 PM, Activecat active...@gmail.com wrote:

 I've created a sample for you at https://github.com/activecat/gr-test1
  You could run the flowgraph found in the examples directory.
 Try to change the samp_rate of the flowgraph from 32kHz to different
 values (64kHz, 200kHrz etc).
 You will observe via the GUI Scope Sink, that the block consistently
 produces two 1ms pulse for every 10ms.



Try to run gr-test1/examples/flowgraph_02.grc, you may try setting
different values to samp_rate of the flowgraph.
The outcomes indicates that this pulse1 block is very consistent with the
built-in Signal Source block, in term of how it works respecting to the
samp_rate variable.

https://github.com/activecat/gr-test1
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio