firmware: config-integrity check, fault injection, verified recovery ladder; soak harness

This commit is contained in:
Lars Nolden
2026-09-01 11:20:29 +02:00
parent 26fab7202a
commit e131687264
7 changed files with 191 additions and 5 deletions
+19
View File
@@ -385,6 +385,25 @@ bool sx126x_set_tx_power(int8_t dbm)
uint8_t tp[2] = {(uint8_t)dbm, 0x02}; // ramp 40 us
return cmd(OP_SET_TX_PARAMS, tp, 2);
}
// Integrity check: the sync word registers must still hold the wM-Bus
// access code. A radio that was reset, slept, or glitched loses its
// configuration while still reporting a plausible chip mode, so checking
// the mode alone cannot detect that failure.
bool sx126x_config_intact(void)
{
uint8_t v[2] = {0, 0};
if (!read_regs(REG_SYNCWORD_0, v, 2)) return false;
return v[0] == 0x54 && v[1] == 0x3D;
}
// Fault injection for exercising the recovery ladder (see console `inject`).
bool sx126x_inject_sleep(void)
{
// cold start: configuration is lost on wake
uint8_t cfg = 0x00;
return cmd(OP_SET_SLEEP, &cfg, 1);
}
bool sx126x_standby(void)
{