13-I2C3-pcf8563rtc
Last updated
Last updated
The peripheral pcf8563rtc is connected to the i2c in the expansion port
** Note: Our expansion port is not with pull, please add it in the external device. **
Actual connection
The SDK of H618 comes with pcf8563 driver port by default, which is not introduced in detail here
Drive migration Put the driver under h618-android12.0\longan\kernel\linux-5.4\drivers\rtc,
Modify the Makefile to add obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o Modified Kconfig added
Kernel enable
****【 Test whether the rtc driver works normally with date and hwclock 】 **** In general, the simplest step to test whether rtc is working properly is to load the rtc driver (or its own driver has been compiled into the kernel) :
Display the current Linux system time date
[2] If the date is also out of whack, like 1970 or something, rather than my current time, like 2009, then manually set the correct time yourself date MMDDhhmm[[[YY]YY][.ss]][.ss]
Display the hardware rtc time hwclock
Since this is the first time for the rtc driver to load, the correct time has not been set, so the time displayed at this time is mostly incorrect in 1969,1970.
Set the Linux system time to the hardware rtc hwclock -w
Check whether the hardware rtc time is the same as that in the system hwclcok
If the driver is working correctly, the time shown here should be consistent with your current system time, which is the legendary time synchronization... Otherwise, it means that your driver is not working correctly, and the system time is not correctly set into the hardware rtc, so you have to go back to debugging the driver and find the reason.
Wait a few seconds and type again: hwclock
If it is normal, you will see the time here, with the corresponding number of seconds added to the time shown in Step 5 That means the rtc is working properly.
set the alarm clock
View the rtc information
cat /proc/driver/rtc
Alarm clock time to RTC interrupt has printing (need to add yourself)
The results are as follows: