Peter-van-Tol / LiteX-CNC

Generic CNC firmware and driver for FPGA cards which are supported by LiteX
GNU General Public License v3.0
58 stars 22 forks source link

Safety: Upcoming change in Watchdog #65

Closed Peter-van-Tol closed 10 months ago

Peter-van-Tol commented 10 months ago

Discussed in https://github.com/Peter-van-Tol/LiteX-CNC/discussions/62

Originally posted by **Peter-van-Tol** December 10, 2023 There are some upcoming changes in the watchdog, for safety reasons: - bug resolved in the driver. The signal when the watchdog has bitten was not relayed to the HAL. - if the watchdog has bit and the `has_bitten` bit is `True`, the user can reset it to `False` to resume operation. - added an physical `enable_out` pin to the watchdog. Which pin it has to be, can be chosen in the configuration (see example below). I use this pin with the HUB75HAT project. When the board is running `enable_out` is `HIGH`. When the watchdog times out (either due to communication disruption or LinuxCNC stops sending signals) the pin becomes `LOW`. On the HUB75HAT this means that all input and output will go in high-Z mode. This means the watchdog safety is completely in hardware and does not depend on LinuxCNC or the communication. Example configuration (default for HUB75HAT): ```json { "board_name": "EMCO5_SPI", "board_type": "HUB75HAT v8.0", "clock_frequency": 50000000, "connection": { "connection_type": "spi", "mosi": "spi:0", "miso": "spi:1", "clk": "spi:2", "cs_n": "spi:3" }, "watchdog": { "pin":"ena:0" }, "modules": [ ... ] } ``` Two open actions before I commit this change are: - making the physical `enable_out` pin optional; - create a working example where the watchdog is part of the E-stop latch circuit. This requires some additional components, to drive the `has_bitten` pin low before enabling the E-stop chain.
Peter-van-Tol commented 10 months ago

This issue only addresses the watchdog setting the external ENA-pin. External triggers (i.e. E-stop completely within the FPGA) will be another issue.