Network Time Protocol Daemon
The Network Time Protocol Daemon (ntpd) may be used to set the system time on Per Vices SDRs, using the Network Time Protocol (NTP). Both the linux software time and the hardware clock (that keeps time while the SDR is switched off) are set by ntpd. This may be useful for applications that have time based triggers or for synchronizing multiple SDRs.
For a discussion on system time, see this Application Note. For setting up an external
1. Check that ntpd is installed on your SDR
To determine if your SDR has ntpd installed, ssh into the the SDR and run the command:
$ systemctl status ntpd
If ntpd.service is not found, please email firstname.lastname@example.org so we can discuss options for getting ntpd installed on your SDR.
1.1 NTP server
Ensure that you are running an NTP server on your host machine. Note that ntpd operates as both a time server and a time reciever, as such you may use ntpd on your host machine as the server that your SDR will connect to. If you are using ntpd as the NTP server on your host machine, you can check that it is working using the instructions below for checking that ntpd is working on your SDR.
Take note of the ip address that your host machine uses as the SDR management port. You will need to know that IP address to configure ntpd. If you set up your ip addresses in the default Per Vices configuration, that IP address will be
1.2. Configure ntpd
The configuration file for ntpd is
/etc/ntp.conf. You can use vim to edit this file, but to do this you need to:
sshinto your SDR
$ ssh 192.168.10.2
rootaccess by issuing the command and entering your password:
$ sudo -i
Edit the conifguration file with vim by issuing the command:
$ vim /etc/ntp.conf
The default configuration file shows includes the line:
$ server 127.127.1.0
This is the only line that you need to change to get ntpd working. The default file tells ntpd to use the local system clock as a reference. Change the line to have the IP address of your NTP server and add the iburst option, so that synchronization occurs quickly when the SDR turns on. For example:
$ server 192.168.10.4 iburst
Ensure that ntpd is enabled by issuing the command:
$ systemctl enable ntpd
Ensure that ntpd is running this boot by issuing the command:
$ systemctl start ntpd
Note that default systemd service starts ntpd with the “panic-gate” disabled, so that the correct time is set even if the SDR’s hardware clock is more than 1000s different than the NTP server’s time.
1.3. Check that ntpd is working
Once, you have configured ntpd, check that it is working:
- Turn your SDR off, and then on again. This will help you make sure that ntpd is starting when you turn your SDR on.
sshinto your SDR
Use root access by issuing the command and entering your password.:
$ sudo -i
Issue the command:
$ /usr/sbin/ntpq -pn
to see the NTP server that your SDR is connected to. Expect to see a table that looks like:
remote refid st t when poll reach delay offset jitter ============================================================================== *192.168.10.4 220.127.116.11 2 u 25 64 37 1.052 -1.391 1.047
If you have not logged into
rootyou will see:
bash: ntpq: command not found
If ntpd is not running, instead you will see:
ntpq: read: Connection refused
In that case, enable ntpd by running the commands:
$ systemctl enable ntpd $ systemctl start ntpd
Then go back to step one, including turn your SDR off, so that you can ensure that ntpd is starting when you turn your SDR on.
Check that the IP address(es) shown in the remote column of the table matches the IP address(es) you set in
Check that one of the IP addresses shown in the remote column is marked with an asterisk (
*). The asterisk indicates that the time on your SDR is synchronized with the NTP server at that IP address.
If there is no asterisk, check the reach column of the table. If reach is 0, then your SDR cannot communicate with the NTP server. Check your network connection, and check that you entered the IP address of the NTP server correctly.
If reach less than 10, then your SDR is not communicating with your NTP server in burst mode, and synchronization may take a very long time. Confirm that your
ntp.conffile includes the instruction
iburstafter the NTP server’s IP address.
If reach is greater than 10, then your SDR is communicating with your NTP server. Wait 2 minutes before checking again to see if the asterisk has appeared to indicate successful synchronization.
You have ensured that ntpd is running properly.
2. Synchronizing time between Linux and FPGA
Ntpd will synchronize the time of the linux system running on your SDR with the NTP server that it is configured to use. However, this linux system is not the only system running inside your FGPA. The FPGA is responsible for most of the transmit and receive functions of your SDR. To synchronize the time between linux and the FPGA, we have another systemd service. The crimson-fpga-time-sync.service is responsible for issuing the command to write the time from linux to the FPGA. The crimson-fpga-time-sync.timer will keep the SDR synchronized when it is running for extended durations by periodically activating the crimson-fpga-time-sync.service. To determine if your SDR has the FPGA time synchronization service installed,
ssh into your SDR and issue the commands:
$ systemctl status crimson-fpga-time-sync.service
$ systemctl status crimson-fpga-time-sync.timer
If either crimson-fpga-time-sync.service or is not found, please email email@example.com so we can discuss options for getting ntpd installed on your SDR.
You may enable the service with the following steps:
sshinto your SDR
rootaccess by issuing the command and entering your password.:
$ sudo -i
Ensure that the service and timer are enabled by issuing the command:
$ systemctl enable crimson-fpga-time-sync.service $ systemctl enable crimson-fpga-time-sync.timer
Ensure that the service and timer are running on this boot by issuing the commands:
$ systemctl start crimson-fpga-time-sync.service $ systemctl start crimson-fpga-time-sync.timer