Fix Clock: Difference between revisions

From OLPC
Jump to navigation Jump to search
Line 195: Line 195:
wget http://dev.laptop.org/~rsmith/d6.py
wget http://dev.laptop.org/~rsmith/d6.py


To run the program you connect up the OLPC serial adapter to the machine switch to the directory where d6.py is located and then do
To run the program you connect up the OLPC [[Serial adapters|serial adapter]] between the 2 machines, switch to the directory where d6.py is located and then do:
python ./d6.py
python ./d6.py



Revision as of 16:59, 28 April 2011

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


This page describes how to fix a XO laptop suffering from problems with the Real Time Clock. If the laptop has security enabled, this problem will prevent an XO-1 from booting.

Problem Description

XO-1 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.
  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 on XO-1 with very old versions of OFW (Q2D05 and Q2D06).

The problem is 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, but unfortunately, problems with this backup battery are 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.
    • Another occasional problem is 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 (and not too uncommon) that the coin cell battery simply does not work (or has 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.

XO-1.5 laptops do not suffer from this particular problem.

Repair process

The overall process is:

  1. Examine the battery and its holder, securing the battery in place if necessary
  2. Reprogram the time and date
  3. Perform a verification test

Here are English and French diagrams of the process:

English 'date fix' diagram
French 'date fix' diagram


Examine the battery and its 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.
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.

Reprogram the time/date

Note that in all cases, the date/time should be set to the Coordinated Universal Time value, rather than the time in your local timezone.

If the screen turns on and you can boot into Linux

The most simplistic situation is when Linux can be booted - for example, the system has activation security disabled, or the dateless system is able to retrieve an activation lease as it is booting.

Once Linux has booted, login at a a root terminal (e.g. press Ctrl+Alt+F1).

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

date --utc -s "2024-11-25 02:08:03"

If the screen turns on but you cannot enter Linux

Reprogramming the time and date can also be done through the OpenFirmware ok prompt.

If there is something visible on the display, you simply need to disable the XO laptop security system and press the escape key once you hear the bootup sound to access the OpenFirmware prompt.

In order to disable the security system (assuming it is enabled, which is generally only true for large deployments and G1G1 customers), you will need a "developer key" for this machine, on a USB storage stick.

Turn on the XO and hit Escape upon hearing the bootup jingle.

At the ok prompt, type these commands to set the date (hitting enter after each one):

ok select /rtc
ok decimal
ok sec min hour day month year set-time

sec, min, hour, day, etc in the previous command should be numbers correlating to the current date. For the current time:

ok 03 08 02 25 11 2024 set-time

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

If the screen does not turn on

Very old versions of OpenFirmware for the XO-1 laptop had a bug which would cause the screen to fail to power up when this RTC clock problem was encountered. If this happens, the recovery procedure involves linking up a special cable to another computer, and then using that other computer to reprogram the time and date.

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

  1. Using an OLPC serial adapter, connect the laptop to your personal laptop or computer. On the laptop's motherboard, the serial adapter should be connected to J1. J1 is a small white connector near the wireless module.
  2. Use a program like screen (for Linux) or HyperTerminal (for Windows) to access the laptop serially.
  3. The serial port settings should be 115200 baud, 8 data bits, no parity, and 1 stop bit and handshake parameter is disabled; only the baud rate needs to be set on Linux, the remaining settings are the default.
  4. Power on the laptop under test. 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 terminal is not connected correctly, or
      • Something else is wrong with the machine - the machine is quite quite dead and it's not an instance of the symptom 1 RTC problem.
    • 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 known RTC problem, but may have a dislodged backlight cable.

Using the "other" laptop that is connected serially to the affected XO, type these commands at the ok prompt (hitting enter after each one):

ok select /rtc
ok decimal
ok sec min hour day month year set-time

sec, min, hour, day, etc in the previous command should be numbers correlating to the current date. For the current time:

ok 03 08 02 25 11 2024 set-time

At this point, update the firmware to a version that does not suffer from this blank-screen problem. That way, if the RTC loses power again, your diagnosis/recovery procedure will not need a serial adapter.

  1. Insert a USB key containing the latest firmware version. You will need to download the .rom file and place it on the key.
  2. To update the firmware, type the following command line at the ok prompt, substituting the correct .rom filename:
 ok probe-pci probe-usb  flash u:\q2d16.rom

Perform a verification test

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

  1. Unplug the charger if it is plugged in.
  2. Remove the regular XO battery from the underside of the laptop (Note: this refers to the main battery that is charged through AC power, and can be easily accessed by turning the laptop upside down. It does not refer to the coin cell battery, which you should not touch at this point).
  3. Leave the laptop in this state for 3-5 minutes
  4. Connect a power source (the battery, or the charger) and turn on the laptop
  5. Look carefully for an "Invalid System Date" error message appearing immediately

The lack of an error message indicates that the repair was a success. You may wish to go into Linux and run date in the Terminal activity to verify that the clock was programmed correctly, although this should not be necessary.

If there is an error message, 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.

The script 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:

sudo apt-get install python-serial

On an XO:

sudo yum install pyserial

The above may take a couple minutes. Then download/install d6.py by typing:

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

To run the program you connect up the OLPC serial adapter between the 2 machines, switch to the directory where d6.py is located and then do:

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 lights up or you hear the startup sound its finished.