Rapid Prototyping with 32-bit MCU-based Curiosity Nano Evaluation Kit Using MPLAB Harmony v3 Software Framework: Step 2

Step 2.1: Configure I²C Peripheral Library and I²C Pins

1

Under the Available Components tab, expand Peripherals > SERCOM.

Double click on SERCOM0 to add the SERCOM instance 0 to the project.

sercom_selection.png

Select the SERCOM0 Peripheral Library and configure it for the I²C protocol.

sercom_setup.png
  • The SERCOM0 PORT pins coming to mikroBUS socket #2 and mikroBUS socket #3 as I²C lines from PIC32CM MC00 MCU connect to the Fan and Weather Click boards.
  • You are using just one I²C peripheral instance in the MCU (SDA and SCL lines), acting as an I²C host to interface with two different I²C clients. One is the Fan Click board, and the other one is the Weather Click board connected through the mikroBUS connectors.
  • The I²C client (Fan Click module and Weather Click module) have different addresses for identification.
  • The SERCOM0 (as I²C) retains the default 100 kHz speed because the Weather Click and Fan Click can operate at 100 kHz I²C speed.
  • The SERCOM0 (as I²C) retains the default 50-100 nanoseconds hold time for Serial Data (SDA) Hold Time because it aligns with the minimum (50 nanoseconds) start hold time in the specification of Click boards.
  • The SERCOM0 (as I²C) retains the default 100 nanoseconds for I²C Trise time because it aligns with the maximum (300 nanoseconds) input rise time in the specification of the Click boards.

Note: "Master" and "Slave" terminology has been replaced on this page with the equivalent Microchip terminology "Host" and "Client" respectively.

2

Open the Pin Configuration tab by clicking MHC > Tools > Pin Configuration.

open_pin_configuration.png

3

The mikroBUS socket #2 and socket #3 design schematic for the PIC32CM MC00 Curiosity Nano Evaluation Kit and Curiosity Nano Base Board are shown below.

Note: The highlighted (encircled red box) I²C lines coming onto the mikroBUS socket #2 and mikroBUS socket #3 are connected to the Fan Click and Weather Click respectively.

sercom_i2c_schematic.png

Select the MHC Pin Settings tab and sort the entries by Ports names.

sercom_pins_setup_1.png

Now, scroll down to the PA08 and PA09 pins and configure as follows.

  • Configure I²C Clock (SCL) on PA09 (Pin #12)
  • Configure I²C Data (SDA) on PA08 (Pin #11)
sercom_pins_setup_2.png

This completes the configuration of the I²C peripheral library. The application code will use the I²C PLIB Application Programming Interfaces (APIs) to read the temperature from the Weather Click and send commands to the Fan Click to control the 5V DC fan.



Next Step >

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.