Main Site Documentation

RTC time sometimes lost during power failure


#1

I sometimes loose my RTC time when power cycled for some time

The Pin 183 is at 2.94V when power is removed

At power up I use

Utility.SetLocalTime(RealTimeClock.GetTime());

And to set time I am using using

RealTimeClock.SetTime(New_DateTime);

This same code works good on EMX.

What is the battery voltage range on CHIPX?


#2

I’ve had the same issue on CWX, tested the battery has plenty of juice figured I’d just made a wrong call somewhere but haven’t bothered with much testing yet, other items are higher priority atm.


#3

Let us look into this in details and get back to you guys


#4

You said it hapens “sometimes”. Can you provie more details?
A basic test is to set the clock, power off the board. Power on and then read the time. This test should work fine, so what test can make this break?


#5

For me it’s anytime I’ve had the CWX off for like 20min+; consistently reproducible which is why I popped out the battery to test it.


#6

I switch off power and powered it back on in 10 sec and the time went to 1977.

Then I was not able to make it happen.

Then I powered off for 2 hours. And it did not happen.

It is totally random. I am not sure how to give you a test case.


#7

Microt, I suppose you have your own hardware.
Do you have the battery directly connected to the VBAT? can you try to add a big capacitor (like 220uF) between VBAT and the ground? This is just to ensure that the VBAT has a continuous voltage supply.


#8

Ok…will try that.

Right now it is as per your ChipX schematic.

1N4148 to 3.3V and a 330 OHm to the battery and a 0.1uf decoupling


#9

I’m having exactly the same problem.

My EMX board works fine. I made a screen to set the time with, which works and survives power cycles completely. On my Cobra, however, this is not the case. Unplugging the USB for any length of time sets the clock to 1977. This is a new Cobra so I can’t believe the battery is dead already.

It’s a bit annoying that the RealTimeClock.IsTimeValid is no longer itself valid as that could be useful for telling if the user needs to set the clock or not.


#10

DrNick, there is no battery on the FEZ Cobra, you need to connect one yourself. (On the pin header you’ll find a RTC VBAT connection for that purpose)


#11

That would explain it, and indeed, unscrewing and taking it apart find no battery but do see that pin header you mention.

Bit of a bummer it’s not there by default.


#12

We tested this on ChipworkX Development System and it is working fine on our end.

  1. Deployed the following program:
    RealTimeClock.SetTime(new DateTime(2010, 12, 17, 11, 0, 0));
    Debug.Print(RealTimeClock.GetTime().ToString());

  2. Erased the application using MFDeploy to make sure nothing is setting the time anymore.

  3. Disconnected power for over one hour.

  4. Deployed this program. The time is still valid which is the old one plus one hour:
    Debug.Print(RealTimeClock.GetTime().ToString());