What's new

NTP Daemon for ASUSWRT/Merlin

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

I now have a flatline :eek:
Are you seeing any NMEA data from the device?
Code:
cat /dev/ttyACM0

Be sure to obscure your location from any NMEA data that you post. I don't care where you live, but others might. The $GPZDA lines is safe.
 
Last edited:
Are you seeing any NEMA data from the device?
Code:
cat /dev/ttyACM0

Be sure to obscure your location from any NEMA data that you post. I don't care where you live, but others might. The $GPZDA lines is safe.
no $GPZDA showing but it is streaming a lot of info along with the flashing green light to say it's locked.

I chopped out a lot of the info.


Code:
$GPTXT,01,01,02,u-blox ag - www.u-blox.com*50

$GPTXT,01,01,02,HW  UBX-G70xx   00070000 *77

$GPTXT,01,01,02,ROM CORE 1.00 (59842) Jun 27 2012 17:43:52*59

$GPTXT,01,01,02,PROTVER 14.00*1E

$GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20

$GPTXT,01,01,02,ANTSTATUS=OK*3B

$GPTXT,01,01,02,LLC FFFFFFFF-FFFFFFFD-FFFFFFFF-FFFFFFFF-FFFFFFF9*53

$GPRMC,133456.00,A,52*

$GPVTG,,T,,M,0.445,N*

$GPGGA,133456.00,5257.*
$GPGSA,A,3,26,2*
$GPGSV,4,1,13,07,22*
$GPGSV,4,2,13,15,07,055*

$GPGSV,4,3,13,21,40,064,*

$GPGSV,4,4,13,33,28,*

$GPGLL,5257.7287*
 
rebooted again, I didn't notice this before. ntpd seems a bit hit and miss on starting and often needs 2 or 3 reboots to kick in.

Code:
Jul 23 14:41:12 ntpd[1080]: ntpd 4.2.8p9-win@1.3728 Sat Mar 18 09:20:25 UTC 2017 (2): Starting
Jul 23 14:41:12 ntpd[1080]: Command line: ntpd -c /jffs/etc/ntp.conf
Jul 23 14:41:12 ntpd[1095]: proto: precision = 1.614 usec (-19)
Jul 23 14:41:12 kernel: gro enabled with interval 2
Jul 23 14:41:12 ntpd[1095]: Listen and drop on 0 v6wildcard [::]:123
Jul 23 14:41:12 ntpd[1095]: Listen and drop on 1 v4wildcard 0.0.0.0:123
Jul 23 14:41:12 ntpd[1095]: Listen normally on 2 lo 127.0.0.1:123
Jul 23 14:41:12 ntpd[1095]: Listen normally on 3 br0 192.168.1.1:123
Jul 23 14:41:12 ntpd[1095]: Listening on routing socket on fd #20 for interface updates
Jul 23 14:41:12 ntpd[1095]: refclock 127.127.20.0 isn't supported. ntpd was compiled without refclock support.
Jul 23 14:41:12 ntpd[1095]: 127.127.20.0 local addr 127.0.0.1 -> <null>
Jul 23 14:41:13 GoNz0: Started ntpd from .
Jul 23 14:41:13 Samba_Server: daemon is started

Got to go out for a bit so I will check when I get back :)
 
Last edited:
This line needs to be taken care of, "refclock 127.127.20.0 isn't supported. ntpd was compiled without refclock support"

You need an NTP server compiled with --enable-NEMA. It appears that Entware-ng has this. Are you using the latest Entware-ng?
https://github.com/Entware-ng/entware-packages/blob/master/net/ntpd/Makefile#L105
Latest a of a month ago, could you tell me what I need to type into putty to get the right build please?

Sent from my SM-G920F using Tapatalk
 
Latest a of a month ago, could you tell me what I need to type into putty to get the right build please?
Once Entware-ng is setup on your router, do something like this:
Code:
opkg update
opkg upgrade
opkg install ntpd

Great, now you've got NTP server with the NMEA driver support.
 
Last edited:
How to use the U-blox u-center software to configure a U-blox GPS receiver to hide your geographic location.

Note: This HowTo is for the u-blox GPS receiver and the u-center software only. It is not intended for the SiRF Star GPS receiver, which is another fine GPS product that uses a different software. I have only played with u-blox products.

Step 1
Download and install the u-center evaluation kit from the u-blox website,
https://www.u-blox.com/en/product/u-center-windows

