Maker Pro
Maker Pro

problem with DS1307

H

hitu

Jan 1, 1970
0
I have made a simple board using AT89c52 and DS1307. I works fine
normally, but during sudden power failure and restore of power,
sometimes the time stored in RTC is corupted. I tried by making
seperate power supply to RTC and early RESET to micro controller
during power fail, still the problem is not solved. Can you help me ?

Hitu
 
A

Anthony Fremont

Jan 1, 1970
0
hitu said:
I have made a simple board using AT89c52 and DS1307. I works fine
normally, but during sudden power failure and restore of power,
sometimes the time stored in RTC is corupted. I tried by making
seperate power supply to RTC and early RESET to micro controller
during power fail, still the problem is not solved. Can you help me ?

It's been a year or two since I first played with a 1307 and I recall having
problems similar to what you're saying. I added a coin-cell backup battery
to keep the time alive when the power failed. IIRC, it has to do with
having power interrupted when you are "talking" to the 1307. Try enabling
"brown out detect" if you have that option so that the processor won't try
doing I/O without enough voltage available.
 
T

TT_Man

Jan 1, 1970
0
Anthony Fremont said:
It's been a year or two since I first played with a 1307 and I recall
having problems similar to what you're saying. I added a coin-cell backup
battery to keep the time alive when the power failed. IIRC, it has to do
with having power interrupted when you are "talking" to the 1307. Try
enabling "brown out detect" if you have that option so that the processor
won't try doing I/O without enough voltage available.
I have had the same/similar problem and have given up....The RTC is now
strapped to VCC and we don't rely on it's memory to re-instate the true
time.Then we just ran the chip as a time counter. We still had problems..
Now we've given up altogether and use an RTC derived from the CPU XTAL
The main problem seemed to be that the RTC chip would lock out the CPU on
powerup, maybe getting the SDA SDC in a twist. Being backed up by a coin
cell meant we had to remove the chip to 'unlock it'. Bloody nightmare. :(
There's no brownout on a 52 and I doubt that will help.......
 
E

Eeyore

Jan 1, 1970
0
TT_Man said:
I have had the same/similar problem and have given up....The RTC is now
strapped to VCC and we don't rely on it's memory to re-instate the true
time.Then we just ran the chip as a time counter. We still had problems..
Now we've given up altogether and use an RTC derived from the CPU XTAL
The main problem seemed to be that the RTC chip would lock out the CPU on
powerup, maybe getting the SDA SDC in a twist. Being backed up by a coin
cell meant we had to remove the chip to 'unlock it'. Bloody nightmare. :(
There's no brownout on a 52 and I doubt that will help.......

You could use a brownout detector and feed that to an interrupt. I'm sure some
8051 varaint now have brownout detection btw.


Graham
 
J

James Beck

Jan 1, 1970
0
I have had the same/similar problem and have given up....The RTC is now
strapped to VCC and we don't rely on it's memory to re-instate the true
time.Then we just ran the chip as a time counter. We still had problems..
Now we've given up altogether and use an RTC derived from the CPU XTAL
The main problem seemed to be that the RTC chip would lock out the CPU on
powerup, maybe getting the SDA SDC in a twist. Being backed up by a coin
cell meant we had to remove the chip to 'unlock it'. Bloody nightmare. :(
There's no brownout on a 52 and I doubt that will help.......
We use the DS1307 in a couple products (thousands of units in the field)
and I have never run into any problems other than being interrupted by a
power fail in the middle of a write and we only write when a human needs
to set the time. I did make one small change over how most people might
run the IC, and I don't know if this might be why I have not had any
problems, but I use a small coin cell hooked to the Vbat input and I use
an output pin from the MCU to supply Vcc to the 1307. On power up the
rest of the system is initialized and before I use the clock for the
first time I pull that IO pin high. That lets me do a couple of
different things. It let's me go into deep sleep where the clock is
powered down and the MCU has built in brown out detection, so when the
power fails and the reset gets pulled low, the IO pin goes back to high
impedance mode cleanly killing the power to the DS1307 and it will not
get it back until the system completely reinitialized. Anyway, I may
try strapping one of them straight to Vcc to see if the date and time
get buggered up, hmmmmmm.

Jim
 
T

TT_Man

Jan 1, 1970
0
We use the DS1307 in a couple products (thousands of units in the field)
and I have never run into any problems other than being interrupted by a
power fail in the middle of a write and we only write when a human needs
to set the time. I did make one small change over how most people might
run the IC, and I don't know if this might be why I have not had any
problems, but I use a small coin cell hooked to the Vbat input and I use
an output pin from the MCU to supply Vcc to the 1307. On power up the
rest of the system is initialized and before I use the clock for the
first time I pull that IO pin high. That lets me do a couple of
different things. It let's me go into deep sleep where the clock is
powered down and the MCU has built in brown out detection, so when the
power fails and the reset gets pulled low, the IO pin goes back to high
impedance mode cleanly killing the power to the DS1307 and it will not
get it back until the system completely reinitialized. Anyway, I may
try strapping one of them straight to Vcc to see if the date and time
get buggered up, hmmmmmm.
Excellent idea..... I have just gone back and looked at our design. I was
mistaken, we use the DS1377( not 1307). This is driven by a DS1218 Vcc/Batt
switching chip,that also controls our /WE on the 32K CMOS ram. We get no
problems with RAM at all. Al my previous comments refer to this setup.
 
A

Anthony Fremont

Jan 1, 1970
0
James said:
We use the DS1307 in a couple products (thousands of units in the
field) and I have never run into any problems other than being
interrupted by a power fail in the middle of a write and we only
write when a human needs to set the time. I did make one small
change over how most people might run the IC, and I don't know if
this might be why I have not had any problems, but I use a small coin
cell hooked to the Vbat input and I use an output pin from the MCU to
supply Vcc to the 1307. On power up the rest of the system is
initialized and before I use the clock for the first time I pull that
IO pin high. That lets me do a couple of different things. It let's
me go into deep sleep where the clock is powered down and the MCU has
built in brown out detection, so when the power fails and the reset
gets pulled low, the IO pin goes back to high impedance mode cleanly
killing the power to the DS1307 and it will not get it back until the
system completely reinitialized. Anyway, I may try strapping one of
them straight to Vcc to see if the date and time get buggered up,
hmmmmmm.

Too funny, I do the same thing in a homemade data logger and I don't have
problems any more with corruption.
 
Top