# Device reset watchdog (locked-IP `*rst!;`) :id=top

------

> _Doc Ver:_ 1.0  
_App Ver:_ 2.6.6.53  
_Date:_ 09/14/2026

------

For integrators and the field: after SA1 **locks the data-source IP**, if that path has no task data on UDP **8190** for a while and the demodulator command port (default UDP **8193**) is **not** in a config/detect session, sa-di sends `*rst!;` **only to that locked IP**. **No lock → no send** (never broadcast a reset to the whole LAN). Watchdog is **on by default** and can be turned off.

SA1 and SA2 are **mutually exclusive** (UDP **8190**). Do not `killall -9`. After changing Watchdog, Save → `:SYS:RELOAD`. Do not run `dsp_reset.sh`.

Related: [Debug commands](debug.md) · [Mainboard control](mainboard_ctrl.md) · [Architecture](architecture.md) · [Start, check, upgrade](operate.md) · [Network reset](ip_reset.md) (panel button changes the host IP; **not** this feature)

On the device: Help → Device reset watchdog. Online: http://192.168.3.9/sa1/help/reader.html#/device-rst (public `sc.casstk.com`). The Advanced Watchdog page **Help** button opens this page (`help/#/{lang}device-rst`).

**Contents:** [Differences](#diff) · [Web on/off](#ui) · [When it fires](#when) · [Who gets it](#who) · [Settings](#cfg) · [Timing](#time) · [Dual UDP](#dual) · [Host watchdog](#host) · [Do not confuse](#not) · [Logs](#check) · [Troubleshoot](#trouble) · [Ask](#ask) · [Where](#where)

------

## 0. SA2 / legacy scripts :id=diff

| | SA1 2.6.6.44+ | SA2 / 3.x | Old SA1 scripts |
|---|---------------|-----------|-----------------|
| Who sends `*rst!;` | **sa-di** `wd.c` | **sa_daq** `udp_receiver.c` | Removed `dsp_reset.sh` / `killall` |
| Lock gate | `DI_UDP_DATA_IP_LOCK` (and UDP2 `DI_UDP_DATA_IP_LOCK2`) | Non-empty `udp.allow_ips` | None |
| Config | `/var/sa/conf/watchdog.json` (Advanced → Watchdog) | `sa_daq.conf` `[daq] udp.rst_watchdog.*` | Script path |
| Default | **On** (`WD_ENABLE` true) | **On** (`enable=true`, 60s) | Persist may still show `bash dsp_reset.sh` |
| Target | Locked **dataIp** (not factory cmdIp) | Each allow-list IP | Often broadcast or localhost |
| Reload | Save → `:SYS:RELOAD` | Hot reload | Kill process |
| Host `/dev/watchdog` | Kicked while sa-di runs; **not** tied to 8190 idle | Not this binding | Used to reboot the host on stall |

Do not follow SA2 `sa_daq.conf` steps on SA1. Do not copy `web/` or `conf/` across products.

------

## 1. Web enable / disable :id=ui

Needs **admin** (`can_operate`).

### 1.1 Lock the data-source IP first (otherwise never send)

1. Open `http://<device>/login` (try `:8080` / `:81` if port 80 fails).
2. **Setting → System → Base** (`addon.php?dir=base`) → demodulator **UDP** group.
3. Check **Lock IP** (`DI_UDP_DATA_IP_LOCK`); set **IP** (`DI_UDP_DATA_IP`) to that front-end.
4. For a second source, also lock UDP2 (`DI_UDP_DATA_IP_LOCK2`).
5. **Save**. AfterCfg `:SYS:RELOAD` should return `0`.

With lock off, the Watchdog thread still runs but **never sends `*rst!;`**.

### 1.2 Watchdog (factory on)

1. **Setting → System → Advanced** (`addon.php?dir=advanced`) → tab **Watchdog** (`watchdog.json`).
2. **Enable** (`WD_ENABLE`) is checked at the factory. Uncheck and **Save** to disable.
3. **Reset command** (`WD_PCB_RST_CMD`) is `*rst!;`. If persist still shows `bash dsp_reset.sh`, sa-di **rejects it as a command** and sends `*rst!;`. Do not put a shell line back.
4. **Save**. The page issues `:SYS:RELOAD`. Success is **`0`**. Do not `killall -9 sa-di`.
5. Page **Help** opens this document.

------

## 2. When it fires :id=when

Each UDP path is counted separately. **All** of these must hold:

| Condition | If not |
|-----------|--------|
| That path **Lock IP** is on | **No send** |
| That DAQ service is **not paused** | Pause refreshes the idle clock |
| Task counter unchanged (no new UDP **8190** work) | Data clears the trigger count |
| Not in config/detect (`AppModel`) | Deferred |
| Last **non-`*rst`** command to 8193 is older than the trigger interval | Spectrum / wavelength / `*CFG!` counts as interact |
| `WD_ENABLE` is true | Timers still run; no send |
| Consecutive idle ticks reach **Trigger count** | Wait another trigger interval |

------

## 3. Who receives it :id=who

- Only the locked **dataIp** for that path (the 8190 source). Factory **cmdIp** is ignored when dataIp is set.
- Port is **Command Port** (`DI_UDP_CMD_PORT`, default **8193**).
- **Never broadcast**.
- The payload must be SCPI: start with `*` or `:`, ≤64 chars, no `|`$<>(){}[]\"'` or control bytes. Anything else (including legacy `bash dsp_reset.sh`) falls back to `*rst!;`.

This resets the **demodulator hardware**, not the Linux host and not the NIC address.

------

## 4. Settings :id=cfg

File: `/var/sa/conf/watchdog.json` (source `conf/watchdog.json`; `conf/advanced/watchdog.json` is a symlink). Processes read the runtime tree, not git.

| ID | Pack Value | UI Default | Meaning |
|----|------------|------------|---------|
| `WD_ENABLE` | **true** | true | Master switch |
| `WD_CHK_INTVL` | 30 s | 60 s | Check loop (sleep ≈ interval/5). Also host watchdog timeout |
| `WD_TRG_INTVL` | 60 s | 120 s | One idle judgement. Forced ≥ check interval |
| `WD_TRG_COUNT` | 3 | 3 | Consecutive idle judgements before send |
| `WD_PCB_RST_CMD` | `*rst!;` | `*rst!;` | Body sent to 8193 |

Upgrade merge keeps field Values. An old box may still display `bash dsp_reset.sh`; **runtime already maps that to `*rst!;`**. Clean the page if you want the UI to match. Do not `rsync conf/` onto persist.

AfterCfg must be `:SYS:RELOAD`. No `killall`.

Power-on hardware reset uses `di.json` `DI_PCB_RST_CMD` (often `*sav!;`) — **not** this watchdog key.

------

## 5. Timing :id=time

Pack Values: trigger **60 s** × count **3** ≈ **3 minutes** of no task data before the first send (plus a few seconds of check granularity).

Older Default-style persist (120 s × 3) is about 6 minutes. Trust the Value column on the page.

After a send, the count resets; continued idle repeats on the same cadence.

------

## 6. Dual UDP :id=dual

When `dataSource` is dual UDP:

- Path 1: `DI_UDP_DATA_IP_LOCK` + service `SI_DAQ` → `udps.dataIp:cmdPort`
- Path 2: `DI_UDP_DATA_IP_LOCK2` + service `SI_DAQ_2` → `udps2.dataIp:cmdPort`

Counters are independent. Lock only one path to reset only that front-end.

------

## 7. Host `/dev/watchdog` is not device reset :id=host

While Enable is true, sa-di may open Linux `/dev/watchdog` and **kick it whenever the process is alive**. Idle 8190 only triggers device `*rst!;` — it **must not** reboot the industrial PC.

No `/dev/watchdog` node means host keep-alive is skipped; device `*rst!;` still works.

------

## 8. Do not confuse :id=not

| Feature | Where | What it does |
|---------|-------|----------------|
| **This page** | Advanced Watchdog + locked IP | Idle `*rst!;` to the locked front-end |
| **Network reset** | Panel 10 s / 25 s | Host static IP or DHCP. [Network reset](ip_reset.md) |
| **Startup PCB reset** | `di.json` `DI_PCB_RST_CMD` | Often `*sav!;` at boot |
| **Operate → Reset sensors** | Menu | Clears points, not hardware |
| **Reboot Application / Equipment** | Menu | Restarts sa-di or the box |
| **SA2 `udp.rst_watchdog`** | `sa_daq.conf` | Same intent, **other product** |

------

## 9. Logs and acceptance :id=check

```bash
printf '*VER?\n' | nc -w 2 127.0.0.1 7090
curl -sS http://127.0.0.1/api/info
pgrep -a sa-di
pgrep -a sa_daq || true
grep -E 'watchdog device rst' /var/sa/log/* 2>/dev/null | tail
```

If `*VER?` is stale after upgrade: `sudo systemctl restart sa-di`.

Checks:

1. Lock off: capture UDP 8193 — no `*rst!;` however long 8190 is idle.
2. Lock on, Watchdog on, stop the front-end: after ~3 minutes (pack Values) a unicast `*rst!;` to that IP:8193.
3. Config/detect or a non-rst command delays the send.
4. `WD_ENABLE` off → no send.
5. The host must not reboot from idle 8190.

------

## 10. Troubleshoot :id=trouble

| Symptom | Look at |
|---------|---------|
| Idle but no reset | Lock IP; source IP vs capture; Enable; pause; recent 8193 interact |
| Whole LAN resets | Legacy broadcast / second stack. This build unicasts to dataIp |
| UI still shows `dsp_reset.sh` | Persist Value; runtime already uses `*rst!;`. Save the page |
| Reset immediately after unpause | This build refreshes the clock while paused |
| JSON change ignored | Save must return `:SYS:RELOAD` `0`. No `killall -9` |
| Want to change the host IP | [Network reset](ip_reset.md), not Watchdog |
| Fighting SA2 for 8190 | Stop `sa_daq` / `sa_web` / `sa_broker` / `sa_run` |

------

## 11. Phrases for intelligent Q&A :id=ask

Open http://112.74.47.129:9999 and say this is **SA1 2.x**:

- “After locking the data IP, will idle 8190 send *rst”
- “How do I turn Watchdog off”
- “Where is WD_ENABLE”
- “Why no reset when IP is not locked”
- “Can I still use dsp_reset.sh”
- “Is device reset the same as network reset”
- “Will /dev/watchdog reboot the IPC”

Canonical steps: this page and `/help/#/device-rst`. Do not answer with SA2 `udp.allow_ips`.

------

## 12. Help entry points :id=where

Same text (source `web/help/`):

| Entry | URL |
|-------|-----|
| Device handbook (Help → Handbook) | `http://<device>/help/#/device-rst` |
| Help menu → Device reset watchdog | same |
| Advanced Watchdog **Help** | this page |
| Handbook tips (`help/tips/`) | Help → Handbook category |
| LAN | http://192.168.3.9/sa1/help/ (`reader.html#/device-rst`) |
| Internet | http://sc.casstk.com/sa1/help/ (pages only, no tars) |
| Intelligent Q&A | http://112.74.47.129:9999 (say **SA1**) |
| Portal FAQ | search 看门狗 / *rst / IP lock |
| Agent Skill | `…/sa1/install/agent/llms.txt` · `skill-ask.md` |

After editing sources: `bash scripts/sync-runtime.sh --web`. Field persist: **pages only**, never rsync `conf/`.

------

### [Top](#top)
