Discussion:
[USRP-users] Trying to get GPS time using usrp -> get _mboard_sensor("gps_time")
Venkatesh Sandilya
2014-02-06 21:56:57 UTC
Permalink
Hello

I have a Ettus N200 with a GPSDO (782779-01) module installed. I am
connecting to the Ettus device using my laptop thats running Fedora 17 with
Gnuradio (3.7.2.1) and UHD (3.6).

I can run the sample (example) programs such as test_pps_input that came
with the package but not able to run a custom program that I wrote.

I took most of the code from test_pps_input.cpp and commented the last few
lines

//set the time at an unknown pps (will throw if no pps)
std::cout << std::endl << "Attempt to detect the PPS and set the
time..." << std::endl << std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl << std::endl;
return EXIT_SUCCESS;

and replaced it by

std::cout << usrp -> get_mboard_sensor("gps_time");
return EXIT_SUCCESS;

I get a whole bunch of errors. I may be doing a trivial mistake like not
running the code from the right place. Would appreciate any insight on this.

Thanks
Venkatesh
Marcus Müller
2014-02-06 22:11:16 UTC
Permalink
Hi Venkatesh,

you probably just want to use usrp->get_time_now().

Greetings,
Marcus
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01) module installed. I
am connecting to the Ettus device using my laptop thats running
Fedora 17 with Gnuradio (3.7.2.1) and UHD (3.6).
I can run the sample (example) programs such as test_pps_input that
came with the package but not able to run a custom program that I
wrote.
I took most of the code from test_pps_input.cpp and commented the
last few lines
//set the time at an unknown pps (will throw if no pps) std::cout
<< std::endl << "Attempt to detect the PPS and set the time..." <<
std::endl << std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); std::cout <<
std::endl << "Success!" << std::endl << std::endl; return
EXIT_SUCCESS;
and replaced it by
std::cout << usrp -> get_mboard_sensor("gps_time"); return
EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a trivial mistake
like not running the code from the right place. Would appreciate
any insight on this.
Thanks Venkatesh
_______________________________________________ USRP-users mailing
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Marcus Müller
2014-02-07 16:53:35 UTC
Permalink
Hi Venkatesh,

if you just modify the example in the UHD source tree and build it
"normally" there, it should run from the build directory... Are you
doing that? If not, you need to set up a compilation environment.
Depending on your needs, the best way to do that is to use the IDE of
your choice, and point it to the UHD headers and boost includes.

Hope that helped you progress,
greetings,

Marcus


PS: please always reply to the list as whole :)
Thanks Marcus. I am writing an application for the first time using
uhd. Should I store and compile the source code in any specific
path in my system? Just compiling from my home directory does not
work. Please let me know when you have a chance.
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01) module
installed. I am connecting to the Ettus device using my
laptop thats running Fedora 17 with Gnuradio (3.7.2.1) and
UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not able to run
a custom program that I wrote.
I took most of the code from test_pps_input.cpp and commented
the last few lines
//set the time at an unknown pps (will throw if no pps)
std::cout << std::endl << "Attempt to detect the PPS and set
the time..." << std::endl << std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); std::cout
<< std::endl << "Success!" << std::endl << std::endl; return
EXIT_SUCCESS;
and replaced it by
std::cout << usrp -> get_mboard_sensor("gps_time"); return
EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a trivial
mistake like not running the code from the right place. Would
appreciate any insight on this.
Thanks Venkatesh
_______________________________________________ USRP-users
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Venkatesh Sandilya
2014-02-07 17:08:43 UTC
Permalink
if you just modify the example in the UHD source tree and build it
"normally" there, it should run from the build directory... Are you
doing that?

I am not modifying the example(test_pps_input) in the UHD source tree.

f not, you need to set up a compilation environment.
Depending on your needs, the best way to do that is to use the IDE of
your choice, and point it to the UHD headers and boost includes.

