AnsweredAssumed Answered

S12ZVC, I2C , removing stop bit in the sequence

Question asked by Sung Yul Chu on Oct 29, 2014
Latest reply on Nov 11, 2014 by Luis Daniel Olea Mendivil

Dear,

 

Hello,

 

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)

 

I used

byte CI2C1_SendBlock(void* Ptr,word Siz,word *Snt)

for Write Sequence.

 

Herer are the codes.

word send;

word send_len;

send= 0x0927;

send_len=2U;

CI2C1_SelectSlave(0x48);

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.

ex)

Case : Master reads Slave's 0x07 data. (Slave address is 0x91 including read bit. 7-bit address is 0x48)

 

 

unsigned char a;

CI2C1_SelectSlave(0x48);

CI2C1_SendChar(0x07);

CI2C1_RecvChar(&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?

Outcomes