i dont need to use packed attribute because its size is already power of two or it's not out of aligment and no need to add pad by compiler
It doesn't matter, I have found when porting code between processors+compilers that in some you still have to use "packed" or it doesn't work.
I would just avoid it and use mask, it's more portable. Also try waiting until the bus is idle, that way you know RXAK is valid.
#define RXAK_MASK 0x80
#define MBB_MASK 0x04
while (*I2C_I2CSR & MBB_MASK) { }
while (*I2C_I2CSR & RXAK_MASK) { }
if (*I2C_I2CSR & RXAK_MASK)
{
...
}
And I would also add timeouts to the while loops to avoid hanging up if the condition never becomes false.
By the way, the problem is very likely caused by checking for the ACK before the frame is sent by the hardware and the ACK you see initially is for the previous frame.