RTC

The Real Time Clock (RTC) on the phyCORE-AM57x serves the basic purpose of keeping time of day, as well as providing tamper proofing for digital rights management and waking up the rest of the chip from a power down state. The RTC can keep track of the year, month, date, weekday, hour, minute, and seconds and has timer, alarm, and external event input functionality. This guide will show you how to use RTC on the phyCORE-AM57x development kit to verify functionality when power is lost. To learn more information about the phyCORE-AM57x RTC interface, please see section 4 in the Hardware Manual.

Available RTCs

RTC

Description

rtc0

External RTC populated on the SOM at U19

rtc1

Internal RTC for the AM57x SoC

rtc2

PMIC rtc populated on the SOM at U3

Accessing RTC

  • With your kit powered on and booted into Linux, the first thing to do is to check the name of the RTC device we will be using.

    Target (Linux)
    cat /sys/class/rtc/rtc0/name
    
    Expected Output
    rtc-m41t80 0-0068
    

    Note

    If the kit is not showing rtc0, the EEPROM configuration could be incorrect and need to be update. See the Using the PHYTEC EEPROM Flashtool guide for more information.

  • Use the following command to set the system time (this is an arbitrary time, but note that you have to use a time later than the build date of the kernel).

    Target (Linux)
    date 071916142022
    

    Tip

    The argument in the above command broken down is: 07-19 16:14 2022 date time year

Setting the Time

  • Assign the system time to the hardware clock:

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

    Target (Linux)
    hwclock -r -f /dev/rtc0
    

Verifying RTC

  • Now poweroff the kit and remove the power supply! Powering off the kit should be done with this command:

    Target (Linux)
    poweroff
    
  • Wait about a minute or so before powering the kit back on and booting into Linux.

  • Once booted into Linux, use this command to check the time. You should see that the clock was advanced accurately even when the board was turned off.

    Target (Linux)
    hwclock -r -f /dev/rtc0