i2cMasterDemo Design
This example illustrates how to utilize the Sapphire High-Performance SoC as an I2C master. The program demonstrates the transmission and reception of data, initially with a single byte, and subsequently with a larger chunk of 20 bytes.
By default, the configuration assumes the slave device is set to transmit a 1-byte
register address. For 2-byte register addresses, you need to modify the definition of
WORD_REG_ADDR to 1.
The design displays these messages in a UART terminal:
i2c Master Demo!
Please ensure you 've either connect to a compatible I2C Slave or running the i2CSlaveDemo
with I2C ports connected.
TEST STARTED!
I2C Master Demo completed.
TEST PASSED!
Note: In the event that the I2C slave is not connected to
the I2C Master, the terminal displays up to
TEST STARTED only.