Hello forum,
In some of the DS1307 that I have used, initially when I read the values if I get 3F instead of 00, the chip doesn't work. Values cannot be written at all. The ones that work always read 00 initially, before I write new values. ( I have also noticed that, these chips have 'N' as the last character in the third line of the printed part number on the chip. Ie: first line reads as 'DS1307' second line reads '0731A6' and the third line reads as '+102B N'. The ones that are perfectly working at my place have 'N' as the last character. This might just be a coincidence!). Are there different type of DS1307? Since the Part number is same, why are some not working? I am using 8051F340 controller.
with the same circuit i changed 3 to 4 rtc chips(ds1307)
only which ever redas 00 at first is writing .
please give comments
Thanks for replies
samo
It's not a coincidence because N means it's industrial so it's more durable like a greater operating temperature range otherwise it's the same function. The circuit you are using may be faulty where the industrial N version can handle the abuse but the regular version can't.
Hello savitch,
Thanks for the reply
circuit is operating at 21 degree or 22 celsius.
In circuit is SCL is connected to clock line and SDA is connected to data line .which is properly pulled up to +5v with 1k resistor.
For pin 3 of ds1307 battery is connected(litium 3.3v).
In circuit is SCL is connected to clock line and SDA is connected to data line .which is properly pulled up to +5v with 1k resistor.
1K sounds low for the I2C bus. The values I usually see are 4.7K or 10K (for high
speed operation). I would go with the 10K and make sure that both SDA and SCL
have a pull-up. Make sure there is only one pullups on each line.
The circuit I use for the DS1337 is in the datasheet at http://tinyurl.com/y8exe7k
I also have RTC example software on the same page
(* jcl *)
www: http://www.wiblocks.com
twitter: x.com
blog: http://luciani.org
I have one of those on hand so I tried it myself to verify it does work fine with 1k but I would have to agree that is a little low and should be higher. It doesn't need the crystal or anything to test so try using it alone with minimal components and no battery backup with the Vbat grounded.
Try to read and write to the ram registers which bypass some of the other internals.
This code writes 192 to register 8 then reads it back.
int temp=0;
Wire.beginTransmission(B1101000);
Wire.send(0x08);
Wire.send(192);
Wire.endTransmission();
Wire.beginTransmission(B1101000);
Wire.send(0x08);
Wire.endTransmission();
Wire.requestFrom(B1101000,1);
while(Wire.available()){
temp=Wire.receive();
Serial.println(temp);
}
Hello ,
Thanks for the replies.
But my circuit works at higher frequencies.so at higher frequencis resistance needs to be minimum.But i have doubt without crystal is it work?
please let me know what are intial values of the rtc before first write to those rtc registers?
Beacuse other chips what i have tested if it reads for the first time 3f it will not get update.
those chips which reads 00 those chip will take the values what ever i write.
thanks for th replies
The RAM registers starting at 0x08 are 0 when it starts clean.
The external crystal is for the counter and doesn't have anything to do with the i2c control or other internal functions. You can still debug the read/write and general function even if the crystal isn't connected and the counter doesn't advance.
Thanks for the replies
Thanks for giving this suggestion.
the RTC chip is not working was because of speed issue only.
with 12M,24M frequencies now working fine .
But which ever the count values if i give at 48 Mhz i am getting the previous issue it self.
for DS1307 at 100khz
for 1 bit transfer it takes 0.01msec of delay
i am using nop to give the delays.
please give suggestions
nop = 1/sysclk
please help at 48 MHZ clock
1/48 Mhz clock givs me 0.0208 micro seconds
to get 0.01 msec if load the count of 50
0.0208*50(nop()) = which gives the delay 1.04 microsec
i giving it delay of 0.01 msec but it is reading 3f only please give suggestions