Hello.
I am currently writing an I2c Baremetal function.
and after a long time testing and analyzing the data i could realize that ITCF and RXAK flags does not work as i thought.
after sending a byte to I2c if i try to test either TCF and RXAK both of them are true and i start to overwrite the data register. if i use the code below nothing works. i already found a way to solve that testing the IICIF flag. this one works.
but my question is. doesnot this flags works at all? i am assuming something wrong?
I2C_HAL_WriteByte(I2C0,0xA0);
while((I2C0_S & I2C_S_TCF_MASK )==0){}
I2C_HAL_WriteByte(I2C0,0x00);
while((I2C0_S & I2C_S_TCF_MASK )==0){}
I2C_HAL_WriteByte(I2C0,0x00);
while((I2C0_S & I2C_S_TCF_MASK )==0){}
also if i use RXAK the same problem occurs
I2C_HAL_WriteByte(I2C0,0xA0);
while((I2C0_S & I2C_S_RXAK_MASK )==0){}
I2C_HAL_WriteByte(I2C0,0x00);
while((I2C0_S & I2C_S_RXAK_MASK )==0){}
I2C_HAL_WriteByte(I2C0,0x00);
while((I2C0_S & I2C_S_RXAK_MASK )==0){}
the code below works fine.
I2C_HAL_SendStart(I2C0);
I2C0_S |= I2C_S_IICIF_MASK;
I2C_HAL_WriteByte(I2C0,endereco);
while((I2C0_S & I2C_S_IICIF_MASK)==0){}
I2C0_S |= I2C_S_IICIF_MASK;
I2C_HAL_WriteByte(I2C0,0x00);
while((I2C0_S & I2C_S_IICIF_MASK)==0){}
I2C0_S |= I2C_S_IICIF_MASK;
I2C_HAL_WriteByte(I2C0,0x00);
while((I2C0_S & I2C_S_IICIF_MASK)==0){}