mtnshack (Customer) asked a question.

Real-time Clock Leaping

Does anyone have problems keeping the CLICK RTC on time? Mine is falling behind several seconds a day.

I've plotted the RTC against universal coordinated time. It turns out that the clock oscillator is about right, and nowhere near slow enough to fall behind several seconds a day. The fact is that the clock falls behind because a second is repeated twice, which happens anywhere from once every 3 hours to 7 hours. It also once skipped a second. The graph below shows the seconds difference between the RTC and universal coordinated time, over a day.

CLICK RTC offset from UTCYou can see a slight upward trend in the flat areas. It means the RTC second hand is actually moving a little bit faster than UTC. If you take out the 1s steps, so that the line becomes a smooth ramp, then the clock only gains 1/4 of a second over the whole 25 hours.

 

What could be causing the second to leap around?

 

Details of the Setup

CLICK C0-12DD1E-2-D, firmware v2.60

The ladder program is running at a fixed/scheduled scan rate of 100 ms.

The ladder program does read the RTC, but it never writes. The RTC registers are read by math functions and by comparison logic.

A HMI reads a dozen or so registers on the CLICK via Modbus/TCP/IP every second. The RTC registers are also read by the HMI.

 


Newbie likes this.
  • ADC_HMI_PE (AutomationDirect)

    The specification for the RTC in the CLICK C0-1x series is a possible drift of 100s per month.

     

    Additionally, the cycle for updating RTC data to the SD register is 1s. Therefore, there is an error of 1s ± 1s in the timing of the display of data in the SD Register.

     

    Selected as Best
  • ADC_HMI_PE (AutomationDirect)

    I am curious to see what others say they have seen.

     

    I will check with the manufacturer and developers and see what they think.

     

    I know the C-more EA9 has an internal specification for the Clock/Calendar that says "Monthly deviation 60 seconds". CLICK is not an HMI and they use totally different processors and OS. I have not been able to find this specification for the CLICK.

     

    Stay Tuned.

     

    Expand Post
    • ADC_HMI_PE (AutomationDirect)

      The specification for the RTC in the CLICK C0-1x series is a possible drift of 100s per month.

       

      Additionally, the cycle for updating RTC data to the SD register is 1s. Therefore, there is an error of 1s ± 1s in the timing of the display of data in the SD Register.

       

      Selected as Best
      • mtnshack (Customer)

        Wow, that's 3 seconds a day, just like what I measured. A $35 Mickey Mouse wrist watch is seven times more accurate! See: The Accuracy and Stability of Quartz Watches, Michael Lombardi.

         

        But surely the clock doesn't have to be so inaccurate, does it? The hardware RTC is built into the microcontroller chip. In my CLICK the MCU is a STM32F427ZIT6. Judging from the STM32F42xxx series documentation, the RTC can be accurate, having a digital calibration feature. Or maybe the hardware RTC is accurate within a few hundred ms a day, and there is something wrong with the way the firmware handles it. Anyways, I'm drifting into guessing territory now.

         

        I'd like to see the CLICK RTC do better, say, 300 milliseconds per day. That's within the capability of a wrist watch. If they really want to make it good, give the customer access to the clock calibration value, so we can compensate for different temperatures and crystal aging.

         

        Sure, they added a NTP client to the CLICK+. I'm writing software that uses NTP to hack around the time problem with my CLICK. But NTP was designed to primarily make adjustments to the clock calibration, not forcefully re-set the time every so often.

        Expand Post
      • mtnshack (Customer)

        P.S.

        "Additionally, the cycle for updating RTC data to the SD register is 1s. Therefore, there is an error of 1s ± 1s in the timing of the display of data in the SD Register."

        Ah, then maybe I'm wrong about the RTC second hand and the RTC oscillator. Maybe the reason the accuracy of each second is better than the actual time accuracy is because the update rate is based on a different clock, and not the hardware RTC.

        Expand Post
      • ADC_HMI_PE (AutomationDirect)

        I agree, it seems like it could be more accurate. But I do not know how they are using this in the firmware and why the time can move that much. Other devices we have are similar. For example the C-more panels and DirectLogic both have a maximum of 60 seconds per month.

  • Garry (Customer)

    Hi @mtnshack (Customer)​,

    The accuracy of the RTC on the click is +/- 60 seconds per month. This is listed as the maximum. Typically I have seen +/- 15 to 30 seconds per month.

    Click Plus now has a Network Time Service. (NTP (Network Time Protocol) or SNTP (Simple Network Time Protocol)) This synchronizes the date and time on the PLC with a network-based time service. This could be a public time server on the internet or a time server on your local network.

    Regards,

    Garry

    https://accautomation.ca/click-plc-real-time-clock/

    https://accautomation.ca/click-plus-real-time-clock-setup-and-use/

     

    https://accautomation.ca/series/click-plc/

    Expand Post
10 of 19