I am working on frdm-kl25z EVM and i need I2C0 communication protocol for my task.
I need to communicate with CAT24M01 EEPROM which is I2C based using KEIL IDE.
I used PORTB0 - SCL and PORTB1 - SDA line for my task.
EEPROM has been configured with 4.7k Pull-Up at Vcc side .(I also tried 10k and 1k)
I have configured I2C to work with 100Khz then i tried 400Khz and 1Mhz , my clock freq. is 24 Mhz .
i configured I2Cx_F register to get above baud rate as following.
I2C_F = 0X1E // For 100 Khz
I2C_F = 0x0E // For 400Khz
I2C_F = 0X02 // For 1Mhz respectively.
Now my problem is as below,
I observed following results in my implementation.
1) Sometime it works and writes one byte properly.
2) Sometime it works only after unplugging the power cable of FRDM-KL25Z.
3) Sometime it gets stuck into the getting acknowledgement phase in which i m polling for IICIF flag from I2C_S to be reset (0 value) (The brief is given into code).
I measured the voltages at pin MCU side and EEPROM side and i got 3.3V .
the brief code is attached here.
Please go through it.
Any help on this would be great appreciable.
Thanks & Regards,
Original Attachment has been moved to: I2C_sample.c.zip