Approved version. Approved on: 10:53, 27 January 2022
- Last edited one year ago ago
RTC overview
This article gives information about the Linux® RTC framework. The RTC framework is involved in precise time countdown.
Contents
1 Framework purpose[edit]
The RTC keeps the system time up-to-date and can wake up the system from the standby power mode at a programmed time.
A general presentation of the RTC framework is available in the Linux RTC documentation [1].
2 System overview[edit]
2.1 Component description[edit]
- RTC (hardware)
- RTC dedicated hardware block in STM32MPU product.
- rtc-stm32
- RTC ST driver.
- rtc
- Linux RTC framework, it provides API to RTC driver and interfaces to user.
- Sysfs interface
- Sysfs interface is accessible via /sys/class/rtc/rtcX/.
- Procfs interface
- Procfs interface is accessible via /proc/driver/rtc.
- Char device interface
- Device interface is accessible via /dev/rtcX.
- User application
- The user application can be a user built application or an community application such as hwclock.
2.2 API description[edit]
API is described in Linux RTC documentation [1].
3 Configuration[edit]
3.1 Kernel configuration[edit]
Activate rtc-stm32 driver in kernel configuration using the Linux Menuconfig tool: Menuconfig or how to configure kernel
Device drivers ---> -*- Real Time Clock ---> <*> STM32 RTC
3.2 Device tree configuration[edit]
Refer to the RTC device tree configuration.
4 How to use the framework[edit]
Refer to the How to use the RTC.
5 How to trace and debug the framework[edit]
5.1 How to trace[edit]
Dynamic debug traces can be added using the following command:
echo -n 'file rtc-stm32.c +p'>/sys/kernel/debug/dynamic_debug/control
6 Source code location[edit]
- rtc-stm32: drivers/rtc/rtc-stm32.c
- api: include/linux/rtc.h
- framework:
- device-tree bindings constants: include/dt-bindings/rtc/rtc-stm32.h