The Cortex-M0 is an ultra low power 32-bit ARM Cortex-M microcontroller that is optimized for battery-powered and energy-harvesting applications. By following some key design principles and utilizing the low power features of the Cortex-M0, significant battery life improvements can be achieved.
Choosing Low Power Modes
The Cortex-M0 has several low power modes that can be used to reduce power consumption when the microcontroller is idle or when peripheral activity is reduced. The main low power modes are:
- Sleep mode – Clocks are gated off to idle CPU and peripherals. Only asynchronous wake up events can exit this mode.
- Deep sleep mode – All clocks are turned off. RAM is retained. Only asynchronous wake up events can exit this mode.
- Standby mode – SRAM context is lost except for RTC registers. Lowest power mode.
Choosing the right low power mode allows optimizing the tradeoff between low power and wakeup latency. For example, sleep mode has the fastest wake up but higher power. Deep sleep saves more power but has slower wake up. Standby mode saves the most power but loses SRAM context.
Minimizing Active Mode Time
The Cortex-M0 should spend as much time in low power modes as possible. The active mode current is dominated by clock tree and signal switching power, which scales linearly with frequency. Here are some tips to minimize active mode time:
- Use the lowest possible clock frequency that meets performance needs.
- Use flash wait states if needed to attain max clock reduction.
- Quickly enter a low power mode after completing a task.
- Leverage periodic wakeups from low power modes to do work.
- Batch data processing and peripheral interactions.
- Reduce unnecessary computational overhead and polling.
Optimizing Peripherals for Low Power
The Cortex-M0 peripherals such as GPIO, timers, ADC, and communication interfaces have many low power features:
- Use peripheral clock gating to turn off unused peripherals.
- Leverage low power modes in peripherals when idle, e.g. ADC shutdown.
- Use DMA for communication and data transfer to avoid CPU overhead.
- Configure GPIO for low power based on usage scenarios.
- Use lowest bandwidth/frequency capable bus interfaces like I2C.
- Use smallest word length capable timers to count cycles.
Minimizing Static Power
Static power is consumed even when the Cortex-M0 is in sleep mode due to regulator, leaked currents and I/O pad power. Some ways to minimize static power are:
- Use the lowest voltage the application requires for operation.
- Disable the I/O pads not needed by the application.
- Use low power regulators like LDOs to supply the MCU.
- Turn off external components when not needed via control signals.
- Measure and budget static power via sleep mode current tests.
Using Low Power Libraries
Many common tasks like communication protocols and signal processing have optimized low power library implementations. Using these libraries instead of writing custom firmware can improve power efficiency:
- Use optimized math libraries for computations like FFTs or matrix math.
- Use hardware accelerated crypto libraries for security needs.
- Enable micrcontroller supplied DSP/ML libraries for signal processing.
- Select low power wireless stacks like Bluetooth LE or Zigbee.
Architecting for Low Power
Some architectural design choices can enable better low power operation:
- Pick sensors and external components with low power modes.
- Design power islands powered down by the MCU.
- Partition tasks between MCU wakeups for efficiency.
- Store data locally to avoid wireless communication.
- Use event-driven design to eliminate polling.
- Analyze task throughput needs to pick optimal MCU speed.
Measuring the power consumption with tools like oscilloscopes, DMMs, and specialized power monitors provides insights into where power is being used. This helps identify areas for improvement. Some tips for measuring power:
- Profile active, sleep, and deep sleep currents across operating scenarios.
- Estimate peripheral and task level power consumption.
- Account for energy used during mode transitions.
- Use power benchmarks to compare performance of designs.
- Monitor power during real-world use cases.
Common Techniques to Reduce Power
Here is a summary of the most effective techniques used in practice to optimize Cortex-M0 battery life:
- Clock gating – Disable unused peripherals.
- Low frequency CPU clocks – Reduce dynamic power.
- Low power modes – Use sleep/deep sleep whenever possible.
- Wakeup timers – Use timers to wake up, run task, go back to sleep.
- Event-based design – Avoid busy polling and minimize interrupts.
- Voltage scaling – Use the lowest voltage possible.
- Hardware acceleration – Use DMA, crypto modules, DSP blocks.
- Energy efficient libraries – Leverage optimized Bluetooth LE, signal processing stacks.
- Energy efficient protocols – Pick low power wireless like BLE, 802.15.4.
- Measurements – Profile power to identify issues.
Here is an example of a low power Cortex-M0 application performing periodic sensor measurements:
- MCU active time minimized using timer triggered wakeups every 5s.
- Sensor samples acquired via DMA without CPU overhead.
- Data processing done in efficient bursts every wakeup.
- BLE used in low power non-connected mode to send data.
- Unrelated peripherals and functions disabled via clock gating.
- Minimizing interrupts and eliminating polling using RTX RTOS.
- Voltage regulator provides only needed voltage to MCU.
- Current profiled during active, sleep, and run modes to improve design.
This architecture maximizes sleep time and minimizes active power resulting in significant battery life gains compared to a naive design.
The Cortex-M0 provides ample low power capabilities that can enable long battery life. By following an iterative design process of measurement, analysis and optimization across architecture, software and hardware, impressive battery life improvements can be obtained. The tips provided in this article summarize established techniques used by low power design experts to obtain single digit uA sleep currents and years of battery life.