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.

    Target (Linux)
    cat /sys/class/rtc/rtc1/name
    
    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:

    Target (Linux)
    timedatectl set-ntp false
    
  • Change the system time to an arbitrary date (I picked July 19th, 2016 at 16:14).

    Target (Linux)
    date 071916142016
    

    Note

    The argument in the above command broken down is:

    07-19 16:14 2016

    date time year

    Expected Output
    Tue Jul 19 16:14:00 UTC 2016
    
  • Assign the system time to the hardware clock.

    Target (Linux)
    hwclock -w -f /dev/rtc1
    
  • Read back the time to ensure it was set properly:

Target (Linux)
hwclock -r -f /dev/rtc1
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:

    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:

    Target (Linux)
    hwclock -r -f /dev/rtc1
    
    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:

Target (Linux)
timedatectl set-ntp true