Hi
From Section 48.4.7 I2Cx_IBDR of Vybrid RM:
In master transmit mode, the first byte of data written to IBDR following assertion of MSSL is used for the address transfer and should comprise the calling address (in position DATA[7:1]) concatenated with the required R/ W bit (in position D0).
That is why I suggested to add the next command
I2C2_IBDR = (SLAVE_ADDR << 1) | I2C_OPERATION_WRITE;
while( 0 == (I2C2_IBSR&QI2C_I2SR_IBIF)) {_PSP_SYNC();}; /* wait for address transferred */
where: I2C_OPERATION_WRITE = 0
However you stated that:
S35390A requires status address writing with R/W bit is set to 1 and then read, but MQX fwrite generates the address with R/W bit is set to 0, therefore reading the register is not possible
fwrite sets the IBDR register with the slave address with the R/W set to 0 (Just as I suggested above).
So, if you said you that S35390A expects a R/W = 1, the you should adjust the I2C_OPERATION_WRITE to be a 1 instead.
Also, this only applies for the FIRST data written to IBDR, next write I think does not need the R/W bit to be set
So, does the S35390A really needs the R/W to be set like below for the next IBDR write??
I2C2_IBDR = (eRTCcommand << 1) | I2C_OPERATION_WRITE;
or be just like
I2C2_IBDR = eRTCcommand
Another option you can try is to modify directly the MQX code for the tx/rx functions called by fwrite/fread to make them suitable for the S35390A expectations.
You can find these functions at Freescale_MQX_4_0\mqx\source\io\i2c\polled\i2c_pol_qi2c.c.
Look for _qi2c_polled_rx (called by fread),
_qi2c_polled_tx (called by fwrite)
and _qi2c_polled_rx_tx functions (called by above functions)