[USRP-users] GPSDO on usrp2

Ryan Connelly ryan.connelly.6742 at gmail.com
Mon Jun 4 14:57:02 EDT 2012


The GPS antenna should have a clear unobstructed view of the sky. Also
if the GPS antenna has a little metal dimple on one of its sides, it
has to be facing up towards the sky.

Here is a C++ program written by someone a while back to check GPS
sensors. I don't know if it still works but that gives you an idea of
how to query the sensor info. One of the sensors outputs the GGA info
as an NMEA string. Here's a link to read the string:
http://www.gpsinformation.org/dale/nmea.htm#GGA


---------------------file:
test_gpsdo.cpp--------------------------------------------------------------------
--------------------example compile: g++ -luhd
-lboot_program_options-mt test_gpsdo.cpp -o test_gpsdo -------
--------------------example usage: ./test_gpsdo --args
"addr=192.168.10.2"-----------------------------------

// author: Anonymous ( based on
http://code.ettus.com/redmine/ettus/projects/uhd/repository/revisions
// /6bd7281f83d5311675847b31746525841657c057/entry/host/examples/test_pps_input.cpp
)
// date: 2012/02/16
// purpose: access gpsdo information (by querying all the gpsdo
sensors) and output results to console

#include <uhd/utils/thread_priority.hpp>
#include <uhd/utils/safe_main.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <boost/thread.hpp>
#include <iostream>
#include <complex>

namespace po = boost::program_options;
int UHD_SAFE_MAIN(int argc, char *argv[]){

   uhd::set_thread_priority_safe();

   //variables to be set by po
   std::string args;

   //setup the program options
   po::options_description desc("Allowed options");
   desc.add_options()
       ("help", "help message")
       ("args", po::value<std::string>(&args)->default_value(""),
"single uhd device address args")
   ;

   po::variables_map vm;
   po::store(po::parse_command_line(argc, argv, desc), vm);
   po::notify(vm);

   //print the help message
   if (vm.count("help")){
       std::cout << boost::format("UHD Test PPS Input %s") % desc << std::endl;
       return ~0;
   }

   //create a usrp device
   std::cout << std::endl;
   std::cout << boost::format("Creating the usrp device with: %s...")
% args << std::endl;
   uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
   std::cout << boost::format("Using Device: %s") %
usrp->get_pp_string() << std::endl;

       //query gpsdo sensors and output to console
       //gps_time sensor
       std::cout << std::endl << "Querying gps_time sensor..." << std::endl;
       uhd::sensor_value_t val_gps_time = usrp->get_mboard_sensor("gps_time",0);
       std::cout << boost::format("Sensor output: %s") %
val_gps_time.to_pp_string() << std::endl << std::endl;
       //gps_locked sensor
       std::cout << std::endl << "Querying gps_locked sensor..." << std::endl;
       uhd::sensor_value_t val_gps_locked =
usrp->get_mboard_sensor("gps_locked",0);
       std::cout << boost::format("Sensor output: %s") %
val_gps_locked.to_pp_string() << std::endl << std::endl;
       //ref_locked sensor
       std::cout << std::endl << "Querying ref_locked sensor..." << std::endl;
       uhd::sensor_value_t val_ref_locked =
usrp->get_mboard_sensor("ref_locked",0);
       std::cout << boost::format("Sensor output: %s") %
val_ref_locked.to_pp_string() << std::endl << std::endl;
       //gps_gpgga sensor
       std::cout << std::endl << "Querying gps_gpgga sensor..." << std::endl;
       uhd::sensor_value_t val_gps_gpgga =
usrp->get_mboard_sensor("gps_gpgga",0);
       std::cout << boost::format("Sensor output: %s") %
val_gps_gpgga.to_pp_string() << std::endl << std::endl;
       //gps_gprmc sensor
       std::cout << std::endl << "Querying gps_gprmc sensor..." << std::endl;
       uhd::sensor_value_t val_gps_gprmc =
usrp->get_mboard_sensor("gps_gprmc",0);
       std::cout << boost::format("Sensor output: %s") %
val_gps_gprmc.to_pp_string() << std::endl << std::endl;
       //gps_gpgsa sensor
       std::cout << std::endl << "Querying gps_gpgsa sensor..." << std::endl;
       uhd::sensor_value_t val_gps_gpgsa =
usrp->get_mboard_sensor("gps_gpgsa",0);
       std::cout << boost::format("Sensor output: %s") %
val_gps_gpgsa.to_pp_string() << std::endl << std::endl;

       return 0;
}

-----------------------------------------------------------


On Mon, Jun 4, 2012 at 2:19 PM, Dario Lombardo
<dario.lombardo.ml at gmail.com> wrote:
>
>
> On Mon, Jun 4, 2012 at 8:03 PM, Nick Foster <nick at ettus.com> wrote:
>>
>> I guess I suspect that you aren't getting a valid GPS signal.
>
>
> It's what others have suggested. But I don't know how to improve it.
>
>>
>> I'd suggest doing a little coding and checking the GPSDO lock status,
>> probably easiest to modify the UHD examples.
>
>
> Can you suggest one to start from?
>
>>
>> What antenna are you using?
>
>
> It's a GPS/GSM antenna (antennas are packed together, with separate cables
> to go to the board).
>
>>
>> Does it have a clear view of the sky?
>
>
> More or less. I'm in a building and the usrp is in my office. Inside the
> building I can't get the GPS signal, but I can get it close to my window (I
> mean with other GPS equipments). I don't know how clean the GPS signal must
> be caught.
>
> _______________________________________________
> 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