AnsweredAssumed Answered

i2c register read back problem

Question asked by unknown issuee on Oct 21, 2019
Latest reply on Nov 7, 2019 by Raymundo Velarde

i want to give the code which it includes my question.


i forget specifying that processor is t1042.


I2C_Status is structure and defined as volatile keyword.


while(I2C_Status->RXAK != ACK_SIG);


if ( I2C_Status->RXAK != ACK_SIG)


     printf("we got an ack from slave because "while loop" is broken, it is weird because now it's like we didnt get an ack from slave");



if i put a delay before if condition, printf in if condition is not printed and , this means everyting is okay but if i dont put a delay before if condition, how come i dont know  printf in if condition is printed. it's weird.


why i should put a delay to read again same register ? i guess this problem is about reading consecutively same register but i dont know the technique reason  ? can you explain for me ?


thanks in advance.