Step 2
Plug in the GPS to your computer and run the u-center software.
Select menu: View -> Messages View
ucenter_0.jpg


Step 3
Select tree: UBX -> CFG (Config) -> MSG (Messages)
ucenter_1.jpg


Step 4
To disable a NMEA sentence, uncheck the boxes AND click Send.
Don't forget to click SEND.
ucenter_2.jpg


Step 5
Repeat for all NMEA GxXXX sentences, except NMEA GxZDA you want enabled.
Remember to click SEND after each NMEA sentence.
ucenter_3.jpg


Step 6
Except NMEA GxZDA you want enabled.
ucenter_4.jpg


(continued)
 
Last edited:
Step 7
When you're done, close the Messages window and keep the application open.
Click YES to this dialog.
ucenter_5.jpg


Step 8
Click SEND to update the flash memory of the GPS with your new settings.
ucenter_6.jpg


Step 9
Now open a text console to see the NMEA data being reported by the GPS.
ucenter_7.jpg


Step 10
You should see only $GPZDA messages.
The $GPTXT is OK, it's the firmware messages.
ucenter_8.jpg


Step 11
How to toggle the hex display, to see the UBX codes.
Click the button at tree view bottom right.
ucenter_9.jpg


You could make a script to program these UBX codes directly from the router. Example:

/jffs/scripts/ublox7-gpzda.sh
Code:
#!/bin/sh
GPS_DEVICE=/dev/ttyACM0

# HOWTO: generate these UBX codes yourself
# download and install the u-center evaluation kit from the u-blox website
# plug in the GPS to your computer and run the u-center software
# select menu: View -> Messages View
# select tree: UBX -> CFG (Config) -> MSG (Messages)
# click a button at bottom of window until the hex display shows up

ubx_write() {
  local cmdline=" $@"
  local fmtline="${cmdline// /\\x}"
  printf $fmtline >$GPS_DEVICE
}
# configure the u-blox7 USB GPS
ubx_write "B5 62 06 02 0A 00 01 00 00 00 00 00 00 00 00 87 9A 77" # Turn off info messages
ubx_write "B5 62 06 01 08 00 F0 00 00 00 00 00 00 00 FF 23" # Disable: NMEA GxGGA
ubx_write "B5 62 06 01 08 00 F0 01 00 00 00 00 00 00 00 2A" # Disable: NMEA GxGLL
ubx_write "B5 62 06 01 08 00 F0 02 00 00 00 00 00 00 01 31" # Disable: NMEA GxGSA
ubx_write "B5 62 06 01 08 00 F0 03 00 00 00 00 00 00 02 38" # Disable: NMEA GxGSV
ubx_write "B5 62 06 01 08 00 F0 04 00 00 00 00 00 00 03 3F" # Disable: NMEA GxRMC
ubx_write "B5 62 06 01 08 00 F0 05 00 00 00 00 00 00 04 46" # Disable: NMEA GxVTG
ubx_write "B5 62 06 01 08 00 F0 06 00 00 00 00 00 00 05 4D" # Disable: NMEA GxGRS
ubx_write "B5 62 06 01 08 00 F0 07 00 00 00 00 00 00 06 54" # Disable: NMEA GxGST
ubx_write "B5 62 06 01 08 00 F0 08 01 01 01 01 01 00 0C 6F" # Enable: NMEA GxZDA
ubx_write "B5 62 06 01 08 00 F0 09 00 00 00 00 00 00 08 62" # Disable: NMEA GxGBS
ubx_write "B5 62 06 01 08 00 F0 0A 00 00 00 00 00 00 09 69" # Disable: NMEA GxDTM
ubx_write "B5 62 06 01 08 00 F0 0D 00 00 00 00 00 00 0C 7E" # Disable: NMEA GxGNS
ubx_write "B5 62 06 01 08 00 F0 0E 00 00 00 00 00 00 0D 85" # Disable: NMEA GxTHS
ubx_write "B5 62 06 01 08 00 F0 0F 00 00 00 00 00 00 0E 8C" # Disable: NMEA GxVLW
#ubx_write "B5 62 06 09 0D 00 00 00 00 00 FF FF 00 00 00 00 00 00 01 1B A9" # Save settings to BBR (battery-backed RAM)
ubx_write "B5 62 06 09 0D 00 00 00 00 00 FF FF 00 00 00 00 00 00 03 1D AB" # Save settings to BBR,Flash
 
