HOME
  • GM-3568JHF
  • M4-R1
  • M5-R1
  • SC-3568HA
  • M-K1HSE
  • CF-NRS1
  • CF-CRA2
  • 1684XB-32T
  • 1684X-416T
  • C-3568BQ
  • C-3588LQ
  • GC-3568JBAF
  • C-K1BA
Shop
  • English
  • 简体中文
HOME
  • GM-3568JHF
  • M4-R1
  • M5-R1
  • SC-3568HA
  • M-K1HSE
  • CF-NRS1
  • CF-CRA2
  • 1684XB-32T
  • 1684X-416T
  • C-3568BQ
  • C-3588LQ
  • GC-3568JBAF
  • C-K1BA
Shop
  • English
  • 简体中文
  • GM-3568JHF

    • 1. Introduction

      • GM-3568JHF Introduction
    • 2. Quick Start

      • 01 Environment Construction
      • 02 Compilation Instructions
      • 03 Burning Guide
      • 04 Debugging Tools
      • 05 Software Update
      • 06 View information
      • 07 Test Command
      • 08 Application Compilation
      • 09 Source code acquisition
    • 3. Peripherals and Interfaces

      • USB
      • Display and touch
      • Ethernet
      • WIFI
      • Bluetooth
      • TF-Card
      • Audio
      • Serial Port
      • CAN
      • RTC
    • 4. Application Development

      • 01 UART read and write case
      • 02 Key detection case
      • 03 LED light flashing case
      • 04 MIPI screen detection case
      • 05 Read USB device information example
      • 06 FAN Detection Case
      • 07 FPGA FSPI Communication Case
      • 08 FPGA DMA read and write case
      • 09 GPS debugging case
      • 10 Ethernet Test Cases
      • 11 RS485 reading and writing examples
      • 12 FPGA IIC read and write examples
      • 13 PN532 NFC card reader case
      • 14 TF card reading and writing case
    • 5. QT Development

      • 01 ARM64 cross compiler environment construction
      • 02 QT program added automatic startup service
    • 6. Others

      • 01 Modification of the root directory file system
      • 02 System auto-start service

RTC

RTC stands for Real Time Clock. It is a hardware device specially used to record time. It can usually be integrated into the soc, or selected as an external plug-in to communicate with it through i2c.

So why do we need RTC? Because the Linux system time (also known as wall time) can only be used when the system is running. The time is lost when the system is shut down. RTC can continue to work after the system is shut down, relying on an external battery or other supply, thus saving the time.

Use of RTC

The development board uses an external RTC (hym8563), and the RTC function of rk809 is turned off by default.

When using an external RTC, a button battery is required

RTC

RTC user interface call

Linux provides three user space calling interfaces. The corresponding paths in the board are:

  • SYSFS interface: /sys/class/rtc/rtc0/

  • PROCFS interface: /proc/driver/rtc

  • IOCTL interface: /dev/rtc0

SYSFS Interface

cat proc/driver/rtc
rtc_time        : 02:01:53
rtc_date        : 2025-02-21
alrm_time       : 00:00:00
alrm_date       : 1970-01-01
alarm_IRQ       : no
alrm_pending    : no
update IRQ enabled      : no
periodic IRQ enabled    : no
periodic IRQ frequency  : 1
max user IRQ frequency  : 64
24hr            : yes

PROCFS Interface

cat /proc/driver/rtc
rtc_time        : 09:50:05
rtc_date        : 2024-10-21
alrm_time       : 00:00:00
alrm_date       : 1970-01-01
alarm_IRQ       : no
alrm_pending    : no
update IRQ enabled      : no
periodic IRQ enabled    : no
periodic IRQ frequency  : 1
max user IRQ frequency  : 64
24hr            : yes

IOCTL Interface

See the kernel documentation for an example: kernel/tools/testing/selftests/timers/rtcpie.c

Commonly used commands

date          //修改系统时钟,具体命令使用可以man下
hwclock -s    //将硬件时间同步到系统时间
hwclock -w    //将系统时间同步到硬件时间
timedatectl   //显示系统时间等

#以下手动设置时间或者网络同步时间后,-w将系统时间写入到硬件rtc,-s再将rtc时间写回系统,这样每次重启板卡都会进行rtc时间同步到系统时间。
sudo date -s "2025-02-14 08:00:00"  //手动设置时间
sudo  hwclock -w     //系统时间同步到硬件rtc
sudo  hwclock -s    //硬件rtc同步到系统
Edit this page on GitHub
Last Updated:
Contributors: zsl, zwhuang
Prev
CAN