1.17 I2C SMBUS read write
This example application demonstrates how to use the I2C peripheral to exchange data between a device acting as a SMBUS master and SMBUS slave.
Description
This example uses two instances of I2C peripheral. Each instance of I2C is configured as both I2C/SMBUS master and I2C/SMBUS slave. SMBUS master of I2C peripheral instance 1 talks to SMBUS slave of I2C peripheral instance 2. Similarly, SMBUS master of I2C peripheral instance 2 talks to SMBUS slave of I2C peripheral instance 1. The data is exchanged using the standard SMBUS data transfer formats - Write/Read word, Write Bulk, Read Bulk, Write-Read Bulk etc. Each slave always echoes the data it receives from the SMBUS master.
Downloading and Building the Application
To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file. This content can also be downloaded using content manager by following these instructions.
Path of the application within the repository is apps/i2c/smbus_master_slave/smbus_read_write/firmware.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
pic32mk_mcm_curiosity_pro.X | MPLABX project for PIC32MK MCM Curiosity Pro Board |
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
pic32mk_mcm_curiosity_pro.X | PIC32MK MCM Curiosity Pro Board |
Setting Up PIC32MK MCM Curiosity Pro Board
- Connect a wire from SDA4 on mikroBUS header J300 to SDA2 on mikroBUS header J301
- Connect a wire from SCL4 on mikroBUS header J300 to SCL2 on mikroBUS header J301
- Connect micro USB cable to the 'USB Debug' connector on the board to the computer
Running the Application
- Build and program the application using its IDE
- LED is turned ON when the data
transfer is successful.Following table provides LED names:
Board LED Name PIC32MK MCM Curiosity Pro Board LED1