I'm working on T1042RDB board and I'm writing I2C driver as standalone but i have encountered some problem during writing driver. before i tell my problem, i want to show some part of the driver code.
the following is initializion step in the driver for master.
I2C_Frequency->FDR = 0x1;
I2C_Dfs-DFSR = 0x1;
I2C_Control->MTX = RECEIVE MODE.;
I2C_Control->MEN = MODULE_ENABLE;
after above initilazation, i call my readFromSlave function which it sends START Condition, and Slave address with R/W bit.
readFromSlave function is like that;
if(I2C_Status->MBB == BUS_AVAILABLE)
I2C_Control->MSTA = MASTER_MODE;
printf("I'm master from now\n");
I2C_DATA->Data = SLAVE_ADDR && MASK_WRITE; // slave addres is 0x4c and mask_write is FE.
while(I2C_Status->RXAK != ACKNOWLEDGE_SIG); //ACKNOWLEDGE_SIG is 0.
when i call readFromSlave function, "while loop" is not broken. slave is not sending ACK message to master and i know this ACK means slave says "yes, this address belongs to me and i'm on the bus".
i wonder that why slave is not sending an ACK to master. by the way, i guess in the terminology this ack belongs to address cycle.
how can i resolve this problem because slave doesnt send ack to master ?
thanks in advance.