I am not using a IDE. Just using the Gnu edit program. Is it recommended to
use one?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Venkatesh,
if you just modify the example in the UHD source tree and build it
"normally" there, it should run from the build directory... Are you
doing that? If not, you need to set up a compilation environment.
Depending on your needs, the best way to do that is to use the IDE of
your choice, and point it to the UHD headers and boost includes.
Hope that helped you progress,
greetings,
Marcus
PS: please always reply to the list as whole :)
Thanks Marcus. I am writing an application for the first time using
uhd. Should I store and compile the source code in any specific
path in my system? Just compiling from my home directory does not
work. Please let me know when you have a chance.
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01) module
installed. I am connecting to the Ettus device using my
laptop thats running Fedora 17 with Gnuradio (3.7.2.1) and
UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not able to run
a custom program that I wrote.
I took most of the code from test_pps_input.cpp and commented
the last few lines
//set the time at an unknown pps (will throw if no pps)
std::cout << std::endl << "Attempt to detect the PPS and set
the time..." << std::endl << std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0)); std::cout
<< std::endl << "Success!" << std::endl << std::endl; return
EXIT_SUCCESS;
and replaced it by
std::cout << usrp -> get_mboard_sensor("gps_time"); return
EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a trivial
mistake like not running the code from the right place. Would
appreciate any insight on this.
Thanks Venkatesh
_______________________________________________ USRP-users
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJS9Q+PAAoJEAFxB7BbsDrL3dQH/0CnN3QemQiRhsTTO9SXbgtq
HNlF6IUcGs2X+hiuLt48NIZZJ/7kgbKGAVXHEchrzTaRsr8Ku9buqvHavIxSr2Yh
BN7KUIwCAAyTthJscOdKEWnTn0DaRC9Psv1X7LQIh7lr6xntrSBSlQ7aacORzeKg
oULgyKHylGl9W+9RaxO7586PGJovPPeJkj/wowbNcZyxVOq2Pv6HpvLWzGn+4/aJ
U/A1ZqTwV0cUCUVprd1IQrw/l2OPpuLQdHzp945FvHRghuWBvK6iHTnKXlJVcEki
ffuExR2FKLirhMSE2EoN6k91mZrbuhwHdJzaA7HxDw+pIyR1Wc52QqqH3AqfvgA=
=lUBu
-----END PGP SIGNATURE-----
Marcus Müller
2014-02-07 18:33:24 UTC
Permalink
Hi Venkatesh,
Post by Venkatesh Sandilya
I am not modifying the example(test_pps_input) in the UHD source tree.
Then you have to configure your compiler/linker yourself to find the
headers of UHD and Boost. This is usually a build toolkit's job.
Since UHD has a working build system, I'd assume it is easiest to just
use that.
So: how do you compile it then?
Post by Venkatesh Sandilya
f not, you need to set up a compilation environment. Depending on
your needs, the best way to do that is to use the IDE of your
choice, and point it to the UHD headers and boost includes.
I am not using a IDE. Just using the Gnu edit program. Is it
recommended to use one?
I don't think there is a program called GNU edit; maybe you're
referring to Emacs? However, it is most probably but a text editor,
which is very fine for programming - however you still have to figure
out how to build your code.

My suggestion would thus be:
a) set up a build system for your modified example, and supply it with
all the files test_pps_input.cpp needs. Since doing this from scratch
demands some experience this will be *much* easier if you use an IDE
that suits you well and add a new project with includes and linkings
correctly set, OR
b) just move the modified example back into the UHD source tree where
you took it from, and rebuild that like you did when building UHD the
first time. All the files it needs are where the compiler expects them
to be.

I'd take b), since you don't need to install anything when testing
these examples and thus won't break anything, and it greatly
simplifies your efforts.


Greetings,

