[USRP-users] ->get_device()->recv() not working?

Josh Blum josh at ettus.com
Tue Feb 21 20:16:15 EST 2012



On 02/21/2012 05:11 PM, dave wrote:
> Gang,
> 
> I have a bunch of programs I've been using for a while to process RF
> that just broke, and I wonder if it's related to a recent firmware
> change.  I'm pretty sure I grabbed the lines below from an old version
> of rx_samples_to_file, but notice that that program now uses a different
> method to read the stream.  Did the API change?
> 
> Thanks!
> Dave
> 
>   //setup
>   std::string args("");
>   uhd::usrp::single_usrp::sptr sdev;
>   uhd::device::sptr dev;
>   uhd::rx_metadata_t md;
> 
>   //process IF from USRP
>   float RequestedSampleRate = 12.5e6;
>   sdev=uhd::usrp::single_usrp::make(args);
>   dev=sdev->get_device();
>   printf("using device: %s\n\n",sdev->get_pp_string().c_str());
>   sdev->set_rx_gain(40);
> 
>   printf("RX Gain = %4.1f dB\n",sdev->get_rx_gain());
>   sdev->set_rx_freq(1090e6);
>   printf("RX freq = %f MHz\n",sdev->get_rx_freq()/1e6);
>   sdev->set_rx_rate(RequestedSampleRate);
>   FS = sdev->get_rx_rate();
>   printf("USRP Sample Rate=%f MHz\n",FS/1e6);

I'd recommend taking a look at the new streamer API. For a quick fix,
try putting a little dummy recv here, before the issue stream command:

size_t num_rx_samps = sdev->get_device()->recv(...)

This lets the underlying streamer object get created in sc16 mode before
that stream command is issued. Minor detail... i know.

-Josh

>   sdev->issue_stream_cmd(
>    uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
>   short* IFdat = (short*)malloc(nSamples*2*sizeof(short));
> 
> :
> :
>   while (!done) { //processing loop
>     size_t num_rx_samps = sdev->get_device()->recv(
>      IFdat, nSamples, md,
>      uhd::io_type_t::COMPLEX_INT16,
>      uhd::device::RECV_MODE_FULL_BUFF
>     );
>     //do stuff with IFdat
>   } 
> 
>  sdev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
> 
> 
> 
> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com




More information about the USRP-users mailing list