Fault Injection & Debugging

# Seeded LoRa and sub-GHz RF packet-loss testing in CI

Inject 45 dB path fades and seeded packet errors between two LoRa nodes and verify retransmission backoff in CI.

Sub-GHz LoRaWAN and custom SX1262/SX1276/SX1280 protocols fail in the field when ACK packets drop during deep fades or drivers poll SPI while the radio BUSY pin is still high.

CircuitTwin radio scenes model time-on-air to 1 ns, Friis link budgets, BUSY-pin gating and seeded PER determinism (accuracy/radio-twins-2026-11-14.json) so two real MCU ELFs test link recovery automatically.

## Radio twin acceptance behaviors

| Behavior           | Modelled fidelity                   | Bug caught                                           |
| ------------------ | ----------------------------------- | ---------------------------------------------------- |
| Time-on-Air (ToA)  | Exact LoRa SF/BW/CR formula to 1 ns | Premature RX window close before preamble arrives    |
| BUSY pin gating    | SX1280/SX1262 command busy hold     | SPI write dropped because firmware skipped BUSY poll |
| Seeded attenuation | attenuation\_db fault at fixed ms   | Infinite retry loop or missed ADR backoff            |

## Local CLI workflow

Shell - run two-node LoRa fade test

```
ct test run --json --junit results/lora.xml tests/lora-fade.suite.yaml
```

## Suite & fault configuration

tests/lora-fade.suite.yaml

```
version: 1
scene: scenes/sx1276-two-node.scene.json
tests:
  - name: lora-45db-fade-retransmit
    seed: 42
    timeout_ms: 6000
    faults:
      - at_ms: 400
        link: rf0
        kind: attenuation_db
        delta_db: 45.0
        duration_ms: 1000
    expect:
      console_contains: "RETRANSMIT_ACK_OK"
      exit_code: 0
```

## CI pipeline integration

.github/workflows/lora-ci.yml

```
name: LoRa Link Recovery CI
on: [push, pull_request]
jobs:
  lora:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: circuittwin/action@v1
        with:
          suite: tests/lora-fade.suite.yaml
```

## Troubleshooting checklist

| Symptom                             | Fix                                                                                           |
| ----------------------------------- | --------------------------------------------------------------------------------------------- |
| SX1280/SX1262 ignores SetTx command | Wait for the BUSY pin to go low before asserting NSS on every opcode transaction.             |
| RX node never triggers RxDone IRQ   | Verify both nodes configure matching sync word, spreading factor, bandwidth and IQ inversion. |

## Frequently asked questions

| Question                                                                   | Answer                                                                                                                                                                 |
| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Which radio transceivers have published acceptance records in CircuitTwin? | Semtech SX1276 and SX1280 have published clean-tree radio-twin acceptance records under /docs/accuracy, alongside corpus definitions for SX1262, CC1101 and nRF24L01+. |

## Related boards & component twins

[Board: nucleo-l476rg](https://circuittwin.ai/boards/nucleo-l476rg) [Board: nucleo-h743zi2](https://circuittwin.ai/boards/nucleo-h743zi2) [Board: nrf52840-dk](https://circuittwin.ai/boards/nrf52840-dk) [Board: nucleo-wl55jc](https://circuittwin.ai/boards/nucleo-wl55jc) [Twin: SX1276](https://circuittwin.ai/twins/sx1276) [Twin: SX1280](https://circuittwin.ai/twins/sx1280) [Twin: SX1262](https://circuittwin.ai/twins/sx1262) [Twin: CC1101](https://circuittwin.ai/twins/cc1101) [SX1276 radio twin](https://circuittwin.ai/twins/sx1276)

## More in Fault Injection & Debugging

[I2C NACK and stuck-bus fault injection in CI](https://circuittwin.ai/guides/i2c-nack-fault-injection) [SPI bus fault testing and chip-select verification](https://circuittwin.ai/guides/spi-bus-fault-testing) [Debugging UART baud mismatches and framing errors](https://circuittwin.ai/guides/uart-baud-mismatch-debugging) [Cortex-M HardFault triage in CI and reverse GDB](https://circuittwin.ai/guides/cortex-m-hardfault-ci-triage)

> ## Run this workflow on your own ELF
>
> Start free on CircuitTwin to run local board twins, fault matrices and CI checks with zero per-run credits.
>
> [Start now](https://app.circuittwin.ai/try) [Read the quickstart](https://circuittwin.ai/docs/quickstart) [Connect a coding agent](https://circuittwin.ai/docs/agents)
