RTC

Peripheral Wiring

The external PCF8563 RTC is connected to the I2C interface of the expansion port. Note: Our expansion port does not include pull-up resistors. Please add them externally.

image-20241101111011769 Actual Wiring

image-20241101111421019

Driver Porting

The H618 SDK includes the PCF8563 driver by default. Detailed porting steps are omitted here.

Driver Integration

  1. Place the driver in h618-android12.0\longan\kernel\linux-5.4\drivers\rtc.

  2. Modify the Makefile:

  1. Modify the Kconfig to add:

Kernel Configuration Enable the driver in the kernel configuration:


Add RTC Node to I2C3 in Device Tree


Testing RTC Functionality

Basic Testing with date and hwclock

  1. Display current system time:

  2. If the system time is incorrect (e.g., 1970), set it manually:

  3. Display RTC hardware time:

  4. Sync system time to RTC:

  5. Verify RTC time:

  6. Wait a few seconds and check again to confirm RTC is counting.

RTC Interrupt Testing

  1. Set an alarm:

  2. Check RTC status:

  3. Verify interrupt logs (add debug prints in the driver):

Expected Results img

Interrupt Log Example img

Last updated