Marcus
Post by Venkatesh Sandilya
Hi Venkatesh,
if you just modify the example in the UHD source tree and build it
"normally" there, it should run from the build directory... Are
you doing that? If not, you need to set up a compilation
environment. Depending on your needs, the best way to do that is to
use the IDE of your choice, and point it to the UHD headers and
boost includes.
Hope that helped you progress, greetings,
Marcus
PS: please always reply to the list as whole :)
Thanks Marcus. I am writing an application for the first time
using uhd. Should I store and compile the source code in any
specific path in my system? Just compiling from my home
directory does not work. Please let me know when you have a
chance.
On Thu, Feb 6, 2014 at 5:11 PM, Marcus Müller
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01) module
installed. I am connecting to the Ettus device using
my laptop thats running Fedora 17 with Gnuradio
(3.7.2.1) and UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not able
to run a custom program that I wrote.
I took most of the code from test_pps_input.cpp and
commented the last few lines
//set the time at an unknown pps (will throw if no
pps) std::cout << std::endl << "Attempt to detect the
PPS and set the time..." << std::endl << std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl <<
std::endl; return EXIT_SUCCESS;
and replaced it by
std::cout << usrp -> get_mboard_sensor("gps_time");
return EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a
trivial mistake like not running the code from the
right place. Would appreciate any insight on this.
Thanks Venkatesh
_______________________________________________
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________ USRP-users mailing
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Venkatesh Sandilya
2014-02-07 20:12:41 UTC
Permalink
Option b sounds easiest. I went with that. Found the test_pps_input.cpp
file and added the following line to it.

usrp->get_time_now();

After modifying the file, went back to the build directory and ran "make",
"make test" and "sudo make install". After that, I ran the executable but
did not see the unix timestamp on the output. Don't know if I am doing
anything wrong.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Venkatesh,
Post by Venkatesh Sandilya
I am not modifying the example(test_pps_input) in the UHD source tree.
Then you have to configure your compiler/linker yourself to find the
headers of UHD and Boost. This is usually a build toolkit's job.
Since UHD has a working build system, I'd assume it is easiest to just
use that.
So: how do you compile it then?
Post by Venkatesh Sandilya
f not, you need to set up a compilation environment. Depending on
your needs, the best way to do that is to use the IDE of your
choice, and point it to the UHD headers and boost includes.
I am not using a IDE. Just using the Gnu edit program. Is it
recommended to use one?
I don't think there is a program called GNU edit; maybe you're
referring to Emacs? However, it is most probably but a text editor,
which is very fine for programming - however you still have to figure
out how to build your code.
a) set up a build system for your modified example, and supply it with
all the files test_pps_input.cpp needs. Since doing this from scratch
demands some experience this will be *much* easier if you use an IDE
that suits you well and add a new project with includes and linkings
correctly set, OR
b) just move the modified example back into the UHD source tree where
you took it from, and rebuild that like you did when building UHD the
first time. All the files it needs are where the compiler expects them
to be.
I'd take b), since you don't need to install anything when testing
these examples and thus won't break anything, and it greatly
simplifies your efforts.
Greetings,
Marcus
Post by Venkatesh Sandilya
Hi Venkatesh,
if you just modify the example in the UHD source tree and build it
"normally" there, it should run from the build directory... Are
you doing that? If not, you need to set up a compilation
environment. Depending on your needs, the best way to do that is to
use the IDE of your choice, and point it to the UHD headers and
boost includes.
Hope that helped you progress, greetings,
Marcus
PS: please always reply to the list as whole :)
Thanks Marcus. I am writing an application for the first time
using uhd. Should I store and compile the source code in any
specific path in my system? Just compiling from my home
directory does not work. Please let me know when you have a
chance.
On Thu, Feb 6, 2014 at 5:11 PM, Marcus Müller
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01) module
installed. I am connecting to the Ettus device using
my laptop thats running Fedora 17 with Gnuradio
(3.7.2.1) and UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not able
to run a custom program that I wrote.
I took most of the code from test_pps_input.cpp and
commented the last few lines
//set the time at an unknown pps (will throw if no
pps) std::cout << std::endl << "Attempt to detect the
PPS and set the time..." << std::endl << std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl <<
std::endl; return EXIT_SUCCESS;
and replaced it by
std::cout << usrp -> get_mboard_sensor("gps_time");
return EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a
trivial mistake like not running the code from the
right place. Would appreciate any insight on this.
Thanks Venkatesh
_______________________________________________
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________ USRP-users mailing
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJS9Sb0AAoJEAFxB7BbsDrL/4oIAJaxj8aQKQq3D5Fs4EwcIESd
2Ick6dwvjSzPQpfY/2FFH3ZUt+VmdOvNmjgOGj4p08pZ+wONnUKtmPq1o3kTOfug
HSIe0dC/rCqlP2LYPUtlbJobpGHwR4uGbdo8WA6MQd7dREIB/FMg10SsrnqgePhP
Tus1SDiuiduB5AnaTYKT4ZoaB/M+zVuHzYOAGj2BJ4q33JfNnDt4V9X7IoIDeDds
oa5Xma/WaZzd/LXrAOpwNGzGZQvVakgxUO+KEISyKc5VfqBvavpFXFuXUoqFD8HC
/A7X+ZkKHzmT6hb0Dbk0/+jQ1UWH1xHR748DOJ2hsO0hTo+gB5Pbq8ziEN+oZxw=
=HWf2
-----END PGP SIGNATURE-----
_______________________________________________
USRP-users mailing list
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Marcus Müller
2014-02-07 20:29:25 UTC
Permalink
two questions

