Skip to content

Tracking: hw hardware-report command — state and handoff #10

Open

Description

@ptr727

Living state for the hw work. Updated as it progresses; read this first when picking the task back up.

Current state

PR #1 (work/hw-cli → dev) — the single iteration branch. Everything lands here; clean upstream branches get cherry-picked out later.

Review loop: 7 rounds driven to zero unresolved threads, every suppressed finding answered in the PR conversation. 15 findings total, all judged against the code — 14 fixed, 1 declined with evidence.

What hw does

Reports what the firmware is and what hardware it actually found, on a stock release build where every MESH_DEBUG_* call is compiled away.

hw            summary
hw board      board target, SoC, Zephyr + firmware version, role, bootloader, reset cause, device id
hw rtc        declared RTC candidates and the boot probe outcome for each
hw i2c        devicetree-declared I2C inventory (no bus traffic)
hw i2c scan   live 0x08-0x77 bus scan, naming declared addresses
hw gps        GNSS driver, transport and wiring
hw sensors    sensor availability and channels
hw all        every section

Because ZephCore's companion routes through CommonCLI rather than carrying its own command table, one implementation reaches all four roles.

Validation

Path Status
nRF52 repeater, local USB serial validated on hardware
nRF52 repeater, remote admin over the mesh validated on hardware
ESP32-S3 companion, app CLI validated on hardware
rak4631 / rak4631 companion / seeed_lr2021_evk / native_sim / heltec_v4_r8 builds clean

Cost on a rak4631 repeater build: +4.2 KB flash, +0 B RAM.

The two transports truncate at different points, which is the point of the CLI_REPLY_SIZE (256) / CLI_REMOTE_REPLY_SIZE (161) split: the same hw i2c pages at 5 entries locally and 2 remotely, and hw i2c 3 resumes continuously.

Spun out as separate issues

Each is independent of hw by design and cherry-pickable on its own:

Design decisions, settled — do not re-litigate

  1. Named hw, not hwinfo — <zephyr/drivers/hwinfo.h> is a Zephyr subsystem this tree already uses.
  2. hw i2c and hw i2c scan answer different questions and say which. A devicetree enumeration cannot see an undeclared chip; a scan sees the wire but knows no names.
  3. Zephyr extras folded in — reset cause and device id, which the Arduino version cannot produce.
  4. The report never infers. GNSS model comes from the bound driver, not the overlay comment; a board declaring no RTC says exactly that; an unreached probe candidate is unprobed, not absent.

Environment notes

  • Toolchain: west via uv, Zephyr 4.4.2, ARM and Xtensa SDK (west sdk install -t xtensa-espressif_esp32s3_zephyr-elf), west blobs fetch hal_espressif, esptool>=5.0.2 in the venv.
  • Flashing ZephCore changes a board's USB identity. nRF52: 239a:8029 → 2fe3:0004. ESP32-S3: 303a:1001 → 2fe3:0006. Each needs its own usbipd bind + attach --auto-attach (Windows admin). Bootloader identities are unchanged, so the flash loop keeps working even while the running firmware is unreachable.
  • Reflashing ESP32 once ZephCore is running needs cli "start dfu" first — esptool cannot reset it, because the port is the application's CDC rather than the ROM's.
  • A fresh node is loud: 869.618 MHz at 22 dBm with an advert 10 s after boot, repeat on. Build first-boot images with safe defaults rather than racing that window. The frequency default lives in initNodePrefs() for repeater/room-server and in LoRaConfig::FREQ_HZ for the companion — patching the wrong one silently does nothing.

