laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-hardware/+/21733 )
Change subject: icE1usb fw: Turn green LED off completely if no E1 signal is received ...................................................................... icE1usb fw: Turn green LED off completely if no E1 signal is received We don't really have an idea of the analog signal level and hence no true LOS detection. However, we can check the Rx clock tick counter to detect if there is at least still any kind of signal at all or not. Change-Id: Ibd23cbf1d044b46d8fed48fb97622e6ef980b99f --- M doc/manuals/chapters/firmware.adoc M firmware/ice40-riscv/icE1usb/e1.c 2 files changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1-hardware refs/changes/33/21733/1 diff --git a/doc/manuals/chapters/firmware.adoc b/doc/manuals/chapters/firmware.adoc index 254e235..798f5f4 100644 --- a/doc/manuals/chapters/firmware.adoc +++ b/doc/manuals/chapters/firmware.adoc @@ -135,6 +135,7 @@ [options="header"] |=== |Color | Pattern | Meaning +|Green | Off | E1 Receiver detects no signal |Green | Blinking (slow) | E1 Receiver attempting to align |Green | On | E1 Receiver fully aligned |=== diff --git a/firmware/ice40-riscv/icE1usb/e1.c b/firmware/ice40-riscv/icE1usb/e1.c index 9ad2798..6f85d19 100644 --- a/firmware/ice40-riscv/icE1usb/e1.c +++ b/firmware/ice40-riscv/icE1usb/e1.c @@ -16,6 +16,8 @@ #include "dma.h" #include "led.h" // FIXME +#include "misc.h" // needed to get the E1 tick for "LOS" detection + // Hardware // -------- @@ -283,6 +285,7 @@ struct e1_fifo fifo; int in_flight; enum e1_pipe_state state; + uint16_t last_tick; } rx; struct { @@ -426,8 +429,12 @@ e1_platform_led_set(0, E1P_LED_GREEN, E1P_LED_ST_ON); led_color(0, 48, 0); } else { - e1_platform_led_set(0, E1P_LED_GREEN, E1P_LED_ST_BLINK); - /* TODO: completely off if rx tick counter not incrementing */ + uint16_t cur_tick = e1_tick_read(0); + if (g_e1.rx.last_tick == cur_tick) + e1_platform_led_set(0, E1P_LED_GREEN, E1P_LED_ST_OFF); + else + e1_platform_led_set(0, E1P_LED_GREEN, E1P_LED_ST_BLINK); + g_e1.rx.last_tick = cur_tick; led_color(48, 0, 0); } -- To view, visit https://gerrit.osmocom.org/c/osmo-e1-hardware/+/21733 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1-hardware Gerrit-Branch: master Gerrit-Change-Id: Ibd23cbf1d044b46d8fed48fb97622e6ef980b99f Gerrit-Change-Number: 21733 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <lafo...@osmocom.org> Gerrit-MessageType: newchange