Skip to content

RTC drift correction and peripheral clock gating #84

Description

@Moaaz-i

Description

Several enhancements could significantly optimize power consumption and provide developers with more granular control over the MCU's low-power states:

  1. Peripheral Clock Gating / Power Domain Control

    • Problem: When the MCU enters sleep/deep sleep, some internal peripherals (like ADC, SERCOM, or USB) might remain clocked or enabled, drawing unnecessary current.
    • Improvement: Introduce functions to automatically disable specific peripherals before entering sleep modes and re-enable them upon waking up (e.g., LowPower.disablePeripheral(ADC);).
  2. RTC Drift Correction during Long Sleep Cycles

    • Problem: The internal RTC (Real-Time Clock) used for timed wake-ups can drift over long periods or vary based on temperature.
    • Improvement: Add an optional calibration API or a built-in compensation mechanism to maintain high timing accuracy during extended sleep intervals.
  3. External Interrupt Control with Pull-up/Pull-down Customization

    • Problem: Floating pins or improperly configured internal resistors during sleep can cause leaked current or false wake-up triggers.
    • Improvement: Provide a dedicated API to automatically configure the pin state (Pull-up, Pull-down, or High-Impedance/Floating) specifically for the duration of the sleep mode.
  4. Dynamic Clock Scaling

    • Problem: Sometimes the MCU doesn't need to sleep completely, but just needs to run slower to save power while executing minor tasks.
    • Improvement: Add support for dynamic frequency scaling to lower the CPU clock speed (e.g., from 48MHz down to 32kHz or 4MHz) during low-computational phases without entering a full sleep state.

Impact

These optimizations will allow developers to reach the absolute lowest possible micro-ampere ($\mu\text{A}$) current draw specified in the SAMD21 datasheet, greatly extending battery life for remote IoT deployments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions