IT lexicon › Hardware › WFI (Wait For Interrupt)

WFI (Wait For Interrupt)

Hardware På svenska → Updated: 2026-11-04

Arm's instruction for gating the core clock until an interrupt becomes pending — the cheapest route to low power.

A microcontroller with nothing to do has no business spinning in an empty loop. WFI halts the core until an interrupt shows up; on Cortex-M the SLEEPDEEP bit in the SCB decides whether that means ordinary sleep or deep sleep with clocks switched off. It is essentially all an RTOS idle task does, and x86 has had its own version, HLT, since the 8086.

The subtle part is that a pending interrupt wakes the core even when masked by PRIMASK — it just isn't taken until the mask is lifted. That closes the classic race: disable interrupts, check for work, execute WFI, re-enable. Without the pattern, the interrupt can slip in between the check and the sleep, and the device dozes on with a flag set that nobody will look at.

← Back to the lexicon