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

Re: Reset causes reset of RTC!

On Thu, 30 Aug 2001, Rafael Collantes wrote:
> We are advancing in the developement of our system around the ETRAX LX. One 
> disturbing thing is that whenever we reset the board the information in the 
> Real Time Clock (timekeeper) is lost, EVEN if we connect a back-up battery. 
> Any ideas on how to avoid this? I think it is something in the 
> initialization of the chip that causes the loss of the time.

How do you set the time ? Do you actually write the new time to the RTC,
and not just to the kernel ?

The RTC is in non-active mode when it comes from the factory (you can see
this during bootup as a "0x80" measure of the seconds parameter) and it
won't start until it's written with something else. When the kernel reads
this it interprets it as the year 1970 over and over again.

And simply doing settimeofday() does not write anything to the RTC; you
need to use /dev/rtc for that and the proper ioctl (see the ds1302.c