Thomas:

You are at the limit of a combination of the OS and Python response time.

I think you will also find that the absolute accuracy of the internal time 
base in the BBB, set by timesyncd (or optionally ntpd) will meander +/- ten 
milliseconds across several hours. 
(Put the 1PPS output from a GPS into the port and plot what happens to the 
time stamps over a 24 hour period.)

Depending on your requirements, I suggest you consider something like a 
"TICC" for the edge timing capture, it will provide a serial stream with 
the time stamps, easily read by the BBB via the USB port, that has relative 
accuracy into the 100 ps range, and absolute time a function of the 10 MHz 
reference signal you give it.

https://tapr.org/kits_ticc.html

Your other alternative is to write some code for the PRU's that can do edge 
capture in real-time, then hand off the results to the BBB main cpu.

So, depends on your need to trade off money versus your time.

--- Graham

==





On Wednesday, January 30, 2019 at 3:05:23 PM UTC-6, Thomas Remmert wrote:
>
> Hi Robert, 
> Thanks for the quick reply.  I am already using a custom overlay and 
> using the PPS/GPS tools... 
>
> trying PPS source "/dev/pps0" 
> found PPS source "/dev/pps0" 
> ok, found 1 source(s), now start fetching data... 
> source 0 - assert 1548882288.001021883, sequence: 3727 - clear 
> 0.000000000, sequence: 0 
> source 0 - assert 1548882289.001020522, sequence: 3728 - clear 
> 0.000000000, sequence: 0 
> ^C 
>
> On Wed, Jan 30, 2019 at 3:01 PM Robert Nelson <robert...@gmail.com 
> <javascript:>> wrote: 
> > 
> > On Wed, Jan 30, 2019 at 2:54 PM Thomas Remmert 
> > <trem...@snaggleboards.com <javascript:>> wrote: 
> > > 
> > > Hello, 
> > > I have a contact closure switch connected to P8_14.  When the switch 
> is activated, P8_14 is brought to ground.  I need to apply a time stamp 
> when this occurs with millisecond accuracy. 
> > > 
> > > 1) I have an adafruit GPS with 1 pps output.  I see the NMEA strings 
> and have confirmed the 1 PPS is working. 
> > > 
> > > 2) I have NTP running with my local GPS and 1PPS source configured. 
>  (Maybe chrony is a better choice?) 
> > > 
> > > 3) Just for testing, I am using the following python code: 
> > > 
> > > import Adafruit_BBIO.GPIO as GPIO 
> > > import time 
> > > import datetime 
> > > 
> > > GPIO.setup("P8_14", GPIO.IN, pull_up_down=GPIO.PUD_UP) 
> > > 
> > > #GPIO.add_event_detect("P8_14", GPIO.RISING, callback=my_callback, 
> bouncetime=1000) 
> > > 
> > > while True: 
> > >         GPIO.wait_for_edge("P8_14", GPIO.RISING) 
> > >         ttime = datetime.datetime.now() 
> > >         print(ttime) 
> > > 
> > > 
> > > When I compare my time with a very expensive DAQ, my time stamp is 
> always off by 2-4ms and it is not a consistent offset.  Does anyone have 
> any other thoughts at to how I might approach this?  I am needing to get 
> the timestamp accurate to 1ms. 
> > 
> > Use the pps driver, setup an overlay like shown: 
> > 
> > 
> https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/PB-UART4-TESEO-LIV3F.dts#L63-L71
>  
> > 
> > Then you can use the pps/gps tools... 
> > 
> > Regards, 
> > 
> > -- 
> > Robert Nelson 
> > https://rcn-ee.com/ 
>
>
>
> -- 
> Thomas Remmert 
> Cell: 936-647-6030 
> Office: 281-203-0855 
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/0d397706-1b6d-4665-9928-4e69a73dc7c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to