Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

80 reset watchdog on fpga reset #81

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=============
Expand Down
9 changes: 7 additions & 2 deletions src/litexcnc/firmware/watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down