I am using ke02z custom board. I have problem reading with DS1307 on board. I2C connected to I2C0, SDA PTA2, SCL PTA3. I had no problem with processor expert component DS1307. Now I am trying to move out of PE project because of the large library size after initializing all the peripherals. The problem is that I cannot read from I2C.
My code is as below.
|sI2C_Config.u16Slt = 0;|
|sI2C_Config.u16F = 0x1F;|
|sI2C_Config.sSetting.bIntEn = 0;|
|sI2C_Config.sSetting.bI2CEn = 1;|
I2C_MasterReadWait(I2C0, 0x68, &dsbuffer, 9);
I am getting random values when reading. The reading also corrupts first 3 address locations in ds1307. (0x00, 0x01, 0x02).
I am running in FEE mode, external crystal 32khz, configured to run at 16.7MHz. I tried some other values of I2C Frequency Divider Register. Still getting random values and corrupting target. I have attached my project. DS1307 address is 0x68. I need to read values from address 0x00 to 0x09h. I also tried the interrupt mode . I have attached the project. I started the project from example file in driver_lib. Using KDS 3.2.
Please help. Thank you.
Original Attachment has been moved to: ds1307_read_test.zip