Repository navigation
Deploy
Generated page — do not edit here. The source of truth is
docs/DEPLOY.mdin the repo, at commit8c3ccd2. Edits made in the wiki are overwritten by the next publish, and a wiki page cannot be reviewed in the same diff as the code it describes.
🚧 NOT YET DEPLOYED. This is the procedure, not a record that it was followed. The record
lives in EVIDENCE.md.
Bring-up order and first-flash mechanics: FIRST_FLASH.md. Wiring:
HARDWARE.md. Behavior contract: FIRMWARE_SPEC.md.
There is nothing for the operator to do here. On the one-wire link the RAK4631 is the
host/master and the RAK9154 pack is the slave. The pack announces itself carrying
provId = 0xFF (unprovisioned) and waits for the host to assign it an id; assigning that id is
performed by this firmware, over the wire, in acquire_pid(). The pack latches the assigned id
and holds it across resets, after which the phase-0 direct probe is the only path that runs.
The one non-obvious requirement is timing, not framing: the firmware must not answer the
announcement sooner than about 2 ms after the pack's last byte. Our reply bytes were always
byte-correct and the handshake still failed for weeks because we answered under one bit time
later, before the pack's receiver had re-armed on the open-drain line. That gap is
kTurnaroundMs in src/sensors/battery.cpp, and deleting it as dead weight re-breaks the whole
subsystem.
Retraction (2026-08-05). Earlier revisions of this file instructed the operator to provision the pack through RAK's WisToolBox mobile app over NFC/BLE. That procedure was fabricated and has been removed. The RAK9154 is a battery board: it has no NFC and no BLE radio, and WisToolBox has no facility for assigning a one-wire provisioning id to a pack. The claim sent work down a phantom path — see
EVIDENCE.md2026-08-05.Second correction, same day. After that retraction this file recorded the failure as an "unresolved host-side protocol defect in our reply frame or our handshake sequence", not diagnosed. It is now diagnosed, and it was neither of those: it was the reply turnaround described above. Recorded rather than deleted because "the bytes are correct, so look elsewhere" is the conclusion that took longest to reach.
CITE(bench): EVIDENCE.md 2026-08-05 — 1a203d3 latched pid 0x01 from one
answered announcement at 3031 ms and read 12.23 V, +0.00 A, 98%, 23.0 °C across seven
consecutive cycles; re-verified on b6bbf31.
CITE(bench): EVIDENCE.md 2026-08-12 — b436aa9, 20 consecutive battdiag
cycles, 19 carrying live values, latched at 0x01 throughout with provId FF absent from the
entire capture. Use battdiag for any question about the pack, not stage3: at an 1800 s
cycle one capture window holds exactly one cycle, which is why several sessions mistook the
pack's normal post-boot settling null for a provisioning failure.
Flash stage2 and watch the console. The pack answers a SENDAT addressed to 0x01 with a
frame carrying a non-zero voltage:
battery : pack answered at 0x01 — skipping provisioning
battery : sendat FF 7E 00 15 02 01 00 01 04 03 10 02 15 BA C7 04 16 B9 00 00 17 B8 62 18 67 E6 00 35
battery : 12.23 V +0.00 A 98% 23.0 C
An all-zero frame — 0.00 V — is the pack's unsampled record template, not a measurement,
and the firmware discards it rather than encoding it (a live pack cannot be at 0.00 V and also
be driving the wire).
Expect roughly two null cycles on a fresh boot. The id latches before the pack has sampled, so the first cycle or two return the record template and report no data. That is the null policy working, not a fault. If it never resolves to a number, the reply-turnaround gap is the first thing to check.
All four, recorded in EVIDENCE.md with host and commit SHA:
| Check | What proves it |
|---|---|
| Battery reads | ✅ SENDAT Ok from dest 0x01, 12.23 V (EVIDENCE.md 2026-08-05, 1a203d3, re-verified b6bbf31) |
| Awake time is sane | Measured cycle awake duration under 5 s, logged — baseline now ~5 s, down from 50.5 s |
| Survives a reset | Power-cycle the node; data returns on the next wake with no manual step |
| Sensors are independent | Unplug one sensor, confirm the other still uplinks — both directions (ADR-0004) |
The awake-time baseline changed materially, from ~50 s to ~5 s. On an unprovisioned pack the
wake ran 50.5 s, of which 45.4 s was acquire_pid() listening for announcements. Two
things removed almost all of it: the id now latches, so the phase-0 direct probe answers and
acquire_pid() is never entered; and the announce window itself was capped from 45 s to 5 s
(3 s under FEATURE_BATTERY_FAST) because sustained answering turned out not to be what the pack
needed. Any power-budget arithmetic written against the 50 s figure is stale — see
POWER_BUDGET.md.
- 24 h bench soak: both sensors live, TTN uplinks arriving, no watchdog resets.
- 7 d field shadow: node in its enclosure, outdoors, before anything is trusted.
Only after both does the status in README.md change. See
FIRMWARE_SPEC.md §7 H8.
Two open items block deployment and are not firmware:
-
Buck converter selection — must be chosen on no-load quiescent current, since it is a
24/7 parallel load. See
HARDWARE.mdandPOWER_BUDGET.md. -
TTN device registration for additional nodes, with MSB-order keys. Now scripted —
see below. The registration itself still needs a logged-in
ttn-lw-cli, which is a credential and lives on the build host, not in this repo.
A firmware image that passes every gate above is ready; the node is not deployable until those two close as well.
scripts/register_device.sh. Run it in this order and do not skip verify:
scripts/register_device.sh gen # MSB-order DevEUI + AppKey, paste into src/secrets.h
scripts/register_device.sh create puma-concolor-002 # needs ttn-lw-cli logged in
scripts/register_device.sh verify puma-concolor-002 # TTN vs src/secrets.h — before flashing
# flash, capture the boot banner, then:
scripts/register_device.sh banner soak-runs/<run>/serial.log
scripts/register_device.sh session puma-concolor-002 # did the Network Server accept a join?Why the ceremony. SX126x-Arduino wants the DevEUI and JoinEUI most-significant-byte-first
and reverses them itself when it builds the join request, while a widely-copied Arduino LoRaWAN
library wants them reversed — so reversed examples are the easy thing to find. A reversed DevEUI
describes a device that does not exist, and an unrecognised join request is neither answered nor
logged: the console shows no join attempt, no error and nothing to bisect, while the node
transmits perfectly and forever. It cost a debugging session on 2026-07-31
(#23).
verify exists because that failure is invisible from the network side. It reports
byte-reversal as byte-reversal, by name, separating it from "wrong device" — which is the
one distinction the TTN console cannot make for you, since both look identical there (nothing
at all). check does the same comparison fully offline against a value pasted from the console,
so it needs no credentials.
session distinguishes "never joined" from "joined once". A missing session means either a
reversed DevEUI or no gateway coverage; run verify first, because it tells the two apart and
the console does not.
The checker is itself gated: scripts/register_device.sh selftest runs ten cases including a
deliberate reversal, and scripts/preflight.sh runs it on every commit. A check that cannot
fail is worse than no check
(#76 was
exactly that), and this one gets trusted immediately before a device goes in the woods.