{"docs":[{"id":146,"title":"Low-Power Firmware: Sleep Modes, Clocks and Wake Sources","heading":"Low-Power Firmware: Sleep Modes, Clocks and Wake Sources","subheading":null,"category":"Firmware","body":{"root":{"type":"root","children":[{"type":"heading","tag":"h3","version":1,"children":[{"type":"text","text":"Choosing a sleep mode","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Each deeper mode turns off more of the chip and takes longer to wake. Light sleep stops only the core clock and wakes almost immediately on any interrupt. Deeper stop modes turn off the high-speed clocks but keep RAM, waking on a timer, a pin or selected peripherals. The deepest modes lose most state and restart much like a reset. Pick the deepest mode whose wake time and sources meet the requirement.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Restoring clocks is a common oversight. Many parts wake from deep sleep running on an internal oscillator, so firmware must restart the PLL or external crystal before timing-sensitive work, and allow for its start-up time.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"tags":"Firmware, Low Power, Microcontrollers","cardCta":{"label":null,"link":null},"pageCta":{"label":"Talk to AAVICO engineering","link":"/contact"},"excerpt":"Hardware sets the lowest current a device can reach, and firmware decides whether it gets there. Sleep modes, clock control and wake sources are where the savings are made.","featuredImage":null,"type":"Blog","readTime":"3 min read","publishedAt":"2026-11-15T20:05:00.000Z","heroImage":null,"introText":"A modern low-power microcontroller can sleep at a few microamps or less, but only if the firmware puts it there and keeps it there. A single floating pin, a peripheral clock left running or a busy-wait delay can raise the average current several times over. This article covers the firmware techniques that turn a datasheet sleep figure into one measured on the product.","metrics":[{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-metric-1","value":"WFI","label":"The Cortex-M wait-for-interrupt instruction, which stops the core until an interrupt arrives.","icon":null},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-metric-2","value":"SLEEPDEEP","label":"A bit in the Cortex-M System Control Register that turns WFI into a deep sleep.","icon":null},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-metric-3","value":"C x V² x f","label":"Dynamic power scales with switched capacitance, supply voltage squared and clock frequency.","icon":null},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-metric-4","value":"Tickless","label":"An RTOS idle mode that stops the periodic tick so the core can sleep between events.","icon":null}],"gallery":[],"challenge":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Datasheet sleep currents assume everything is configured for minimum consumption. On a real board, an input pin left floating can sit near mid-rail, where its input buffer draws current, and a peripheral left clocked keeps part of the chip awake. Either can exceed the sleep current of the core itself.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Firmware structure matters as much. Polling loops, counting-loop delays and an RTOS tick every millisecond all keep the core awake with nothing to do.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"blockquote":{"quote":"Wake only to work. The rest of the time belongs to the deepest sleep mode that can still respond in time.","author":"","role":"AAVICO Engineering"},"supportImage1":null,"deliverables":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Configure every unused pin to a defined, low-leakage state and disable the clock to every peripheral that is not in use.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Make the firmware event-driven: replace polling and busy-wait delays with interrupts, timers and DMA, and enable tickless idle if an RTOS is used.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Measure each mode on real hardware and compare it with the datasheet to find leaks.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"results":[{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-result-1","title":"Datasheet Currents","description":"Measured sleep current approaches what the part can achieve."},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-result-2","title":"Longer Life","description":"Lower average current extends battery life without changing the hardware."},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-result-3","title":"Fast Response","description":"Wake sources are chosen so the device still reacts in time."},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-result-4","title":"Fewer Surprises","description":"Leaks are found on the bench rather than in returned units."}],"lookingAhead":{"root":{"type":"root","children":[{"type":"paragraph","version":1,"children":[{"type":"text","text":"Compare running fast and sleeping sooner against running slowly. Dynamic power falls with clock frequency, but static current flows for longer, so the better choice depends on the part.","version":1}]},{"type":"paragraph","version":1,"children":[{"type":"text","text":"Check external parts too: pull-ups held low, sensors left powered or a regulator with high quiescent current can outweigh the microcontroller.","version":1}]}],"direction":"ltr","format":"","indent":0,"version":1}},"supportImage2":null,"testimonial":{"quote":null,"author":null,"role":null,"photo":null},"challengesSolved":[{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-challenge-1","title":"Floating inputs drawing current in sleep","description":null,"icon":null},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-challenge-2","title":"Peripheral clocks left running","description":null,"icon":null},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-challenge-3","title":"An RTOS tick waking the core every millisecond","description":null,"icon":null},{"id":"low-power-firmware-sleep-modes-clocks-and-wake-s-challenge-4","title":"Timing errors after waking on the wrong clock","description":null,"icon":null}],"relatedPosts":[],"contactUs":{"show":true},"updatedAt":"2026-11-15T17:32:32.682Z","createdAt":"2026-11-15T17:32:32.682Z"}],"hasNextPage":false,"hasPrevPage":false,"limit":10,"nextPage":null,"page":1,"pagingCounter":1,"prevPage":null,"totalDocs":1,"totalPages":1}