Home / Learn Embedded C / Clock-Gating Unused Peripherals

Clock-Gating Unused Peripherals

Disabling the clock to peripherals the program is not currently using, to save active-mode power.

Bottom lineDisabling the clock to peripherals the program is not currently using, to save active-mode power.

Breaking it down

What it is

Clock-gating means explicitly disabling the clock signal to a peripheral that is not currently in use (the reverse of the clock-enable step from the Memory-Mapped I/O group), directly reducing active-mode power draw since unclocked logic consumes far less power.

Why it matters

Many peripherals draw meaningful current even when "idle" as long as their clock keeps running — a project using only a few of a chip's many available peripherals can save real power by explicitly disabling clocks to everything else.

Mechanically speaking

This is a deliberate, opposite-direction application of the same clock-enable/disable registers covered when bringing a peripheral up — disabling an unused peripheral's clock is just as valid and often forgotten.

Shows up in

  • Active-mode power optimization
  • Peripheral power budgeting
  • Battery life improvement

Try it

Gating clocks to every peripheral except the ones actually in useC: edit and run

Only the 2 peripherals actually used by this project keep their clocks enabled; everything else is explicitly gated off to save active-mode power.

Try it: re-gating a peripheral's clock once its task finishes

Enabling a peripheral's clock only for the duration its work actually needs itC: edit and run

Clock-gating is not just a one-time startup decision — toggling a peripheral's clock on only while it is actually needed saves additional active-mode power over leaving it always enabled.

Check yourself

1. What is the direct power benefit of clock-gating an unused peripheral?