14.3.2.1.1 Software Design Flow
I2C Master Mode
The I2C instance I2C_0 can be initialized by using MSS_I2C_init API. See the SmartFusion2_MSS_I2C_Driver_UG to use the I2C initialization API.
Write Operation
Write data to the target slave device using MSS_I2C_write API. This API ensures the presence of I2C_0 in Master mode for write transactions. The following parameters are required to use the I2C write API:
- Target slave device address (Ex.EEPROM)
- Data which is to be written to the target device
- Data size in bytes
Read Operation
Read data from the target slave device using MSS_I2C_read API. This API ensures the presence of I2C_0 in Master mode for read transactions. The following parameters are required to use the I2C read API:
- Target slave device address (Ex.EEPROM)
- Data buffer to collect the data from the target device
- Data size in bytes
For any I2C read or write transaction to complete, MSS_I2C_wait_complete API should be called. This API waits for the current I2C transaction to complete.