Flatline

You inherited CAN bus firmware for a motor controller node. It receives commands normally, but field reports show the node goes permanently silent after electrical noise events on the bus.

When enough errors accumulate, the CAN controller enters bus-off: it stops receiving entirely and sets the BOFF flag (bit 7) in its error status register, CAN1_ESR (0x40006418). Bus-off is terminal in hardware. The controller will not receive another frame until firmware re-initializes it.

Each received frame prints one line in the form RX:0x<ID> [<payload bytes in hex>], and a successful recovery prints BUSOFF:RECOVERED on its own line between the frame received before the fault and the one received after re-initialization.

The main loop currently blocks waiting for the next frame and never checks the controller's error state, so once it goes bus-off it waits forever. Fix that gap so the node detects bus-off, re-initializes the controller, and can receive frames again after recovery.

Loading the interactive arena.