How do MCUs handle real-time clock (RTC) functionality?
Technical Blog / Author: icDirectory / Date: Apr 06, 2024 15:04
Let%27s delve into the details of Real-Time Clocks (RTCs) in microcontrollers (MCUs):

1. What is an RTC?:
- An RTC is a specialized timer within an MCU that maintains accurate time even when the main device (such as the MCU) is powered off.
- It serves as a clock function, tracking real-world time and calendar dates.

2. Basic Function of an RTC:
- The primary purpose of an RTC is to produce intervals of one second and maintain a continuous count.
- The seconds counter runs continuously without stopping and starting.
- An RTC can also schedule events (called alarms) based on the seconds counter.

3. Hardware Features of an RTC:
- Internal Oscillator:
- An RTC often has its own internal oscillator.
- It uses an external crystal or an option for an external frequency reference (e.g., TCXO).
- All clock sources run at 32,768 Hz.
- Seconds Counter:
- The RTC typically has a 32-bit or larger seconds counter.
- Some RTCs also include specialized counters for tracking the time of day and calendar date.
- Software-Based Time and Date Tracking:
- Basic RTCs without dedicated time and date counters use software for this purpose.
- 1 Hz Square Wave Output:
- An RTC may provide a 1 Hz square wave from an output pin.
- Processor Interrupts:
- RTCs generate processor interrupts for various events.
- Dedicated Power Pin:
- RTCs often have a separate power pin.
- This allows operation even when the rest of the MCU is powered down.
- The power pin connects to a battery or separate power supply.

4. Accuracy and Frequency Compensation:
- RTC accuracy depends on the 32,768 Hz clock source.
- Well-designed crystal oscillators minimize error.
- External TCXOs provide highly accurate timing.
- Special frequency compensation techniques can enhance accuracy with less expensive crystals and the internal oscillator.

5. Applications of RTCs:
- Timekeeping: RTCs maintain accurate time for clocks, watches, and other devices.
- Alarms and Scheduling: RTCs trigger alarms or events at specific times.
- Data Logging: RTCs timestamp data records.
- Power Management: RTCs wake up the MCU from low-power modes.
- Security Tokens: RTCs generate secure timestamps for authentication.

6. Design Considerations:
- Backup Power: RTCs require a backup power source (battery or supercapacitor) to retain time during power loss.
- Calibration: Some RTCs allow calibration adjustments for better accuracy.
- Low Power: RTCs consume minimal power to extend battery life.

In summary, RTCs play a critical role in maintaining accurate time and scheduling events, even when the main MCU is powered off. Their specialized features ensure high reliability and precision¹²³.


(1) Real Time Clocks (RTCs) in Microcontroller Timers. https://www.allaboutcircuits.com/technical-articles/introduction-to-microcontroller-timers-real-time-clocks/.
(2) Introduction – Real-time Clock (RTC) – ABLIC Inc.. https://www.ablic.com/en/semicon/products/rtc/realtime-clock/intro/.
(3) Getting started with RTC - stm32mcu - STMicroelectronics. https://wiki.st.com/stm32mcu/wiki/Getting_started_with_RTC.
(4) Introduction to using the hardware real-time clock (RTC) and the tamper .... https://www.st.com/resource/en/application_note/dm00226326-using-the-hardware-realtime-clock-rtc-and-the-tamper-management-unit-tamp-with-stm32-microcontrollers-stmicroelectronics.pdf.

icDirectory Limited | https://www.icdirectory.com/b/blog/how-do-mcus-handle-real-time-clock-rtc-functionality.html
  • What are the different types of timers/counters available in MCUs?
  • Discuss the impact of cache memory on MCU performance.
  • What is the purpose of the bootloader in an MCU?
  • Explain the concept of bit-banding in ARM-based MCUs.
  • What is the role of the memory management unit (MMU) in an MCU?
  • How do MCUs handle low-power modes (sleep, standby, etc.)?
  • What is the significance of the instruction set architecture (ISA) in MCUs?
  • What are GPIO (General Purpose Input/Output) pins in an MCU?
  • How does an MCU handle analog-to-digital conversion (ADC)?
  • What is the difference between RAM and ROM in an MCU?
  • Discuss the trade-offs between power consumption and performance in MCUs.
  • What is the purpose of the watchdog timer in an MCU?
  • Explain the concept of memory-mapped I/O in MCUs.
  • What is the role of the stack pointer (SP) in an MCU?
  • Describe the function of the program counter (PC) in an MCU.
  • What is the significance of the reset circuitry in an MCU?
  • How does an MCU handle interrupts?
  • What is the difference between Harvard architecture and von Neumann architecture in MCUs?
  • What are the advantages of using an MCU in embedded systems?
  • What is the role of a memory controller in an MCU?