1. did you output the time you got?

you just called get_time_now(), did you also display the output?
That might need some conversion to display:

http://files.ettus.com/uhd_docs/doxygen/html/classuhd_1_1usrp_1_1multi__usrp.html#afb4bffe3f969c11ee7c0a2cba5178780


tells me you could do something like

cout << "time in seconds" << usrp->get_time_now().get_real_secs()
<<std::endl;

Please refer to the documentation of time_spec_t for more details on
the time data type.

2. did you run the right executable?
it should be in your build/examples directory.

Greetings,
Marcus
Post by Venkatesh Sandilya
Option b sounds easiest. I went with that. Found the
test_pps_input.cpp file and added the following line to it.
usrp->get_time_now();
After modifying the file, went back to the build directory and ran
"make", "make test" and "sudo make install". After that, I ran the
executable but did not see the unix timestamp on the output. Don't
know if I am doing anything wrong.
Hi Venkatesh,
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
I am not modifying the example(test_pps_input) in the UHD
source tree.
Then you have to configure your compiler/linker yourself to find
the headers of UHD and Boost. This is usually a build toolkit's
job. Since UHD has a working build system, I'd assume it is easiest
to just use that. So: how do you compile it then?
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
f not, you need to set up a compilation environment.
Depending on your needs, the best way to do that is to use
the IDE of your choice, and point it to the UHD headers and
boost includes.
I am not using a IDE. Just using the Gnu edit program. Is it
recommended to use one?
I don't think there is a program called GNU edit; maybe you're
referring to Emacs? However, it is most probably but a text
editor, which is very fine for programming - however you still have
to figure out how to build your code.
My suggestion would thus be: a) set up a build system for your
modified example, and supply it with all the files
test_pps_input.cpp needs. Since doing this from scratch demands
some experience this will be *much* easier if you use an IDE that
suits you well and add a new project with includes and linkings
correctly set, OR b) just move the modified example back into the
UHD source tree where you took it from, and rebuild that like you
did when building UHD the first time. All the files it needs are
where the compiler expects them to be.
I'd take b), since you don't need to install anything when testing
these examples and thus won't break anything, and it greatly
simplifies your efforts.
Greetings,
Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
On Fri, Feb 7, 2014 at 11:53 AM, Marcus Müller
Hi Venkatesh,
if you just modify the example in the UHD source tree and
build it "normally" there, it should run from the build
directory... Are you doing that? If not, you need to set up a
compilation environment. Depending on your needs, the best
way to do that is to use the IDE of your choice, and point it
to the UHD headers and boost includes.
Hope that helped you progress, greetings,
Marcus
PS: please always reply to the list as whole :)
Post by Marcus Müller
Thanks Marcus. I am writing an application for the
first time using uhd. Should I store and compile the
source code in any specific path in my system? Just
compiling from my home directory does not work. Please
let me know when you have a chance.
On Thu, Feb 6, 2014 at 5:11 PM, Marcus Müller
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01)
module installed. I am connecting to the Ettus
device using my laptop thats running Fedora 17
with Gnuradio (3.7.2.1) and UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not
able to run a custom program that I wrote.
I took most of the code from test_pps_input.cpp
and commented the last few lines
//set the time at an unknown pps (will throw if
no pps) std::cout << std::endl << "Attempt to
detect the PPS and set the time..." << std::endl
<< std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl <<
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
std::endl; return EXIT_SUCCESS;
and replaced it by
std::cout << usrp ->
get_mboard_sensor("gps_time"); return
EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a
trivial mistake like not running the code from
the right place. Would appreciate any insight on
this.
Thanks Venkatesh
_______________________________________________
USRP-users mailing list
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________ USRP-users mailing
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Venkatesh Sandilya
2014-02-07 20:59:13 UTC
Permalink
I did not output the time (just called the function). Did not look at the
documentation there! Thanks for that.

