diff --git a/.gitignore b/.gitignore index d6d14bf..cd2de96 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ claude_export_*.md *.db *.db-wal *.db-shm + +# Config-block snapshots from scratch/mm_config_diff.py (device dumps, not source) +scratch/mm_config_snaps/ diff --git a/docs/micromate_protocol_reference.md b/docs/micromate_protocol_reference.md index 348ebba..a814bf0 100644 --- a/docs/micromate_protocol_reference.md +++ b/docs/micromate_protocol_reference.md @@ -346,6 +346,49 @@ certainly per-channel calibration/scale factors, by analogy with Series III's The battery reading independently corroborates: Thor's own event reports for these units print `BatteryLevel : 3.8 volts`. +**⚠ `content[6]` is a sub-second tick, not a status field (UM20147, 2026-10-15).** +Long recorded only as "NOT the hour". Read back to back it advances +**~4,020 counts/second in steps of exactly 4, wrapping at 256** — a period of +about **64 ms**, consistent with the low 6 bits of a ~1 kHz millisecond counter +scaled by 4. + +⚠ **Practical consequence: a `SUB 0x1C` block is never byte-identical to itself.** +Any check of the form "has the status block changed?" answers *yes* on every +read, roughly 15 times a second. Compare named fields, never whole blocks. +`content[9]` (seconds) is the only other byte that moves on an idle unit. + +⚠ **How this was nearly recorded wrong, because the trap is cheap to fall into.** +Sampled once per second it looks like a smooth, monotonic counter advancing +~16 per second with a 16-second wrap — a clean, plausible, entirely false +reading, because once-per-second sampling of a 64 ms counter is aliased. Twelve +consecutive samples supported it. **Measure a counter back to back before +believing any rate derived from spaced samples.** + +### The config blocks are bit-stable — which is what makes a diff loop viable + +Measured on UM20147 (`11.0BD`), four reads back to back with nothing touched: + +| block | size | bytes that moved on their own | +|---|---|---| +| `0x1A` compliance | 2,103 B | **0** | +| `0x2C` call home | 137 B | **0** | +| `0x2E` trigger | 39 B | **0** | +| `0x08` event index | 101 B | **0** | +| `0x01` device info | 163 B | **0** | +| `0x1C` monitor status | 59 B | 2 (`content[6]` tick, `content[9]` seconds) | + +Every config block held every byte still. **So the Series III method applies +directly: change exactly one setting, re-read, and any byte that moved is that +setting.** No noise floor to subtract and no repeat-sampling needed to +distinguish a field from a counter — which was the open question about whether +this approach would work at all here. + +Harness: `scratch/mm_config_diff.py` (`volatile` / `snap` / `diff`), read-only. + +⚠ The settings do **not** have to be changed from THOR. They can be changed on +the unit's own keypad, which avoids contending with anything for the modem's +single TCP session and needs no Windows VM. + **`SUB 0x2C` — call-home config.** Contains the ASCII string `RADIO RING`. Worth flagging: that is the *exact* string seen in the RV50 `ALEOS_SERIAL` debug during the BE12599 incident — diff --git a/micromate/client.py b/micromate/client.py index 67f47e3..98be3ae 100644 --- a/micromate/client.py +++ b/micromate/client.py @@ -54,7 +54,7 @@ _STATE_FLAG = 0 # 0x49: 0x00 idle, 0x02 monitoring _MS_FLAG = 1 # 0x1C: monitoring flag — test NON-ZERO _MS_DAY, _MS_MONTH, _MS_YEAR = 2, 3, slice(4, 6) -_MS_UNKNOWN_6 = 6 # ⚠ NOT the hour — see read note below +_MS_UNKNOWN_6 = 6 # ⚠ sub-second tick (~4020/s, step 4, 64 ms wrap) — NOT the hour _MS_HOUR, _MS_MIN, _MS_SEC = 7, 8, 9 _MS_BATTERY = slice(34, 36) # uint16 BE, volts × 100 _MS_MEM_TOTAL = slice(36, 40) # uint32 BE diff --git a/scratch/mm_config_diff.py b/scratch/mm_config_diff.py new file mode 100644 index 0000000..f2f7b25 --- /dev/null +++ b/scratch/mm_config_diff.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python3 +"""mm_config_diff.py — snapshot a Micromate's config blocks and diff them. + +**Read-only.** Sends only the five config reads plus POLL/SERIAL. It never +writes, never erases, never starts or stops monitoring. + +Why it exists +------------- +`docs/micromate_protocol_reference.md` has about a dozen fields read out of +`SUB 0x1A` (2,103 bytes) and *nothing* out of `0x2C`, `0x2E`, `0x08` or `0x01`. +They are fetched and undecoded. The method that mapped the Series III config +was a diff loop: change exactly one setting, re-read, see which bytes moved. +This is that loop for Series IV. + +The one thing that loop needs first +----------------------------------- +**Which bytes move on their own.** A config block read twice, thirty seconds +apart, with nothing touched, is not byte-identical — it carries a clock, a free +-memory figure and at least one counter. Diff two snapshots taken either side +of a setting change and those bytes show up alongside the real answer, and +there is no way to tell which is which from a single pair. + +So `volatile` runs first: N reads back to back, nothing changed, and every byte +that differs is recorded as noise. `diff` then reports the two sets +separately. Without that baseline a diff is suggestive; with it, it is +evidence. + +Usage +----- + # establish the noise floor FIRST -- nothing touched between reads + python3 scratch/mm_config_diff.py /dev/ttyACM0 volatile -n 4 + + # baseline, then change ONE setting on the unit's keypad, then: + python3 scratch/mm_config_diff.py /dev/ttyACM0 snap before + python3 scratch/mm_config_diff.py /dev/ttyACM0 snap after-rectime-4s + python3 scratch/mm_config_diff.py /dev/ttyACM0 diff before after-rectime-4s + +Snapshots live in `scratch/mm_config_snaps//