Step 2.1: Configure I²C Peripheral Library and I²C Pins
1
Under the Available Components tab, expand Peripherals > SERCOM.
Double click on SERCOM2 to add the SERCOM instance 2 to the project.
Select the SERCOM 2 Peripheral Library and configure it for the I²C protocol.
- The SERCOM2 (as I²C) retains the default 100 kHz speed because the temperature sensor chip on the I/O1 Xplained Pro Extension Kit can operate at 100 kHz I²C speed.
- The SERCOM2 (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 the temperature sensor chip (AT30TSE758).
- The SERCOM2 (as I²C) retains the default 100 nanoseconds for I2C Trise time because it aligns with the maximum (300 nanoseconds) input rise time in the specification of the temperature sensor chip (AT30TSE758).
3
Select the MHC Pin Settings tab and sort the entries by Ports.
Now, select the MHC Pin Table tab and then scroll down to the SERCOM2 module as follows.
- Enable I²C Clock (I2C_SCK)(SERCOM2_PAD1) on Pin #22 (PA13)
- Enable I²C Data (I2C_SDA)(SERCOM2_PAD0) on Pin #21 (PA12)
When a peripheral is added to the project, the peripheral clock is automatically fed by the GCLK0.
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 temperature sensor.
Step 2.2: Configure Universal Synchronous Asynchronous Receiver Transmitter (USART) Peripheral Library, USART Pins, and link STDIO Library
1
Under the tab Available Components tab, expand Peripherals > SERCOM.
Double click on SERCOM0 to add the SERCOM instance 0 to the project.
Associate STDIO tool with SERCOM instance 0 (USART) peripheral by right clicking on the yellow diamond.
Select the SERCOM0 Peripheral Library in the Project Graph, verify default SERCOM Operation Mode configuration is set as USART and configure it.