[USRP-users] Problem with N210 and start GPS time

Michael West michael.west at ettus.com
Wed Oct 28 14:00:35 EDT 2015


Hi Giovanni,

The code snippet you included is missing the code that sets the time and
clock sources and the code that sets the time on the device.  Add the
following lines at the top of your code:

    self.uhd_usrp_source_0.set_clock_source("gpsdo")
    self.uhd_usrp_source_0.set_time_source("gpsdo")

self.uhd_usrp_source_0.set_time_next_pps(uhd.time_spec_t(self.uhd_usrp_source_0.get_mboard_sensor("gps_time").to_int()+1))
    time.sleep(1)

Try that and let us know if it works.

Regards,
Michael

On Wed, Oct 28, 2015 at 8:12 AM, Marcus D. Leech via USRP-users <
usrp-users at lists.ettus.com> wrote:

> On 10/28/2015 09:37 AM, Giovanni MARINO via USRP-users wrote:
>
> Hi,
> I found some examples in order to understand how to set the time for
> starting data acquisition with a N210 at determined date and hour therefore
> I wrote the following code:
>
> gps_time=self.uhd_usrp_source_0.get_mboard_sensor("gps_time",0).to_int()
>         timestamp1 = time.mktime(datetime.now().timetuple()) #in order to
> check if the epochs are the same.
>         print "Timenow", timestamp1
>         print "GPS time", gps_time
>         start_time='28.10.2015 12:25:00' #(it has be updated)
>         start_time = time.mktime(time.strptime(start_time,'%d.%m.%Y
> %H:%M:%S'))
>         self.uhd_usrp_source_0.set_start_time(uhd.time_spec_t(start_time))
>         print "Start
> time:",str(uhd.time_spec_t(start_time).get_real_secs())
>         self.blocks_file_sink_0 =
> blocks.file_sink(gr.sizeof_gr_complex*1,"./Data/DatafromN210.dat", False)
>         self.blocks_file_sink_0.set_unbuffered(False)
>
> I suppose that something does not work, because I am not able to save the
> data into the file (i.e. the file does not contain data as expected).
> What's wrong with the above-mentioned code?
> Thank you in advance for your time and help.
> Regards
> Giovanni
>
> Is that the entirety of your code, or just a piece of it?
>
> If you want to start streaming very far in the future, I'd suggest just
> using ordinary systemy things to "soak up" most of that time, like a
> "sleep" or don't actually invoke your
>   program until close to the time you want to start streaming, and then
> use the timed-streaming to do a more precise start-time.
>
>
>
>
> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20151028/af0fb32a/attachment-0002.html>


More information about the USRP-users mailing list