EasyManua.ls Logo

Phytec i.MX 93 - Page 66

Default Icon
85 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
i.MX 93 BSP Manual PD24.1.1 Documentation Rev.: imx8mp-pd22.1.2-51-ga548be7d
current date and time (set with the date command) to the RTC using the hwclock tool and reboot the target
to check if the changes were applied to the RTC:
target:~$ hwclock -w
target:~$ reboot
.
.
.
target:~$ date
Wed Mar 2 10:34:06 UTC 2022
To set the time and date from the RTC use:
target:~$ date
Thu Jan 1 01:00:02 UTC 1970
target:~$ hwclock -s
target:~$ date
Wed Mar 2 10:45:01 UTC 2022
7.10.1 RTC Wakealarm
It is possible to issue an interrupt from the RTC to wake up the system. The format uses the Unix epoch
time, which is the number of seconds since UTC midnight on 1 January 1970. To wake up the system after
4 minutes from suspend to ram state, type:
target:~$ echo "+240" > /sys/class/rtc/rtc0/wakealarm
target:~$ echo mem > /sys/power/state
Note
Internally the wake alarm time will be rounded up to the next minute since the alarm function doesn’t
support seconds.
7.10.2 RTC Parameters
RTCs have a few abilities which can be read/set with the help of hwclock tool.
We can check RTC supported features with:
target:~$ hwclock --param-get features
The RTC parameter 0x0 is set to 0x71.
What this value means is encoded in kernel, each set bit translates to:
#define RTC_FEATURE_ALARM 0
#define RTC_FEATURE_ALARM_RES_MINUTE 1
#define RTC_FEATURE_NEED_WEEK_DAY 2
#define RTC_FEATURE_ALARM_RES_2S 3
#define RTC_FEATURE_UPDATE_INTERRUPT 4
#define RTC_FEATURE_CORRECTION 5
#define RTC_FEATURE_BACKUP_SWITCH_MODE 6
#define RTC_FEATURE_ALARM_WAKEUP_ONLY 7
#define RTC_FEATURE_CNT 8
Accessing Peripherals 62