Activity

  1. ptr727 commented on Sep 18, 2026

    @ptr727
    OwnerAuthor

    State at 50aa8b6

    Review loop: 9 rounds, 18 findings, 17 fixed, 1 declined with evidence. Zero unresolved threads; every suppressed finding answered in the PR conversation.

    Commits on work/hw-cli

    Commit What
    1ae9d2a RTC discovery accessors
    2f5873e Reset-cause capture (#2)
    e6a61a3 The hw command
    06207ab Docs
    6c3f0b1 R1: three reports claiming more than known
    439277d 912670b R2: cover every I2C bus; usage-string contract
    786b1a5 d84acfb R3: empty-scan wording; RAK4631 RTC descriptors (#4)
    05c9c6b R4: reset per-candidate probe state
    1820b90 Hardware-found formatting defects
    b86ec0f R6: bus name derivation
    8dd7a83 Heltec V4-R8 board (#5)
    aecbc42 Companion reply truncation marker (#3)
    96bbb83 R7: bound resume marker, validate snprintfs, board identity
    a897450 R8: stale V4.3 headers, docs divergence
    50aa8b6 R9: summary claimed an unestablished fact; paging bounds

    Validation

    Path Status
    nRF52 repeater, local USB serial validated, re-confirmed at 50aa8b6
    nRF52 repeater, remote admin over mesh validated (161-byte cap, resume)
    ESP32-S3 companion, app CLI validated
    rak4631 / rak4631 companion / seeed_lr2021_evk / native_sim / heltec_v4_r8 build clean

    Cost: +4.2 KB flash, +0 B RAM on a rak4631 repeater build.

    Recurring failure mode, recorded because it recurred

    Three separate findings were the same mistake: the report asserting something the firmware had not established — a not-ready I2C bus recorded as ABSENT, an unconditional generic NMEA model line, and the summary printing rtc none present when discovery had not run. Each was in code written immediately after arguing the opposite principle in a commit message.

    The three-valued RTC outcome then justified itself on hardware: the same board reports 0x32 absent when the RTC holds no time and 0x32 unprobed when it does, because discovery returns early in the second case. A two-valued design would have said absent for a run that never looked.

    Still open

    #6 (first CLI command after port open), #7 (ZephyrBoard reset-reason abstraction), #8 (resolved — no ZephCore change), #9 (note only).

  2. ptr727 commented on Sep 18, 2026

    @ptr727
    OwnerAuthor

    Green at 22b0f38 — review loop complete

    13 rounds, 21 findings, 20 fixed, 1 declined with evidence. Round 13 raised nothing against the current head.

    head=22b0f38c  review_on_head=yes  coverage=full  shapes=ok
    unresolved=0  suppressed on_head=0  checks=1/1  merge=CLEAN
    

    Not merged. The merge gate's last condition is explicit maintainer permission, which has not been given and is not mine to assume.

    Final commits on work/hw-cli

    Rounds 10-12 added: docs coverage contradiction (7f93422), page-index ceiling matching its own comment (f1130d4), and a scan that could drop a present chip (22b0f38).

    That last one is worth flagging for whoever reviews this: section_i2c_scan()'s retry path had no else, so an address that would not fit even after a line flush was dropped while found++ had already counted it — under a comment of mine saying that is the one thing a scan must never do. Unreachable on any board in this tree (longest real token is 23 characters into a 128-byte line), which is why it survived twelve rounds and hardware testing on two boards. Now restructured so the guarantee is a property of the shape rather than of handling a third case.

    I had recommended stopping after round 11 on the grounds that the loop looked like it was only finding churn in its own repairs. That was wrong, and round 12 was the counterexample. The findings that survive longest are exactly the ones ordinary inputs never reach, so judging remaining risk by the size of recent findings is not safe.

    Next, when you want it

    Cherry-pick #2, #3, #4 and #5 onto clean single-purpose branches for upstream PRs. Each was written to stand alone and none depends on hw. #6 and #7 remain open and unstarted; #8 resolved with no ZephCore change; #9 is a note only.

  3. ptr727 commented on Sep 18, 2026

    @ptr727
    OwnerAuthor

    Protocol correction + a defect found while prepping the cherry-picks

    PR #1 stays open. It is the working branch; upstream only ever sees the clean branches cherry-picked out of it. My earlier note said "ready for your review, merge is yours" — that was the wrong frame. Nothing here gets merged.

    A defect the review loop could not have caught

    While mapping commits to branches I found that two files came back from my edits with their line endings rewritten:

    File What happened Real change
    boards/nrf52840/rak4631/board.overlay 218 CRLF lines → LF 18 lines
    docs/Repeater_CLI_commands.md 3 stray CRLF rows → LF 81 lines

    Harmless on this branch and fatal to a contribution: the RAK4631 overlay diff read as 236 insertions / 218 deletions for an 18-line addition. Nobody can review that, and no upstream maintainer should be asked to.

    Fixed in fe9b346. Both files now carry exactly what upstream/dev has — the overlay CRLF throughout, the docs file LF apart from the same three get cad.* rows that were already CRLF. Both diffs are now pure additions, zero deletions.

    Two things worth carrying forward:

    • The review bot cannot find this. It reads the diff it is handed and has no reason to question its size. Thirteen rounds went past a whole-file rewrite without comment. Compare git show --stat against git show -w --stat; a large gap is whitespace churn.
    • file(1) is the wrong instrument. It reported "with CRLF line terminators" for a file with 3 CRLF lines out of 404, which sent me to fix the wrong thing first — I converted all 485 lines to CRLF and made that diff worse before measuring properly. Count \r\n against \n.

    Re-check after every cherry-pick or squash, since a rewrite can reintroduce it.

    Branch mapping for the clean PRs

    Issue Source Notes
    #2 reset cause 2f5873e single commit, clean
    #3 companion reply truncation aecbc42 single commit, clean
    #4 RAK4631 RTC descriptors d84acfb single commit, clean
    #5 Heltec V4-R8 board 8dd7a83 + R8 hunks of 96bbb83, a897450 mixed — assemble by path, not by cherry-picking whole commits
    hw command 1ae9d2a, e6a61a3, 06207ab + review rounds 1ae9d2a (RTC accessors) is a prerequisite
  4. ptr727 commented on Oct 2, 2026

    @ptr727
    OwnerAuthor

    State for this work now lives in the handoff chain on track hw-cli, starting at #22 (2026-10-02). This issue is left as the earlier record; #22 lists what changed since: dev merged into #1 and #16, the hw CLI ported and reviewed, and the RAK4631 RTC change narrowed to the RV3028 (see the correction on #4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions