I am trying to use I2C communication using ST NUCLEO-F030R8 with AT24C64 and modifying code generated by STM32CubeMX. When I use HAL_I2C_IsDeviceReady function it returns HAL_OK but HAL_I2C_Mem_Write or HAL_I2C_Mem_Read function returns error
if(HAL_I2C_IsDeviceReady(&hi2c2,0xA0,10,100)==HAL_OK){ sprintf((char*)TxBuff,"\r\ni2c device ready");}else{ sprintf((char*)TxBuff,"\r\ni2c device fail");}if(HAL_I2C_Mem_Write(&hi2c2,0xA0,mem_add,32,&data_send,1,10)==HAL_OK){ sprintf((char*)TxBuff,"\r...