firmware: config-integrity check, fault injection, verified recovery ladder; soak harness
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user