This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4378: RTC time lost after restart

Part Number: AM4378
Other Parts Discussed in Thread: TPS65218

Tool/software: Linux

Dear,

We are working with a board broadly based on AM4378.  I am able to set time by using "date" command. It shows correct time after setting date and time. But RTC time got reset after restart the PCB. Please see my output for "dmesg | grep rtc"

root@am437x-evm:~# dmesg | grep rtc

[ 1.873604] hctosys: unable to open rtc device (rtc0)
[ 6.450044] omap_rtc 44e3e000.rtc: already running
[ 6.468476] rtc rtc0: 44e3e000.rtc: dev (253:0)
[ 6.468504] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
[ 6.468683] omap_rtc 44e3e000.rtc: does not support mux function
[ 8.570970] PM: bootloader does not support rtc-only!

How do i save RTC date and time permanently in am4378?

Regards,

Winiston.P

  • Hi Winiston,

    Refer to the below e2e thread:

    e2e.ti.com/.../670106

    Regards,
    Pavel
  • Dear,

    I have gone through the forum, But it did not solve my issue. I am using internal rtc(rtc0) with PMIC(TPS65218). But there is no driver available for TPS65218 in sdk 4.02.  Does rtc driver require for TPS65218?

    I checked the below file

    /etc/udev/rukes.d/localextra.rules

    it registered as given below.

       # The first rtc device is symlinked to /dev/rtc

       KERNEL=="rtc0", SYMLINK+="rtc"

       #The first framebuffer is symlinked to /dev/fb

       KERNEL=="fb0",  SYMLINK+="fb"

    I hope , it uses internal rtc (rtc0).  All voltages are ok it seems. CAP_VDD_RTC(1V),VDDS_RTC(1.8v), RTC_PMIC_EN (1.8v), RTC_WAKEUP is pulledup to 1.8v.

    Should i edit anything in my .dts file?  why am i getting "hctosys: unable to open rtc device (rtc0)" message  ?

    Regards,

    Winiston.P

  • Dear,

    I am waiting for your valuable reply...

    Regards,

    Winiston.P

  • Winiston,

    Do you use only AM437x internal RTC (at addr 0x44E3E000)?

    Regards,
    Pavel
  • Dear Pavel,

    Yes, I use AM4378 internal RTC (at addr 0x44E3E000).

    Regards,

    Winiston.P

  • Dear Pavel,

    I am waiting for your reply.  I use AM4378 internal RTC only (at addr 0x44E3E000).  I have not connected secondary RTC oscillator.  

    Please look at my below output.

    root@am437x-evm:~# dmesg | grep rtc

    [ 1.873604] hctosys: unable to open rtc device (rtc0)
    [ 6.450044] omap_rtc 44e3e000.rtc: already running
    [ 6.468476] rtc rtc0: 44e3e000.rtc: dev (253:0)
    [ 6.468504] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
    [ 6.468683] omap_rtc 44e3e000.rtc: does not support mux function
    [ 8.570970] PM: bootloader does not support rtc-only!

    Does OSC1 disable by default in AM4378? If, yes, How to make it enable?

    Regards,

    Winiston.P

  • Winiston,

    Do you have the below rtc node in your main DTS file?

    &rtc {

    clocks = <&clk_32k_rtc>, <&clk_32768_ck>;

    clock-names = "ext-clk", "int-clk";

    status = "okay";

    };

     

    If yes, then no other steps are required to enable OSC1. This is handled by the RTC driver:

    linux-kernel/drivers/rtc/rtc-omap.c

    rtc->clk = devm_clk_get(&pdev->dev, "ext-clk");
        if (!IS_ERR(rtc->clk))
            rtc->has_ext_clk = true;
        else
            rtc->clk = devm_clk_get(&pdev->dev, "int-clk");

    if (rtc->has_ext_clk) {
            reg = rtc_read(rtc, OMAP_RTC_OSC_REG);
            reg &= ~OMAP_RTC_OSC_OSC32K_GZ_DISABLE;
            reg |= OMAP_RTC_OSC_32KCLK_EN | OMAP_RTC_OSC_SEL_32KCLK_SRC;
            rtc_writel(rtc, OMAP_RTC_OSC_REG, reg);
        }

    You can measure with scope if you have valid and stable 32KHz signal on RTC_XTALIN pin all the time (during reset time and active time).

    Check also if you have valid and stable voltage level on RTC_KALDO_ENn pin and CAP_VDD_RTC pin, see below wiki for details:

    Regards,
    Pavel

  • Dear Pavel,

    I have below entry in my DTS file

    &rtc {

    clocks = <&clk_32k_rtc>, <&clk_32768_ck>;

    clock-names = "ext-clk", "int-clk";

    status = "okay";

    };

    I measured 32KHz signal on RTC_XTALIN. It gives 32 khz signal all the time (during reset time and active time)

    I am trying with "RTC timer functionality but no RTC-only mode"  from your link mentioned in the above mail.

    and My board voltages as given below for all the time

    CAP_VDD_RTC = 1V

    RTC_KALDO_EN= 1.8V

    RTC_PMIC_EN = no connect

    RTC_WAKEUP=VSS(ground)

    RTC_PORZ =1.8 V  (connected to "PGOOD_BU" of PMIC)

    PMIC(TPS65218) enable is connected to "VDDS_RTC(1.8v)" using  (TPS78101).  PMIC (TPS65218) is required enable signal to give all dcdc outputs.

    I tried "RTC-only mode" also as per "processor wiki" page. But it is able to set RTC .But time is over written to old time  after restarting.

    For setting date and time , i used below commands,

    date 040416122018

    hwclock -w

    hwclock -r

    How can I set RTC permanently ? Can you please comment if any mistake is there in our voltage and settings?

    Regards

    Winiston.P

  • Winiston,

    From hardware perspective, beside 1.8V continuously maintained through the PMIC, you should also check pin AE6 (RTC_PORz) is not asserted during AM437x device reset (after you stored the time information in the RTC).

    Check also the below pointers:

    processors.wiki.ti.com/.../AM335x_PSP_User's_Guide

    e2e.ti.com/.../600423
    e2e.ti.com/.../619566
    e2e.ti.com/.../463680
    e2e.ti.com/.../264867

    Regards,
    Pavel