diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 82a68b6..1b40eca 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,7 +13,8 @@ Version 1.2.2 (upcoming) * ``driver``: * ``encoder``: counts and position of encoder can be reset (#74) - + * ``watchdog``: the watchdog is reset when the card is reset. Prevents the ``has_bitten`` message when LinuxCNC + is restarted without power-cycling the card. (#80) Version 1.2.1 ============= diff --git a/src/litexcnc/firmware/watchdog.py b/src/litexcnc/firmware/watchdog.py index e8e8e58..ed27b24 100644 --- a/src/litexcnc/firmware/watchdog.py +++ b/src/litexcnc/firmware/watchdog.py @@ -32,7 +32,8 @@ def __init__(self, enable_out, timeout=Signal(31), clock_domain="sys", default_t # Procedure of the watchdog sync = getattr(self.sync, clock_domain) sync += [ - If(self.enable, + If( + self.enable, If(self.timeout > 0, # Still some time left before freaking out self.timeout.eq(self.timeout-1), @@ -127,7 +128,11 @@ def create_from_config(cls, soc, config: 'WatchdogModuleConfig'): watchdog.enable.eq(soc.MMIO_inst.watchdog_data.storage[31]), # Watchdog output (status whether the dog has bitten) soc.MMIO_inst.watchdog_has_bitten.status.eq(watchdog.has_bitten), - soc.MMIO_inst.watchdog_has_bitten.we.eq(True) + soc.MMIO_inst.watchdog_has_bitten.we.eq(True), + If( + soc.MMIO_inst.reset.storage, + soc.MMIO_inst.watchdog_data.storage.eq(0) + ) ] return watchdog