I see that it returns time_spec_t which has a member function
get_real_secs() which should give me a double that can be printed to the
standard output.

I definitely ran the right executable. I know this because every time I did
changes in the code, this was reflected in the output.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
two questions
1. did you output the time you got?
you just called get_time_now(), did you also display the output?
http://files.ettus.com/uhd_docs/doxygen/html/classuhd_1_1usrp_1_1multi__usrp.html#afb4bffe3f969c11ee7c0a2cba5178780
tells me you could do something like
cout << "time in seconds" << usrp->get_time_now().get_real_secs()
<<std::endl;
Please refer to the documentation of time_spec_t for more details on
the time data type.
2. did you run the right executable?
it should be in your build/examples directory.
Greetings,
Marcus
Post by Venkatesh Sandilya
Option b sounds easiest. I went with that. Found the
test_pps_input.cpp file and added the following line to it.
usrp->get_time_now();
After modifying the file, went back to the build directory and ran
"make", "make test" and "sudo make install". After that, I ran the
executable but did not see the unix timestamp on the output. Don't
know if I am doing anything wrong.
Hi Venkatesh,
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
I am not modifying the example(test_pps_input) in the UHD
source tree.
Then you have to configure your compiler/linker yourself to find
the headers of UHD and Boost. This is usually a build toolkit's
job. Since UHD has a working build system, I'd assume it is easiest
to just use that. So: how do you compile it then?
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
f not, you need to set up a compilation environment.
Depending on your needs, the best way to do that is to use
the IDE of your choice, and point it to the UHD headers and
boost includes.
I am not using a IDE. Just using the Gnu edit program. Is it
recommended to use one?
I don't think there is a program called GNU edit; maybe you're
referring to Emacs? However, it is most probably but a text
editor, which is very fine for programming - however you still have
to figure out how to build your code.
My suggestion would thus be: a) set up a build system for your
modified example, and supply it with all the files
test_pps_input.cpp needs. Since doing this from scratch demands
some experience this will be *much* easier if you use an IDE that
suits you well and add a new project with includes and linkings
correctly set, OR b) just move the modified example back into the
UHD source tree where you took it from, and rebuild that like you
did when building UHD the first time. All the files it needs are
where the compiler expects them to be.
I'd take b), since you don't need to install anything when testing
these examples and thus won't break anything, and it greatly
simplifies your efforts.
Greetings,
Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
On Fri, Feb 7, 2014 at 11:53 AM, Marcus Müller
Hi Venkatesh,
if you just modify the example in the UHD source tree and
build it "normally" there, it should run from the build
directory... Are you doing that? If not, you need to set up a
compilation environment. Depending on your needs, the best
way to do that is to use the IDE of your choice, and point it
to the UHD headers and boost includes.
Hope that helped you progress, greetings,
Marcus
PS: please always reply to the list as whole :)
Post by Marcus Müller
Thanks Marcus. I am writing an application for the
first time using uhd. Should I store and compile the
source code in any specific path in my system? Just
compiling from my home directory does not work. Please
let me know when you have a chance.
On Thu, Feb 6, 2014 at 5:11 PM, Marcus Müller
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01)
module installed. I am connecting to the Ettus
device using my laptop thats running Fedora 17
with Gnuradio (3.7.2.1) and UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not
able to run a custom program that I wrote.
I took most of the code from test_pps_input.cpp
and commented the last few lines
//set the time at an unknown pps (will throw if
no pps) std::cout << std::endl << "Attempt to
detect the PPS and set the time..." << std::endl
<< std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl <<
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
Post by Venkatesh Sandilya
std::endl; return EXIT_SUCCESS;
and replaced it by
std::cout << usrp ->
get_mboard_sensor("gps_time"); return
EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a
trivial mistake like not running the code from
the right place. Would appreciate any insight on
this.
Thanks Venkatesh
_______________________________________________
USRP-users mailing list
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________ USRP-users mailing
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJS9UIlAAoJEAFxB7BbsDrLR3cH/2UF7vLAyK5G3APRQISsWE/h
rt7HJdtGxypjfu55gjgFgSCx4OdlOJ5yJvebAM8/huKt3vlmpijYqCYlYOfz9xIo
s4mROHSzSqGzkia5qVZNh8bSVzeNvwchud9D7R8N48uGe+X71PwTvS26iMdiEgHU
bCMS4Pn/PzOBZ7sJbSeSbh1zN1K6nEy24GKfcL1ZeUWeJkuTM1hwOGhbmp5xp7uY
Zboj497/wpSLTQNOdmFfOCg2cIf7Zfj+EC7i/OQBbvnd2ejSqg6kOQnc08aMBevk
IHUZ+HiU2jboHOKYnuEqvUxIx9CF5b77PjoS+HWN4+FYruXvWMkXFHUBEgYkCAI=
=uU15
-----END PGP SIGNATURE-----
Venkatesh Sandilya
2014-02-07 22:05:06 UTC
Permalink
I was able to successfully run the executable and print the return value of
get_real_secs(). Each time, I ran the executable, the output looked
something like this "0.00159043" . However, I don't think this is the Unix
epoch time.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
two questions
1. did you output the time you got?
you just called get_time_now(), did you also display the output?
http://files.ettus.com/uhd_docs/doxygen/html/classuhd_1_1usrp_1_1multi__usrp.html#afb4bffe3f969c11ee7c0a2cba5178780
tells me you could do something like
cout << "time in seconds" << usrp->get_time_now().get_real_secs()
<<std::endl;
Please refer to the documentation of time_spec_t for more details on
the time data type.
2. did you run the right executable?
it should be in your build/examples directory.
Greetings,
Marcus
Post by Venkatesh Sandilya
Option b sounds easiest. I went with that. Found the
test_pps_input.cpp file and added the following line to it.
usrp->get_time_now();
After modifying the file, went back to the build directory and ran
"make", "make test" and "sudo make install". After that, I ran the
executable but did not see the unix timestamp on the output. Don't
know if I am doing anything wrong.
Hi Venkatesh,
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
I am not modifying the example(test_pps_input) in the UHD
source tree.
Then you have to configure your compiler/linker yourself to find
the headers of UHD and Boost. This is usually a build toolkit's
job. Since UHD has a working build system, I'd assume it is easiest
to just use that. So: how do you compile it then?
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
f not, you need to set up a compilation environment.
Depending on your needs, the best way to do that is to use
the IDE of your choice, and point it to the UHD headers and
boost includes.
I am not using a IDE. Just using the Gnu edit program. Is it
recommended to use one?
I don't think there is a program called GNU edit; maybe you're
referring to Emacs? However, it is most probably but a text
editor, which is very fine for programming - however you still have
to figure out how to build your code.
My suggestion would thus be: a) set up a build system for your
modified example, and supply it with all the files
test_pps_input.cpp needs. Since doing this from scratch demands
some experience this will be *much* easier if you use an IDE that
suits you well and add a new project with includes and linkings
correctly set, OR b) just move the modified example back into the
UHD source tree where you took it from, and rebuild that like you
did when building UHD the first time. All the files it needs are
where the compiler expects them to be.
I'd take b), since you don't need to install anything when testing
these examples and thus won't break anything, and it greatly
simplifies your efforts.
Greetings,
Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
On Fri, Feb 7, 2014 at 11:53 AM, Marcus Müller
Hi Venkatesh,
if you just modify the example in the UHD source tree and
build it "normally" there, it should run from the build
directory... Are you doing that? If not, you need to set up a
compilation environment. Depending on your needs, the best
way to do that is to use the IDE of your choice, and point it
to the UHD headers and boost includes.
Hope that helped you progress, greetings,
Marcus
PS: please always reply to the list as whole :)
Post by Marcus Müller
Thanks Marcus. I am writing an application for the
first time using uhd. Should I store and compile the
source code in any specific path in my system? Just
compiling from my home directory does not work. Please
let me know when you have a chance.
On Thu, Feb 6, 2014 at 5:11 PM, Marcus Müller
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01)
module installed. I am connecting to the Ettus
device using my laptop thats running Fedora 17
with Gnuradio (3.7.2.1) and UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not
able to run a custom program that I wrote.
I took most of the code from test_pps_input.cpp
and commented the last few lines
//set the time at an unknown pps (will throw if
no pps) std::cout << std::endl << "Attempt to
detect the PPS and set the time..." << std::endl
<< std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl <<
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
Post by Venkatesh Sandilya
std::endl; return EXIT_SUCCESS;
and replaced it by
std::cout << usrp ->
get_mboard_sensor("gps_time"); return
EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a
trivial mistake like not running the code from
the right place. Would appreciate any insight on
this.
Thanks Venkatesh
_______________________________________________
USRP-users mailing list
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________ USRP-users mailing
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJS9UIlAAoJEAFxB7BbsDrLR3cH/2UF7vLAyK5G3APRQISsWE/h
rt7HJdtGxypjfu55gjgFgSCx4OdlOJ5yJvebAM8/huKt3vlmpijYqCYlYOfz9xIo
s4mROHSzSqGzkia5qVZNh8bSVzeNvwchud9D7R8N48uGe+X71PwTvS26iMdiEgHU
bCMS4Pn/PzOBZ7sJbSeSbh1zN1K6nEy24GKfcL1ZeUWeJkuTM1hwOGhbmp5xp7uY
Zboj497/wpSLTQNOdmFfOCg2cIf7Zfj+EC7i/OQBbvnd2ejSqg6kOQnc08aMBevk
IHUZ+HiU2jboHOKYnuEqvUxIx9CF5b77PjoS+HWN4+FYruXvWMkXFHUBEgYkCAI=
=uU15
-----END PGP SIGNATURE-----
Venkatesh Sandilya
2014-02-11 21:52:26 UTC
Permalink
Hello

Can anyone please suggest how to get epoch time from the class time_spec_t?
I tried the member function get_real_secs() and printed the return value
which did not look like Unix epoch time.

Thanks
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
two questions
1. did you output the time you got?
you just called get_time_now(), did you also display the output?
http://files.ettus.com/uhd_docs/doxygen/html/classuhd_1_1usrp_1_1multi__usrp.html#afb4bffe3f969c11ee7c0a2cba5178780
tells me you could do something like
cout << "time in seconds" << usrp->get_time_now().get_real_secs()
<<std::endl;
Please refer to the documentation of time_spec_t for more details on
the time data type.
2. did you run the right executable?
it should be in your build/examples directory.
Greetings,
Marcus
Post by Venkatesh Sandilya
Option b sounds easiest. I went with that. Found the
test_pps_input.cpp file and added the following line to it.
usrp->get_time_now();
After modifying the file, went back to the build directory and ran
"make", "make test" and "sudo make install". After that, I ran the
executable but did not see the unix timestamp on the output. Don't
know if I am doing anything wrong.
Hi Venkatesh,
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
I am not modifying the example(test_pps_input) in the UHD
source tree.
Then you have to configure your compiler/linker yourself to find
the headers of UHD and Boost. This is usually a build toolkit's
job. Since UHD has a working build system, I'd assume it is easiest
to just use that. So: how do you compile it then?
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
f not, you need to set up a compilation environment.
Depending on your needs, the best way to do that is to use
the IDE of your choice, and point it to the UHD headers and
boost includes.
I am not using a IDE. Just using the Gnu edit program. Is it
recommended to use one?
I don't think there is a program called GNU edit; maybe you're
referring to Emacs? However, it is most probably but a text
editor, which is very fine for programming - however you still have
to figure out how to build your code.
My suggestion would thus be: a) set up a build system for your
modified example, and supply it with all the files
test_pps_input.cpp needs. Since doing this from scratch demands
some experience this will be *much* easier if you use an IDE that
suits you well and add a new project with includes and linkings
correctly set, OR b) just move the modified example back into the
UHD source tree where you took it from, and rebuild that like you
did when building UHD the first time. All the files it needs are
where the compiler expects them to be.
I'd take b), since you don't need to install anything when testing
these examples and thus won't break anything, and it greatly
simplifies your efforts.
Greetings,
Marcus
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
On Fri, Feb 7, 2014 at 11:53 AM, Marcus Müller
Hi Venkatesh,
if you just modify the example in the UHD source tree and
build it "normally" there, it should run from the build
directory... Are you doing that? If not, you need to set up a
compilation environment. Depending on your needs, the best
way to do that is to use the IDE of your choice, and point it
to the UHD headers and boost includes.
Hope that helped you progress, greetings,
Marcus
PS: please always reply to the list as whole :)
Post by Marcus Müller
Thanks Marcus. I am writing an application for the
first time using uhd. Should I store and compile the
source code in any specific path in my system? Just
compiling from my home directory does not work. Please
let me know when you have a chance.
On Thu, Feb 6, 2014 at 5:11 PM, Marcus Müller
Hi Venkatesh,
you probably just want to use usrp->get_time_now().
Greetings, Marcus
Post by Venkatesh Sandilya
Hello
I have a Ettus N200 with a GPSDO (782779-01)
module installed. I am connecting to the Ettus
device using my laptop thats running Fedora 17
with Gnuradio (3.7.2.1) and UHD (3.6).
I can run the sample (example) programs such as
test_pps_input that came with the package but not
able to run a custom program that I wrote.
I took most of the code from test_pps_input.cpp
and commented the last few lines
//set the time at an unknown pps (will throw if
no pps) std::cout << std::endl << "Attempt to
detect the PPS and set the time..." << std::endl
<< std::endl;
usrp->set_time_unknown_pps(uhd::time_spec_t(0.0));
std::cout << std::endl << "Success!" << std::endl <<
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Marcus Müller
Post by Venkatesh Sandilya
std::endl; return EXIT_SUCCESS;
and replaced it by
std::cout << usrp ->
get_mboard_sensor("gps_time"); return
EXIT_SUCCESS;
I get a whole bunch of errors. I may be doing a
trivial mistake like not running the code from
the right place. Would appreciate any insight on
this.
Thanks Venkatesh
_______________________________________________
USRP-users mailing list
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________ USRP-users mailing
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
Post by Venkatesh Sandilya
Post by Venkatesh Sandilya
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJS9UIlAAoJEAFxB7BbsDrLR3cH/2UF7vLAyK5G3APRQISsWE/h
rt7HJdtGxypjfu55gjgFgSCx4OdlOJ5yJvebAM8/huKt3vlmpijYqCYlYOfz9xIo
s4mROHSzSqGzkia5qVZNh8bSVzeNvwchud9D7R8N48uGe+X71PwTvS26iMdiEgHU
bCMS4Pn/PzOBZ7sJbSeSbh1zN1K6nEy24GKfcL1ZeUWeJkuTM1hwOGhbmp5xp7uY
Zboj497/wpSLTQNOdmFfOCg2cIf7Zfj+EC7i/OQBbvnd2ejSqg6kOQnc08aMBevk
IHUZ+HiU2jboHOKYnuEqvUxIx9CF5b77PjoS+HWN4+FYruXvWMkXFHUBEgYkCAI=
=uU15
-----END PGP SIGNATURE-----
Loading...