[time-nuts] More TruePosition Arduino
kd5byb at gmail.com
Sat May 27 13:05:51 EDT 2017
Good morning all,
First, a big thank you to Chris and a couple of other people who pointed
me towards the low-cost USB logic analyzers. After some hair-pulling, I
got it working with PulseView and it works fantastic!
This morning, I spent some time adding various lines to my Arduino code
to toggle pins when I was in various sections of the program...and then
used the logic analyzer to look at the results.
Several interesting findings:
* The serial port on the Uno is buffered. So the only time the program
spends inside the GetSerial routine is when there is something in the
buffer, else it periodically checks for new data. If there is no serial
data to process...the program spends about 90% of its time just running
thru the main loop...unless there is a status, extstatus, or GPS
message. Even in those cases...it spends about 70% of its time in the
main loop. :)
* I expected the parser to be slow. It's not. About 600 microseconds.
* I had some things out of order in my code. Long story short, the
TruePosition asserts 1PPS high, then about 1 millsecond later, starts
sending the serial data messages for the information that is valid at
the next 1PPS tick. What I was doing was pulling in the serial data
first, which took time, so there was a significant delay (~85
milliseconds) between 1PPS being asserted high and the LCD getting
updated...because the program had to finish reading in and parsing the
data before it got back to the main loop in order to start the display
So what I do now is update the display, which occurs at the same time
the TruePosition is filling the serial buffer, *then* using getSerial to
read out the buffer and parse the message.
I would NOT have figured any of the above out without the little $10 USB
logic analyzer. For $10, it may be some of the best test-equipment
dollars I've ever spent!
The only problem I've got now, which may or may not be a problem, is
that while the Arduino seconds display and 1PPS LED are spot on as best
my eye can tell compared to a clock on an RPi synced to local
GPS-disciplined NTP, it appears to be one second slow compared to WWV
via time.gov. I suspect time.gov, due to network delays, isn't spot on.
I really need to get the HF antenna up and compare it to WWV over HF.
Dialing up the WWV phone number on the cell phone was inconclusive...and
the NIST page even suggests that delay over a cell phone line is variable.
Then I've got to add code to look at a button to switch display screens,
code up those screens, then figure out how to deal with survey mode.
thanks much and 73,
More information about the time-nuts