Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 62 of 62

Thread: Teensy 4.1 NTP server

  1. #51
    Junior Member
    Join Date
    Jan 2021
    Posts
    17

    Some initial results

    Good afternoon all,

    Some early results:
    Click image for larger version. 

Name:	Screenshot 2021-05-21 160138.jpg 
Views:	34 
Size:	73.6 KB 
ID:	24867
    Click image for larger version. 

Name:	Screenshot 2021-05-21 160202.jpg 
Views:	33 
Size:	42.7 KB 
ID:	24868

    And the stats from the bottom:
    Code:
    PPS To GPS: 107 ms
    millis() at PPS: 9376.972
    millis() at GPS Timestamp: 9377079
    millis() now: 9377.766
    NTP time: 3830619824
    IEEE 1588 counter at PPS: 2463559265
    Offset between NTP/GPS times: 0.000000029 s
    Estimate of NTP clock freq: 0.000009757 s/s
    ChiSq fit of freq measure: 1.678
    PID output: 9760 ns/s (ppb)
    GPS lock Status: 3D
    GPS Strong signals (> 25db): 14, Weak Signals (10db-24db): 0, No Signal (0db-9db): 1
    GPS pdop=1.6, hdop=0.8, vdop=1.4
    And Meinberg shows it as a valid peer available for synchronization.
    Click image for larger version. 

Name:	Screenshot 2021-05-21 160454.jpg 
Views:	46 
Size:	142.8 KB 
ID:	24869

    I should note that:
    192.168.4.66 is the Teensy.
    192.168.4.65 is a Chinese NTP server from the ePlace.
    192.168.4.50 is an RPi NTP server.
    192.168.4.57 is an RPi NTPSec server.

    Why do I have four GPS NTP servers on my local network? Why not? hahaha

    Thanks much,
    Ben

  2. #52
    Junior Member
    Join Date
    Jan 2021
    Posts
    17
    Quote Originally Posted by ddrown View Post
    I'd love to see your enclosure design, that sounds neat. I've been meaning to design a "shield" with a GPS module and an ethernet connector built in, but keep on getting distracted with other projects.
    The enclosure is actually a recycled extruded aluminum enclosure from the ePlace that held a previous, failed project. The 3D printed part was a piece to hold the Teeny ethernet jack board - nothing really special, but here's a quick screen-grab just for giggles:
    Click image for larger version. 

Name:	Screenshot 2021-05-21 161028.jpg 
Views:	24 
Size:	61.9 KB 
ID:	24870

    If anyone desires, I'll upload the source files. I can do STL, STEP, IGES, et cetera, just let me know.

    The jack mounts with two screws into a 1" hole. I can drill nice round holes; squares are a lot more difficult.

    Thanks much,
    ben

  3. #53
    Quote Originally Posted by kd5byb View Post
    GPS Strong signals (> 25db): 14, Weak Signals (10db-24db): 0, No Signal (0db-9db): 1
    Those are some good GPS signals

    Quote Originally Posted by kd5byb View Post
    192.168.4.66 is the Teensy.
    192.168.4.65 is a Chinese NTP server from the ePlace.
    192.168.4.50 is an RPi NTP server.
    192.168.4.57 is an RPi NTPSec server.
    Interesting that .65 claims a round trip time of 59 microseconds. I wonder if it's lying about the transmit time on the response. The RPIs and the Teensy seem to agree to the time within 100 microseconds and were all polled at around a minute of each other. Using a 1024 second interval, it's hard to tell if the .65 server is off by 500 microseconds or if the local time had just drifted by that much in 10 minutes.

    Quote Originally Posted by kd5byb View Post
    Why do I have four GPS NTP servers on my local network? Why not? hahaha
    I agree, I think there should be more GPS NTP servers.

  4. #54
    Junior Member
    Join Date
    Jan 2021
    Posts
    17
    The antenna I'm using is a cheap, magnetic-mount eBay special on a groundplane about a foot square, inside the house. I do have an external amplified GPS antenna that I split 8-ways with a non-amplified splitter, it's both better (better view of the sky) and worse (the splitter adds a lot of loss). In the past, the receiver that feeds the outdoor antenna with +5VDC for power failed, which took down *everything*, so I now keep two of the NTP servers on dedicated, magnetic-mount antennas.

    I have my doubts about the Chinese NTP server. Apparently, it's a Telit GPS module feeding a fairly low-cost TI microcontroller based on a Cortex M4. There are a couple of photos of the unit opened up here: https://fc-ntp-100.toimii.fi/ It would not surprise me if the Chinese NTP server was doing something funky such as lying about transmit time. I've been keeping my eyes open for a "real" NTP server by Endrun, Brandywine, Spectracom, etc., but so far, none have come up at a price I'm willing to pay. My thought is that a "real" NTP server would be the reference to which I could compare all the others.

    Totally in agreement - with GPS NTP being so low cost these days, there should be more of them out there.

    Thanks much,
    Ben

  5. #55
    Junior Member
    Join Date
    Jan 2021
    Posts
    17

    Cool And some additional results!

    Figured I'd follow up now that the Teensy NTP has had some time in its new enclosure. PLUS, I powered down the Chinese NTP Server (192.168.4.65) just for kicks. I do think it was somehow lying to me.

    Click image for larger version. 

Name:	Screenshot 2021-05-24 172628.jpg 
Views:	35 
Size:	135.0 KB 
ID:	24887
    Click image for larger version. 

Name:	Screenshot 2021-05-24 172651.jpg 
Views:	52 
Size:	74.5 KB 
ID:	24888
    Click image for larger version. 

Name:	Screenshot 2021-05-24 172714.jpg 
Views:	27 
Size:	40.8 KB 
ID:	24889

    Code:
    PPS To GPS: 104 ms
    millis() at PPS: 273805.386
    millis() at GPS Timestamp: 273805490
    millis() now: 273805.702
    NTP time: 3830884255
    IEEE 1588 counter at PPS: 3169238425
    Offset between NTP/GPS times: -0.000000025 s
    Estimate of NTP clock freq: 0.00001024 s/s
    ChiSq fit of freq measure: 3.940
    PID output: 10237 ns/s (ppb)
    GPS lock Status: 3D
    GPS Strong signals (> 25db): 13, Weak Signals (10db-24db): 0, No Signal (0db-9db): 1
    GPS pdop=2, hdop=0.9, vdop=1.7
    I'm pretty happy! Fairly good agreement between the Teensy and the two RPi GPS/NTP servers.

    Thanks much,
    ben

  6. #56
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    1,073
    Nice work.

    Somewhat off topic, but if a PC is left connected and the goal is just an accurate teensy clock, then one can simplify with the use of the PC (with a ntp client on it) as an accurate timing source. For example, I use a once per second single byte from the PC to adjust the teensy audio clock. Which eliminates some obnoxious audio artifacts and buffer xruns.
    Last edited by jonr; 05-25-2021 at 01:43 AM.

  7. #57
    Junior Member
    Join Date
    Jan 2021
    Posts
    17
    Greetings all - dumb question time: on y'alls Teensy 4.1 NTP servers, does the RJ45 jack LED light up? (assuming you're using the PJRC ribbon header / RJ45 jack board) Mine does not and I'm wondering if I've got a cold solder joint or something like that...

    thanks,
    ben

  8. #58
    Quote Originally Posted by kd5byb View Post
    The antenna I'm using is a cheap, magnetic-mount eBay special on a groundplane about a foot square, inside the house. I do have an external amplified GPS antenna that I split 8-ways with a non-amplified splitter, it's both better (better view of the sky) and worse (the splitter adds a lot of loss). In the past, the receiver that feeds the outdoor antenna with +5VDC for power failed, which took down *everything*, so I now keep two of the NTP servers on dedicated, magnetic-mount antennas.
    Yeah, I'm also using the magnetic-mount antennas on a windowsill.

    Quote Originally Posted by kd5byb View Post
    I have my doubts about the Chinese NTP server. Apparently, it's a Telit GPS module feeding a fairly low-cost TI microcontroller based on a Cortex M4. There are a couple of photos of the unit opened up here: https://fc-ntp-100.toimii.fi/ It would not surprise me if the Chinese NTP server was doing something funky such as lying about transmit time. I've been keeping my eyes open for a "real" NTP server by Endrun, Brandywine, Spectracom, etc., but so far, none have come up at a price I'm willing to pay. My thought is that a "real" NTP server would be the reference to which I could compare all the others.
    LeoNTP is another low cost NTP server, and I've seen some good results from other people's tests of them.



    Quote Originally Posted by jonr
    Somewhat off topic, but if a PC is left connected and the goal is just an accurate teensy clock, then one can simplify with the use of the PC (with a ntp client on it) as an accurate timing source. For example, I use a once per second single byte from the PC to adjust the teensy audio clock. Which eliminates some obnoxious audio artifacts and buffer xruns.
    Yup, NTP client will meet most everyone's needs these days. Of course, those NTP clients need to get time from somewhere, which is why I created an NTP server I'm also using it as one of the upstream sources of my cloud VMs which are part of the NTP pool, which serves time to everything from android phones, to other people's servers.

    Quote Originally Posted by kd5byb
    Greetings all - dumb question time: on y'alls Teensy 4.1 NTP servers, does the RJ45 jack LED light up? (assuming you're using the PJRC ribbon header / RJ45 jack board) Mine does not and I'm wondering if I've got a cold solder joint or something like that...
    yeah, I get the green link LED that blinks on activity

  9. #59
    Junior Member
    Join Date
    Jan 2021
    Posts
    17

    Red face

    Quote Originally Posted by ddrown View Post
    yeah, I get the green link LED that blinks on activity
    Very good. Just pulled my 4.1 out of the case and the green LED lights from an external supply when powered thru the Teensy end of the cable. Reflowed the solder joints on the pins and measured 150 ohms from the LED pin to the other side of the 150 ohm resistor (which was super hard to do, those resistors are tiny). Still doesn't work. Probably needs a reflow on the ethernet chip, but that's above my skill level so I'm just going to leave it alone and call it good as-is.

    Thanks much,
    ben

  10. #60
    Senior Member
    Join Date
    Dec 2015
    Location
    LA
    Posts
    223
    Awesome project!
    Thanks for making it available. I've finally gotten it running with a ublox NEO-M8N-0-10 module and active antenna.

    In settings.h
    uncomment the #define GPS_USES_RMC
    change the baud rate to GPS_BAUD 9600

    and in GPS.cpp
    change:
    #define GPS_CODE_RMC "GPRMC"
    #define GPS_CODE_GGA "GPGGA"

    to:
    #define GPS_CODE_RMC "GNRMC"
    #define GPS_CODE_GGA "GNGGA"

    Curious that the GPS_CODE... needed to be changed. Didn't see that posted by others using M8N? Maybe the modules 2.x firmware should be updated to 3.x?

    Not sure why but my Clock Sync count settles to 26.xxx ppm rather than others posted 8.xxx. As noted temperature is a big factor.

    As you are no doubt aware the Teensy4.1 can be run at many CPU speeds. Your program seems to run fine even at the lowest 24MHz speed. Not sure what all the effects are but the PID seems to work just fine, maybe a little more overshoot. Probably the ntp responses will be worse.

    With the lower speed -> power dissipation -> lower temperature variation, I have noticed a quieter Clock Sync count
    600Mhz mine settles to 27 +-.020
    24MHz 26 +-.005

    In an unrelated program found that when the CPU speed speed is changed on the fly the internal temp sensor response tc is < .5 sec. Haven't tried yet on this program but I will and post some plots if anyone is interested. Perhaps the Clock cycle count could be smoothed by changing the CPU speed?

    I would like to get a 10MHz signal output. Any thoughts on the best way to do this?

  11. #61
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,655
    Quote Originally Posted by bicycleguy View Post

    Not sure why but my Clock Sync count settles to 26.xxx ppm rather than others posted 8.xxx. As noted temperature is a big factor.



    I would like to get a 10MHz signal output. Any thoughts on the best way to do this?
    Every crystal is likely to have a different frequency offset (drift,ppm). The spec for the crystal specifies the expected range, e.g. +-20 ppm. FWIW, for my various Teensy 4s, here are measured drift values. As you noted, frequency can vary with temperature (post #15).

    The Teensy 4 can generate 10mhz PWM (analogWriteFrequency()), but the accuracy will reflect the drift offset of the 24 MHz crystal. Here is a thread that discusses dithering the PWM compare register to "tune" the PWM frequency. You might also search forum for GPSDO. There is also a windows program (u-center) that configures u-blox GPSs and you can configure the GPS PPS output to run at 10MHz (GPS accurate).
    Last edited by manitou; 09-15-2021 at 05:42 PM.

  12. #62
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    711
    I had not been keeping track of developments; I only just saw the T4.1 NTP server code was updated to include the webserver with some plots and numbers. In case of interest here are my current results, with a rooftop antenna. My receiver is limited to the original US GPS constellation only, but the antenna position allows for reasonably good signal reception.

    Code:
    PPS To GPS: 347 ms
    millis() at PPS: 2225.722
    millis() at GPS Timestamp: 2226069
    millis() now: 2227.004
    NTP time: 3842900464
    IEEE 1588 counter at PPS: 3955615440
    Offset between NTP/GPS times: 0.000000012 s
    Estimate of NTP clock freq: 0.000008906 s/s
    ChiSq fit of freq measure: 0.224
    PID output: 8907 ns/s (ppb)
    GPS lock Status: 3D
    GPS Strong signals (> 25db): 10, Weak Signals (10db-24db): 1, No Signal (0db-9db): 0
    GPS pdop=1.8, hdop=1, vdop=1.5
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	NTP-GPS-2021-10-10_17-22-47.png 
Views:	11 
Size:	64.8 KB 
ID:	26144   Click image for larger version. 

Name:	SatSignal_2021-10-10_17-22-02.png 
Views:	7 
Size:	57.0 KB 
ID:	26145  

    Last edited by JBeale; 10-11-2021 at 12:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •