Fix Clock: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (→‎How it works: Changing the section title to be more clear)
Line 21: Line 21:
"RTC chip lost power" is by far the most common cause of the problem.
"RTC chip lost power" is by far the most common cause of the problem.


= How the OLPC stores the time =
= How the XO stores the time =


In understanding this problem, it is helpful to understand the power dynamic between the system, the coin cell battery, and the RTC chip.
In understanding this problem, it is helpful to understand the power dynamic between the system, the coin cell battery, and the RTC chip.

Revision as of 02:31, 9 September 2013

  This page is monitored by the OLPC team.
  english | español HowTo [ID# 292369]  +/-  


This page describes how to fix an XO laptop suffering from problems with the Real Time Clock. If the laptop has security enabled, this problem will prevent an XO from booting, usually with the error "Invalid System Date". While this is the most common hardware dilemma afflicting (certain) old XO-1s, please also see the Refurbishing & Reuse Checklist and XO Troubleshooting Guide.

Problem Description

XO laptops with this problem show one of two symptoms:

  1. The laptop screen lights up and shows "Invalid System Date" and then powers off, or continues to boot, seeking an activation lease. Activating the laptop will result in the laptop working temporarily, but returning to the same problem on next boot. Affects XO-1, XO-1.5, XO-1.75 and XO-4.
  2. The power LED turns on, but the screen never turns on (not even the backlight). The microphone LED may flash briefly, but stays off. This symptom can only happen with very old versions of firmware (Q2D05 and Q2D06). Affects XO-1 only.

These symptoms are caused by bad date information stored in the Real Time Clock (RTC) chip. There are three ways that the date could become bad:

  • The RTC chip lost all power. The RTC chip has a "coin cell" backup battery (ML1220) that powers the RTC chip when the AC and the main battery are not present. Power may have been lost because:
    • The battery discharged during storage. This is common.
    • Some of the early production XO-1 machines were manufactured with a defective holder for the coin cell battery. On those machines, the coin cell battery can become loose or even pop out entirely during normal shipping and handling.
    • Leakage or corrosion from the battery, causing a loss of contact between the battery and the metal contacts inside the holder. Some photos here.
    • It is also possible that the coin cell battery ceased to work.
  • The factory did not set the date. This is rare.
  • The user explicitly set the date to an incorrect value, either by mistake or as an attempt to defeat activation security. This is also rare.

"RTC chip lost power" is by far the most common cause of the problem.

How the XO stores the time

In understanding this problem, it is helpful to understand the power dynamic between the system, the coin cell battery, and the RTC chip.

The XO must maintain power to the RTC chip at all times, even when the system is powered off. When power is lost, the time and date will be forgotten, resulting in the problems described on this page. This is especially important to consider for XOs in storage, or XOs that will not be used for an extended period of time.

The coin cell battery acts only as a backup: when available, the main power source (AC power or the main system battery) is used to keep the clock ticking. When there is no other power available, the coin cell battery takes over.

The coin-cell battery is somewhat rechargeable. On the XO-1, it will recharge from the main power source while the laptop is powered on and fully awake (not suspended). The XO-1.5 and XO-1.75 will charge the coin cell battery when the laptop is powered on and fully awake, and also when it is suspended. When recharging an empty battery, it is expected that the battery will reach normal voltage levels after around 30 minutes of charging, but will require potentially 24 hours for a complete recharge. However, the battery is only marginally rechargeable - it may stop working completely after 30 deep discharges.

A voltmeter can be used to perform some basic checks on the health of the battery. After 30 minutes of charging from empty, a reading of around 2.7v would be reasonable. After 24 hours of charging, when the battery should be fully charged, a reading of around 3.1v would be expected. However, these checks are inconclusive, 'bad' batteries may produce such readings. A real test would need to measure battery capacity, which is non-trivial.

When no other power is available, the coin cell battery is only able to power the RTC chip for a limited time before running out of power. Assuming the RTC battery is fully charged, the following table indicates the expected lifetime of the coil cell battery before it is unable to keep the RTC chip powered.

Laptop model Coin-cell battery life
XO-1 4 months
XO-1.5 2.5 months
XO-1.75 12 months (expected, needs testing)

When placing XOs in storage or some other situation where they will not be used for a significant period of time, it may be worth considering inserting the main laptop battery and ensuring it has a high amount of charge, so that the RTC chip remains powered for an extended amount of time before the coin-cell backup takes over. According to tests done in Uruguay, the following table provides an indication of how long the main battery can keep the RTC chip powered before running out of charge, in the case where the battery initially had 80% charge:

Laptop model Main battery longevity
XO-1 73 days
XO-1.5 174 days
XO-1.75 164 days

Note that the above numbers should be used as indications only; the real numbers will vary based on environmental conditions such as the temperature of the storage area, the exact model of the laptop and the RAM included, firmware version, etc.

Repairing

The repair process is:

  1. Check the battery and holder,
  2. Set the clock,
  3. Upgrade the firmware, and then
  4. Check the clock is set after removing power.

Here are English and French diagrams of the process:

English French
Debrick-4.png
Debrick-4-fr.png

Check the battery and holder

To access the Real Time Clock battery, follow the instruction for removing the back cover.

XO-1

Examine the battery and its holder. Is there any sign of acid leakage? Does the battery appear secure in its holder? On newer models of the XO-1, the RTC battery and its holder may be covered by a circular strip of rubber (a hardware improvement attempting to reduce the frequency of this issue). You can remove this cover simply by peeling it off.

Remove the battery from the socket. Check for signs of leakage underneath the battery, in the holder, and on the motherboard and components around the battery holder.

If there are signs of battery leakage:

  1. Remove the leaking coin cell battery and discard it.
  2. Carefully clean any leakage/corrosion in the battery holder, using e.g. a damp toothbrush.
  3. Neutralize the leakage/corrosion area with some baking soda.
  4. Using a magnifying glass, look for damage to surrounding components or electrical tracks
    • If present, you are advised to treat the motherboard as broken or dead-on-arrival.
  5. Obtain a replacement cell battery (these parts are very standard) and install in the socket.
    • Any decent electrical/DIY store will stock these, they are known as ML1220 batteries and commonly found in calculators.
    • (Never use CR1220; they are not designed to be recharged, will not run the clock for very long, may leak, and may erupt in fire.)
If your battery holder is white, then you shouldn't have a problem here.
The battery holder in the motherboard.
Bad RTC battery holder (from earlier laptops model) - notice the straight grip
Good RTC battery holder - notice the curved grip


If the battery does not fit well in the socket, carefully examine the shape of the socket. Early laptops had a defective battery holder, pictured here. The photos do not make the problem very obvious; the issue is that the shape of the battery holder does not 'grip' the battery. In other words, a side angle view of the battery holder should be shaped like this:

(_____)

However, the shape of the defective units is more like:

\_____/

(these crude diagrams are exaggerated)

If your XO has a defective holder, you must re-seat the coin cell battery and secure it so it doesn't come out again. This can be done by putting a drop of glue where the battery contacts the holder, away from the metallic contact.

  • The best glue that Mitch has found for this purpose is clear solvent-based household cement. Technically, it is "nitro cellulose" cement. It is also known as "model airplane glue", marketed under various trade names such as "Duco Cement", "Tarzan's Grip". Loctite "Stik'n Seal", etc (Alleskleber, in Germany, maybe?). The solvent in this kind of cement is toxic and flammable, so keep it away from children!
  • Stronger adhesives like epoxy or cyanoacrylate (super glue) would probably work too, but it might be difficult to remove the battery later without damaging the holder.
  • Don't use "Gorilla Glue"; that's polyurethane, which foams as it cures.
  • Don't use RTV silicone; the common variety releases corrosive acetic acid as it cures - if it smells like vinegar, don't use it on electronics.
  • Don't use hot melt glue; because it doesn't stick very well to these materials.
  • Ordinary "white glue" (PVA, or polyvinyl acetate) will probably work, but it flows easily and goes down underneath the battery - perhaps okay if you are careful not to use too much.

If your XO had a black rubber strip covering the battery in the holder, install the cover again now.

XO-1.5

New XO-1.5 battery holder

On the XO-1.5, the RTC battery is not in a holder. The battery is encased in shrink tubing, and connected to the motherboard with a short cable. (Eliminating the socket was an attempt to reduce the number of socket issues experienced on XO-1.) The battery, in its protective tubing, is stuck down to the motherboard to prevent it from moving around.

Even though the same standard ML1220 coin-cell is used, replacing the battery alone is difficult. The shrink tubing will be destroyed as you open it, and it will be difficult, and perhaps even dangerous, to reconnect the wires to a replacement battery.

  • It may be possible to repair the tubing with some tape, or to discard the tubing and create your own enclosure with some electrical tape.
  • The battery shipped in the laptop is a leggy battery - it has the wires spot-welded to the battery during fabrication. It is a very bad idea to attempt to solder wires to a new battery (it can explode). It is far better purchase leggy replacement batteries (e.g. here, maybe).

If available, one could also take the entire component (connector + cable + tubing + battery) from another laptop, or from a spare parts supply sourced from OLPC.

XO-1.75

See above, the same battery, packaging, and wiring is used as in the XO-1.5.

XO-4

See above, the same battery, packaging, and wiring is used as in the XO-1.5.

Set the clock

The clock should be set to the Coordinated Universal Time value, rather than your local time.

If the screen turns on and you can boot into Linux

This is the best situation to be in. It happens if the laptop has activation security disabled, or the laptop without a date is able to retrieve an activation lease.

Once Linux has booted, login at a root terminal (e.g. the Terminal activity, or press Ctrl+Alt+F2 to get to the Console).

Set the system time using the date command, e.g. for the current date/time:

date --utc --set="2024-11-21 17:04:26"

Then copy the system time into the clock:

hwclock --systohc

On XO-1 with releases 12.1.0 and 13.1.0, the above may hang for ten seconds and show a warning "wait for clock tick timed out". The hang and warning may be ignored, the clock will have been set. If you would like to avoid the hang and warning, use:

hwclock --systohc --noadjfile --utc

If the screen turns on but you cannot enter Linux

If the screen turns on, but you cannot enter Linux, then setting the clock must be done using the firmware. What you must do is:

select /rtc decimal 26 04 17 21 11 2024 set-time

You can now turn off the machine by pressing the power button for a few seconds.

(The numbers are the time and date in UTC (2024-11-21 17:04:26), but in reverse order; second, minute, hour, day of month, month, and year. When you visited this page, our Wiki server used it's own clock to generate this command for you.)

If the screen does not turn on

When the clock loses the time on XO-1 with very old versions of Open Firmware, a bug will stop the firmware before it turns on the screen. If this happens, the recovery procedure is:

  1. connect a serial adapter to the XO-1 and another computer, see where to connect it,
  2. use a serial terminal program on the other computer to access the XO-1 via the adapter,
  3. turn on the XO-1, and you should see "Page Fault" on the serial terminal, followed by an "ok" prompt. If you don't see "Page Fault", there are several possibilities:
    • if you don't see anything on the serial terminal, either
      • the serial adapter is not connected correctly,
      • the serial terminal is not configured correctly, see settings, or
      • something else is wrong with the XO-1, perhaps it is quite quite dead and it's not an instance of this known clock problem after all.
    • if you see a lot of startup messages, and the last one isn't "Page Fault" followed by "ok", then the machine is not suffering from the this known clock problem, but may have a broken display or display cable.
  4. using the serial terminal, type this command to set the clock:
select /rtc decimal 26 04 17 21 11 2024 set-time

(There are numerous opportunities for error, so if you have more than one XO-1 laptop practice serial communications with working ones before debugging broken ones).

Upgrade the firmware

If you had the blank-screen problem, upgrade the firmware to a version that does not suffer from it. That way, if the RTC loses power again, the repair will not need a serial adapter. See the Firmware page for the latest firmware for the laptop model, and see Firmware/Install for how to install it from the ok prompt.

If you are using a serial adapter and had the "Page Fault" message, you must probe the PCI and USB before manually upgrading:

 ok probe-pci probe-usb  flash u:\q2f15.rom

Check the clock is set after removing power

With the clock newly set, you should verify that the laptop is able to retain the time and date, otherwise this problem may resurface.

  1. Unplug the charger,
  2. Remove the main battery from the underside of the laptop, (not the coin cell),
  3. Leave the laptop without power for five minutes,
  4. Connect a power source (the battery, or the charger) and turn on the laptop,
  5. Check the clock using either the Ok prompt or by running date in the Terminal activity.

If the clock is still wrong, then 3 situations are possible:

  1. The RTC coin-cell battery is faulty and must be replaced.
    • You can verify this by installing a known-working battery, reprogramming the clock, and then repeating this verification test. Test pass would confirm this problem.
  2. There is a problem with the battery holder or the motherboard, so the laptop should be replaced.
    • You can verify this by installing a known-working battery, reprogramming the clock, and then repeating this verification test. Test fail would confirm this problem.
  3. If you are dealing with a defective shape battery holder, perhaps the RTC battery is (still) not maintaining electrical contact with the connector inside the battery holder.

Automated repair script

Repair center volunteers have created an automated python script that can be used to repair machines in bulk or simply as a method with fewer instructions. The script can be run on a typical Linux machine or on an XO. We call this 2nd computer your "debricker" machine.

The script you will run on the "debricker" can be found here:

d6.py

The upstream git repository for it is in the olpc-contrib repository located here:

olpc-contrib

To use the script you must first install pyserial. You must be online when running (any of) the three following commands:

For Ubuntu or Debian:

sudo apt-get install python-serial

For Fedora, such as on an XO::

sudo yum install -y pyserial

Wait for the install to complete.

Then download and install d6.py by typing:

wget --timestamping http://dev.laptop.org/~rsmith/d6.py

Connect up the proper serial adapter between the bricked XO (serial end of the cable) and the debricker computer (USB end of the cable). Then type -- always on the debricker (i.e. working!) machine:

python d6.py

Or if d6.py has been marked executable then you can execute it directly with:

./d6.py

The script will search for the first serial port on the system that is available for use. If your serial connection for the XO is not on the first available port then either modify the script to look for the other port fist or open the other serial port with another program so its not available for use by d6.py.

Once the script is up and running then connect up a bricked XO and power it on. When the screen on the bricked XO lights up, or you hear the startup sound, it's finished (debricked!)

Measuring Charge Current

To measure charge or discharge current of the RTC battery, locate the series resistor from the following list, then use a multimeter to measure the voltage across the resistor.

  • XO-1, R250 100 ohms for discharge, R275 1k for charge,
  • XO-1.5, R309, 1k
  • XO-1.75, R35, 1k 1%
  • XO-4, R359, 1k 1%

See Also

  • Oatstime, a tool for use by deployments in setting the clock on a large number of laptops.