| ??? 06/08/01 11:53 Read: times |
#12298 - RE: I2C interface for 24C16 + DS1307 |
Hi Peter, thank you for your help.
>1. Whats a 'read error' ? >E.g. SDA or SCL permanent low or what ? I have a routine that reads all 64 bytes from the DS1307 and prints it on the RS232 port. I can call this with a command on my RS232 interface. 2/3 of the time, this data printout will show the correct all 64 bytes. But 1/3 of the time I'll get 0-10% correct data and the rest will be FF. What it is, is that the chip timesout in the ACK routine. >2. Have you tried my I2C-reset-routine after such errors ? No, I've heard some thing about a reset but I haven't found any code or desciption of it. If you have a link to it I'll try it. >3. Send you always ACK to read a byte and NACK to read the last byte ? Yes! This is the code that I uses for ACK. ------------------------------------------------------------- ; Wait k Cycle for Acknowledge from slave I2CACKWAIT: SETB I2CPORTSDA ; Set SDA as INPUT SETB I2CPORTHCK ; HCK = 1 MOV R0,#I2CTIMEWAIT ; (Wait TIME) = 30 ms MOV R1,#0 ACKLOOP: JNB I2CPORTSDA,ACKOK0 ; Skip if SDA = 1 DJNZ R1,ACKLOOP DJNZ R0,ACKLOOP CLR I2CPORTHCK ; HCK = 0 MOV A,#1 ; NOK RET ACKOK0: CLR I2CPORTHCK ; HCK = 0 MOV A,#0 ; OK RET ------------------------------------------------------------- This is the function that timesout... Shouldn't 30ms be ok? >4. Have you correct calculated all the minimal timings ? > Most EEPROMs are able to work up to 400kHz or 1Mhz but the > DS1307 only at max 100kHz. Haven't noticed that in the datasheet, hmmm... I just asummed all I2C had the same access time data. However I have a time of 20ms! between each byte is read. That is, wait 20ms, send Chip-address+Hi-address, send Lo-address, read/write one byte, RET. My internal wait loop is 5us, but I have tired to increse it to 10 but that doesn't help... >5. I know not the DS1307 data sheet. But most other RTC circuits are > busy anytime, if a new time and date was calculated. And then a > busy signal was generated to tell, that now the time information > may be invalid. It doesn't say any thing about that in the data sheet. Is my 10k pull-up is that ok? Is there any one out there that has an fully working subroutine in ASM using P1 port to access the DS1307? I'll be really happy if you could send me a copy. /Magnus |
| Topic | Author | Date |
| I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| serching ADuC824 applications | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: I2C interface for 24C16 + DS1307 | 01/01/70 00:00 | |
| RE: serching ADuC824 applications | 01/01/70 00:00 | |
RE: serching ADuC824 applications | 01/01/70 00:00 |



