I'd like to generate proper Send and Receive Message between S12ZVC (MCU) and Slave IC.
However, the slave IC that I used requires some special I2C protocols.
Herer are the sequences.
Write Sequence: Start -> Slave Address -> Ack(slave) -> Sub Address -> Ack(slave) -> Data -> Ack(slave) ........ -> Data -> Ack (slave) -> Stop.
Read Sequence: Start -> Slave Address (LSB=0) -> Ack(slave) -> Sub Address -> Ack (slave) -> Start -> Slave Address (LSB=1) -> Ack(slave) -> Data -> Ack(master) -> ......Data -> NAck(Master) -> Stop
Currently, I am using InternalI2C library. (CI2C1.c and CI2C1.h)
byte CI2C1_SendBlock(void* Ptr,word Siz,word *Snt)
for Write Sequence.
Herer are the codes.
CI2C1_SendBlock(&send, 2U, &send_len);
This SendBlock makes the write sequence well.
However, the problem is that the read sequence requires No Stop bit, One single Start bit in the middle of the sequence.
Using SendBlock, and RecvChar,they generate Stop bit and Start bit, Slave Address.
Case : Master reads Slave's 0x07 data. (Slave address is 0x91 including read bit. 7-bit address is 0x48)
unsigned char a;
then, the results are shown below.
Start-> 0x90 (0x48 + Write bit:0 ) -> Ack(slave) -> 0x07 -> Ack(slave) -> Stop --> Start ->0x91 (0x48 + Read bit:1) -> Ack(slave) -> DATA -> NAck(Master)=1 -> Stop
because of the Stop bit, the received data (DATA) are incorrect. ( the read data after the stop bit always represents initial data (0x00 address's data).
How to remove the Stop bit?