Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

RTC - DS1307-many times getting loss of time

Status
Not open for further replies.

GMMR

Newbie level 5
Joined
Jul 19, 2007
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,361
ds1307 rtc hangs

Hi ,

presently we are using ds1307 - for rtc display with cypress controller interfaced via I2C comm.what we are facing one prolem is at continous power on the RTC time many times getting reseted or some times totally hang condition of time and date.actually it should not be like that.

controller is not reseting i checked.

so at this condition every time i have to reset the time/date parameters through controller.

i provided backup(3.3v-CR2032 li battery) also.i think it's ok.

did any one knows about it.
 

The DS1307 does NOT behave itself like that ..
Double check your firmware .. (missing STOP sequence, or something else???)

Regards,
IanP
 

Hi,

1) If you are using at same I2C bus, other device not 8-bit adress size ( like an 24C64, for example ) , some not expected behaviour may happen.

2) Check also crystal type you are using.


regards
 

I have used other RTC in our circuit using 8051 and displaying on the LCD most of the time it is working fine but some times if you continously watch the LCD you will find that display shows garbage value and returned back to original one because of continously updation of time on LCD.

I have checked every thing regarding software and hardware but did't get the problem's cause.

You should check RTC data sheet and check whether you are fulfilling all its requirment including its configuration.
 

IanP,

actually after every one read completion i am stoping the I2C communication.and again i am reading after some msec's.and here while tesing there is a chance of multiple times power on and power off of unit - with that is there any chance of resetting of ds1307.

andre_teprom,

no i am using only ds1307 with I2C.

and the crystal i used is cylidrical - 32.768 crystal.

devendra_devgupta,

after reset or loss of time if again configure the ds1307 it's working properly.and at configuration i disabled the SQW o/p also.
 

Just a test, to eliminate a possible reason of badworking :

- Try reduce crystal frequency, or put greater dalays at I2C routine.
 

hi,

i observed new thing,
previously when ever i got junk on LCD display(which i used to display RTC date and time), that time i did re configuration of DS1307(setting date and time through I2C).

but once when i found no change in disply of date&time this time i only reloaded the controller hex file not even touching DS1307.then i got normal RTC date&time display.
 

please upload the files?

thanks
 

I think there should be some problem in your software only either your satck got full. Or the same registers are used some where else. If you have interrupt in your software do one thing disable interrupt at the start of reading RTC and enable again at the end
 

devendra_devgupta,

I enabled one UART interrupt through out the power on condition.but this hanging or resetting is happening not at running condition,it's happening after 1 or 2 days that to next power on state only.

on more thing is it interrupt has it's effect on I2C communication.any way if one read cycle it's got missed then next read cycle it has to get it na.
 

Add a 10uF ,16V and a 100nF capacitor across VCC and GND of DS1307.

supply problems may produce this state,DS1307 is sensitive to supply noises in circuits that there are source of noise like as motor.
 

Hi,

Check whether the Bit 7 of Register 0 of the RTC is getting set accidently in the program. This bit is the clock halt (CH) bit. When this bit is set to 1, the
oscillator is disabled. When cleared to 0, the oscillator is enabled.
 

I think you should send something more to get rid out of this man. I am so sorry that i am not able to help you as we all know that this is not a big deal.

Only Two conditions are possible either software problem or hardware problem and third is EMI which i think hangs your controller but you said that rest all the things are working fine except the RTC function so third condition is in dustbin . I am very much puzzeled what could be the cause of this. Could it not be I2C routine problem like acknowledge or timing. May be it is
 

devendra_devgupta,

I am very very thankfull to you,till now what ever suggestions you gave are worth.don't worry i will handle it.if any other things is there i will definitly catch you.

once again thanks to all board members.
 

I had some issues with the DS1307 when backup battery was not connected. When the battery was not present the chip didn't respond to commands sent through I2C. Only after connecting the battery it went ok.
 

kekon,

if you don't connect the back up then it's mean that it won't maintain the updation of date and time in power off state that's it.it does't effect working of ds1307 at normal power on state.

back up voltage should be > 2.0v and <3.3v

pls read ds1307 datasheet once again.
 

if you don't connect the back up then it's mean that it won't maintain the updation of date and time in power off state that's it.it does't effect working of ds1307 at normal power on state.

I wrote to Dallas Semiconductor once (when it was a separate company) and they told me that some old devices in DIP package could have the problem i've described. I forgot to add that DS1307 didn't start the oscillator with no backup present (this was the main problem). New chips i use work properly without issues.
 

I cant see your desing / schematic, or your code, but, with that RTC you must have the following tips:

1. use pull-up resistors, 4k7 or 10k are common values
2. check the ic2 protocol.... is the same used in the 24LCxx devices, there's an example from these in ccs c compiler...
3. check the crystal, try with another one....
4. you must put the DS1307 in ON...

is all i cant advise you without your design or code...
good luck
 

GMMR,

Did you get the solution for your problem?
I've had a problem like your so I would like to see any direction to its solution...

Rodrigo
 

If the problem is loss of time, check the crystal...
The internal oscillator of DS1307 circuitry is designed for operation with a crystal having a specified load capacitance (CL) of 12.5pF.

The frequency accuracy of a crystal-based oscillator circuit is mainly dependent upon the accuracy of the crystal and the accuracy of the match between the crystal and the oscillator capacitive load. If the capacitive load is less than the crystal was designed for, the oscillator runs fast. If the capacitive load is greater than what the crystal was designed for, the oscillator runs slow.

Fast Clocks
The following are the most common scenarios that cause a crystal-based RTC to run fast.

1. Noise coupling into the crystal from adjacent signals. This problem has been extensively covered above. Noise coupling usually causes an RTC to be grossly inaccurate.
2. Wrong crystal. An RTC typically runs fast if a crystal with a specified load capacitance (CL) greater than the RTC-specified load capacitance is used. The severity of the inaccuracy is dependent on the value of the CL. For example, using a crystal with a CL of 12pF on an RTC designed with a 6pF CL causes the RTC to be about 3 to 4 minutes per month fast.

Slow Clocks
The following are the most common scenarios that cause a crystal-based RTC to run slow.

1. Overshoots on RTC input pins. It is possible to cause a RTC to run slow by periodically stopping the oscillator. This can be inadvertently accomplished by noisy input signals to the RTC. If an input signal rises to a voltage that is greater than a diode drop (~0.3V) above VDD, the ESD protection diode for the input pin will forward bias, allowing the substrate to be flooded with current. This, in turn, stops the oscillator until the input signal voltage decreases to below a diode drop above VDD.

This mechanism can cause the oscillator to stop frequently if input signals are noisy. Therefore, care should be taken to ensure there is no overshoot on input signals.

Another situation that is common to overshoot problem is having an input to the RTC at 5V when the RTC is in battery-backup mode. This can be a problem in systems that systematically shut down certain circuits but keep others powered up. It is very important to ensure there are no input signals to the RTC that are greater than the battery voltage (unless stated otherwise in the device data sheet) when the device is in battery-backup mode.

2. Wrong crystal. A RTC typically runs slow if a crystal with a specified CL is less than the CL of the RTC. The severity of the inaccuracy is dependent on the value of the CL.
3. Stray capacitance. Stray capacitance between the crystal pins and/or to ground can slow an RTC down. Therefore, care must be taken when designing the PC board layout to ensure the stray capacitance is kept to a minimum.
4. Temperature. The further the operating temperature is from the crystal turnover temperature, the slower the crystal oscillates. See Figures 3 and 4.

**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top