- Set direction of transfer as write and clear the FIFO’s. Write
0x40to i2c.Control_reg0. - Clear Interrupts. Read and write back the read value to i2c.Interrupt_status_reg0.
- Enable Timeout, NACK, TX Overflow, Arbitration lost, DATA, Completion
interrupts. Write
0x24Fto the i2c.Intrpt_en_reg0 register. - Enable bus HOLD logic. Set i2c.Control_reg0 [HOLD] if the write data count is greater than the FIFO depth.
- Calculate the space available in FIFO. Subtract the i2c.Transfer_size_reg0 value from the FIFO depth.
- Fill the data into FIFO. Write the data to i2c.I2C_data_reg0 based on the count obtained in step 5.
- Write the slave address. Write the address to the i2c.I2C_address_reg0 register.
- Wait for data to be sent. Check for i2c.Interrupt_status_reg0 [COMP] to be
set.
- If further data is to be written, repeat steps 5, 6 and 8.
- If there is no further data, set i2c.Control_reg0 [HOLD] = 0.
- Wait for completion of transfer. Check for i2c.Interrupt_status_reg0 [COMP] to be set.