[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] problem RaQ3 RTC (Clock error)



Hi Barry,

this is a bug in the shipping raq3, the manufacturing line doesn't set the real
time clock to 24 hour mode... this is going to be fixed in the next update, but
until then here is a quick program to set it correctly.  just do a:

gcc -O2 mfg-fix-rtc.c -o mfg-fix-rtc
./mfg-fix-rtc

as root on your raq3 and a cat on /proc/rtc should show "24hr : yes".  (the -O2
is necessary for outb() to work)

-duncan

/* ------------------ mfg-fix-rtc.c ------------------*/
/* original by Tim Hockin, Cobalt Networks            */
#include <stdio.h>
#include <sys/io.h>

int main(int argc, char *argv[])
{
        unsigned char tmp;

        if (ioperm(0x70, 2, 1)) {
                perror("ioperm");
                return 2;
        }

        outb(0xb, 0x70);
        tmp = inb(0x71);
        outb(tmp | 0x80, 0x71);

        outb(0xa, 0x70);
        outb(0x26, 0x71);

        outb(0xb, 0x70);
        outb(0x2, 0x71);

        outb(0xb, 0x70);
        tmp = inb(0x71);
        outb(tmp & ~0x80, 0x71);

        return 0;
}
/* ------------------ mfg-fix-rtc.c ------------------ */


Barry Titmarsh wrote:
> 
> I am having problems getting this box to correct the time. it is always in
> error. by 20hr
> 
> look see.
> 
> [root@boobox rc.d]# cat /proc/rtc ; /usr/sbin/ntpdate 194.162.229.3
> 
> rtc_time        : 01:58:59
> rtc_date        : 2000-01-20
> rtc_epoch       : 1900
> alarm           : 10:40:00
> DST_enable      : no
> BCD             : yes
> 24hr            : no
> square_wave     : no
> alarm_IRQ       : no
> update_IRQ      : no
> periodic_IRQ    : no
> periodic_freq   : 1024
> batt_status     : okay
> 
> 20 Jan 22:58:59 ntpdate[1204]: adjust time server 194.162.229.3 offset
> 0.052828 sec
> 
> same day but the time diff is 20 hours slow in time.
> 
> Any Ideas ?
> 
> Regards Barry
> 
> ----------------------------------------------------------------------------
> ------------------------------
> Barry Titmarsh BMT1-RIPE           Nacamar Ltd (Sheringham Office)
>                                                    Knole House 38 Cromer Rd
>                                                    Sheringham Norfolk NR268RR
> e-mail: barry@xxxxxxxxxxxxxx      voice: +44-1263-821-844
> www: www.nacamar.net.uk
> ----------------------------------------------------------------------------
> ------------------------------
> 
> _______________________________________________
> cobalt-developers mailing list
> cobalt-developers@xxxxxxxxxxxxxxx
> http://list.cobalt.com/mailman/listinfo/cobalt-developers