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

dave d.des at sbcglobal.net
Tue Feb 21 20:11:45 EST 2012


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);
  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);






More information about the USRP-users mailing list