RTC Issues

I thought I had posted about this before but a quick search of the forum shows nothing. The RTC on my ChipworkX seems to refuse to hold a date. I’ve tested the battery and it’s perfectly fine. Here’s my test code.

using System;

using Microsoft.SPOT;

using GHIElectronics.NETMF.Hardware;

namespace ChipworkXTimeTest
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print("ChipworkX RTC Test");
            Debug.Print("Waiting 3sec for MFDeploy to connect");
            System.Threading.Thread.Sleep(3000);

            DateTime dtClck = RealTimeClock.GetTime();
            DateTime dtComp = new DateTime(2011, 10, 17, 18, 4, 0);
            if (dtClck <= dtComp)
            {
                Debug.Print(">>RTC not set");
                RealTimeClock.SetTime(dtComp);
                Debug.Print(">>Set RTC for: " + dtComp.ToString());
                Debug.Print("");
                Debug.Print("Remove power; wait 30sec; apply power");
                return;
            }

            Debug.Print("RTC: " + dtClck.ToString());

        }

    }
}

Is your 3V battery alive?

What if you keep power connected and hold reset fro few seconds? Will RTC have correct time?

Battery is fine, first thing I tested

Holding reset down for a full 30sec the RTC keeps it’s time just fine; properly increments, etc.

Any suggestions?

Tested it here and it works mostly but then got it to fail once! Still looking into it.

@ Gus, here’s a little something for you to go on.

I managed to get my RTC working for the first time ever. What I’ve changed is I now store the TimeZoneOffset in EWR. Now whether it’s because I’m [re]storing the TimeZone from EWR or it’s forcing me to wait a few extra cycles before I pull the plug I’m not sure.

But as long as it works that’s all I care about for now. :smiley:

Spoke too soon. It worked several times, and then failed.