You are here

I2C master without slave | Cypress Semiconductor

I2C master without slave

Summary: 1 Reply, Latest post by ANKS on 10 Apr 2017 12:50 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
gogglygogol's picture
User
15 posts

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();

    

 

ANKS's picture
Cypress Employee
345 posts

Can you please provide us with your project

Log in to post new comments.