laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
icE1usb fw/gpsdo: If no PPS present for >= 3s, go to hold over mode

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Ia85a8bb0e146cb117ea6e2704c6a4dedf215c75a
---
M firmware/ice40-riscv/icE1usb/gpsdo.c
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/firmware/ice40-riscv/icE1usb/gpsdo.c b/firmware/ice40-riscv/icE1usb/gpsdo.c
index 573c0bb..2481c2e 100644
--- a/firmware/ice40-riscv/icE1usb/gpsdo.c
+++ b/firmware/ice40-riscv/icE1usb/gpsdo.c
@@ -15,6 +15,8 @@

#include "ice1usb_proto.h"

+#include "config.h"
+

struct {
/* Configuration */
@@ -275,6 +277,14 @@
uint32_t tick_now, tick_diff;
bool valid;

+ /* If more than 3 sec elapsed since last PPS, go to hold-over */
+ if (time_elapsed(g_gpsdo.meas.tick_prev, 3 * SYS_CLK_FREQ)) {
+ g_gpsdo.state = STATE_HOLD_OVER;
+ g_gpsdo.meas.invalid = 0;
+ g_gpsdo.meas.skip = 0;
+ return;
+ }
+
/* Get current tick and check if there was a PPS and estimate frequency */
tick_now = time_pps_read();

@@ -299,6 +309,7 @@
/* No GPS fix, go to hold-over */
g_gpsdo.state = STATE_HOLD_OVER;
g_gpsdo.meas.invalid = 0;
+ g_gpsdo.meas.skip = 0;
return;
}


To view, visit change 29610. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-e1-hardware
Gerrit-Branch: master
Gerrit-Change-Id: Ia85a8bb0e146cb117ea6e2704c6a4dedf215c75a
Gerrit-Change-Number: 29610
Gerrit-PatchSet: 1
Gerrit-Owner: tnt <tnt@246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged