I2C master without slave

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

   

i have copied some code from the examples. My problem is that without an Slave is connected, the code is not halted in the loop.

   

Why?

   

I expect that the first do-while loop should run until a slave acknowldged / the statusbyte should be 0x20 (I2C_MSTAT_ERR_ADDR_NAK  /* Slave did not ACK */) .

   

 thanks a lot

   

 

   

Heres the code:

   

 

   

//Write to Slave
do{

   

    temp = I2C_MasterWriteBuf(slAddress,(uint8 *)i2c_txArray,i2c_TxBufferSize,I2C_MODE_COMPLETE_XFER);   
}                                
while (temp != I2C_MSTR_NO_ERROR);

   

/* Wait for the data transfer to complete */
while(I2C_MasterStatus() & I2C_MSTAT_XFER_INP){};

   

temp = I2C_MasterClearStatus();

0 Likes
1 Reply
AnkitaS_51
Employee
Employee
100 likes received 50 likes received 25 likes received

Can you please provide us with your project

0 Likes