RTC ==== This guide will show you how to use rtc1 on the phyCORE-i.MX8X development kit to verify functionality when power is lost. .. note:: You can verify the name of the RTC interface by checking the name file in the interface's directory. rtc1 is named after the physical IC populated on the SOM at U115. RTC Naming ------------ * Verify the RTC interface by checking the "name" file in the interface directory. .. code-block:: none :caption: Target (Linux) cat /sys/class/rtc/rtc1/name .. code-block:: none :caption: Expected Output rtc-rv3028 16-0052 * Disable NTP (Network Time Protocol) .. note:: If your i.MX8X hardware is connected to the internet then it will not allow you to manually set the date and time unless we disable automatic time sync. **Use the following command if your phyCORE-i.MX8X is connected to your local area network**: .. code-block:: none :caption: Target (Linux) timedatectl set-ntp false * Change the system time to an arbitrary date (I picked July 19th, 2016 at 16:14). .. code-block:: none :caption: Target (Linux) date 071916142016 .. note:: The argument in the above command broken down is: 07-19 16:14 2016 date time year .. code-block:: none :caption: Expected Output Tue Jul 19 16:14:00 UTC 2016 * Assign the system time to the hardware clock. .. code-block:: none :caption: Target (Linux) hwclock -w -f /dev/rtc1 * Read back the time to ensure it was set properly: .. code-block:: none :caption: Target (Linux) hwclock -r -f /dev/rtc1 .. code-block:: none :caption: Expected Output 2016-07-19 16:16:19.257955+00:00 * Power off the phyCORE-i.MX8X, disconnect it from the power supply and wait a minute or so: .. code-block:: none :caption: Target (Linux) poweroff * After the development kit has been powered off for a minute, reboot and login as root. Use the following command to verify that the phyCORE-i.MX8X has been keeping track of the time when turned off: .. code-block:: none :caption: Target (Linux) hwclock -r -f /dev/rtc1 .. code-block:: none :caption: Expected Output 2016-07-19 16:18:59.702012+00:00 .. note:: If you had to disable automatic time sync at the beginning of this guide then you will likely want to re-enable it. Use the following command to do so: .. code-block:: none :caption: Target (Linux) timedatectl set-ntp true