Last edited:
Or I could chance it and run your script being as we both have the same GPS dongle :D
The script worked a treat and saved me a lot of time, I am about to install from scratch again as I somehow managed to mess it up earlier and it vanished from the tools menu!

I will be back...
 
Last edited:
So, I have installed according to the guide apart from changing ntp.conf to the example you gave on the last page and the
Code:
/sbin/modprobe cdc-acm
[ -e /dev/gps0 ] || /bin/ln -s /dev/ttyACM0 /dev/gps0
to services start.

Now do I need to run via putty
Code:
opkg update
opkg upgrade
opkg install ntpd

or should it start reporting in 20 minutes?

the dongle is returning the correct data now :)
 
.. the dongle is returning the correct data now :)
Great! Just be sure he is taken care of, "refclock 127.127.20.0 isn't supported. ntpd was compiled without refclock support"
 
Was thinking about this...

Putting together a RTC module that could interface with the UART/JTAG/I2C pins would be a nice option to keep time across reboots... might have to bang on the CFE (for Broadcom) or uBoot (others) and maybe a DT entry, but with an RTC module, and NTP, one wouldn't really need GPS, but a working GPS would allow the NTPd server to be extremely accurate, and sustainable across reboots.

Something like this -- https://www.adafruit.com/product/3295

They have a RPi specific module as well - and most of the GPS stuff above also can apply to Raspbian on the Pi... and getting GPS up and running, along with NTPd, is pretty straight forward...

Another good reason to have a Pi2 or later on the LAN to do little hotel services like this... and a Pi can also act as your SSH jump box in when remote...
 
So, I cheaped out and bought a cheap GPS receiver to play with ... trouble is, it's locked to 4800 baud, and the entware-ng stty utility is reporting the port speed as 9600. I tried setting the port speed (stty -F /dev/ttyUSB0 4800) but it said it can't do that (also tried with 'ispeed' before 4800). I've googled around a bit but can't find a way to change the port speed. Any ideas?
 
Great! Just be sure he is taken care of, "refclock 127.127.20.0 isn't supported. ntpd was compiled without refclock support"
No the refclock error is back, do I need to run
opkg install ntpd to update it or something else?
 
So, I cheaped out and bought a cheap GPS receiver to play with ... trouble is, it's locked to 4800 baud, ... Any ideas?
If your GPS receiver has a u-blox chip with flash memory, the speed may be preset with the u-center software. Otherwise, you may configure NTP to use a fixed linespeed of 4800 baud. The following ntp.conf setting will configure NTP to use the NMEA driver (#20) for GPS#0 using a linespeed of 4800 baud.
Code:
server 127.127.20.0 mode 8

It's all right here, http://doc.ntp.org/4.2.8/drivers/driver20.html
 
Last edited:
Putting together a RTC module that could interface with the UART/JTAG/I2C pins would be a nice option ...
Or, an Arduino Pro Mini with Ethernet shield and real-time clock. It is possible to fit a tiny NTP server + HTTP server + TCP/IP stack, into the Arduino Pro Mini?
 
If your GPS receiver has a u-blox chip with flash memory, the speed may be preset with the u-center software. Otherwise, you may configure NTP to use a fixed linespeed of 4800 baud. The following ntp.conf setting will configure NTP to use the NEMA driver (#20) for GPS#0 using a linespeed of 4800 baud.
Code:
server 127.127.20.0 mode 8

It's all right here, http://doc.ntp.org/4.2.8/drivers/driver20.html

Ah, yes, I should have been more clear ... I was hoping to verify the GPS was operational with the cgps utility before diving into NTP. Guess I'll have to go for broke! Sadly my chipset is SiRF Star IV. Like I said, I cheaped out. Penny-wise, pound foolish. :(

It seems to me that if NTP can change the USB-to-serial port speed, there ought to be another utility which can do the same thing. I fear changing the speed in NTP is only changing what it expects to see/use, not changing the port speed itself.
 
Or, an Arduino Pro Mini with Ethernet shield and real-time clock. It is possible to fit a tiny NTP server + HTTP server + TCP/IP stack, into the Arduino Pro Mini?

It could - a bit more work perhaps...

I like the Pi approach - as we have better connectivity options, and a more mature linux implementation - e.g.. Debian Jessie, and the ability for a full toolchain if one needs to compile code.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top