At present, I use MKE15Z256 MCU to debug the IIC module, and slave is the clock chip ISL1208..
Process: the single chip microcomputer is set as the host mode, when the clock chip is written, there is no problem. The waveform of SDA and SCL observed on the oscilloscope is consistent with the program, and the response is accurate.
Problem: when you read out the time written into the clock chip, you can't get it right. The use of register LPI2C1->MTDR is not very clear. The process of reading:
1. send a read instruction to the slave, no problem. After sending, SDA and SCL are also set low, and the bus is delivered to slave.
2. is ready to read a byte data, when the LPI2C1->MTDR=0x100 is set, 9 bits of data are observed on the SDA signal, and the first 8 bits are the same as the written data, but there is no response at this time. Therefore, the SDA signal is set up again, resulting in the readings of NG.
Does anyone know about this microcontroller IIC when reading data? Do you have code? Trouble helping to solve the problem, thank you.