Serial Data (SDL) and Serial Clock (SCL) are the two signal connections used for communication in the I2C protocol. Both SDL and SCL are open-drain lines, meaning that each pin requires a pull-up resistor to bring the signal high when it is not being driven low by the I2C module hardware. The I2C specification proposes two methods to determine the correct pull-up resistor size, both of which can be used to calculate and appropriate range for pull-up resistors in specific applications.
The first method is to calculate the maximum pull-up resistor size as a function of the total bus capacitance (CBUS) and maximum rise time (TRISE). Bus capacitance is total capacitance of the bus wires/traces, connection points, pins, all of which must be considered when calculating the total bus capacitance. Rise time is the period in which the signal transitions from VILMAX to VIHMIN and can typically be found in the device data sheet. To achieve the most accurate pull-up values using this method, the total bus capacitance would need to be measured. Rather than attempting to measure the total bus capacitance, the maximum allowable bus capacitance as defined by the I2C specification can be used instead.
Example 8-1 demonstrates how the maximum pull-up resistor size can be calculated using the I2C module on the microcontroller in Fast mode (400 kHz). The value used for the maximum rise time can be found in the I2C bus data requirements in the Electrical Specification section of the device data sheet. The maximum allowable bus capacitance must meet the maximum rise time in this application (300 ns) and is about 200 pF, as defined by the I2C specification.
The second method calculates the minimum pull-up resistor size as a function of VDD. VDD limits the minimum resistor value that can be used as a pull-up due to the specified minimum sink current (IOL) of 3 mA for I2C in Standard mode (100 kHz) and Fast mode (400 kHz), or 20 mA for Fast mode plus (1 MHz). Example 8-2 demonstrates how the minimum pull-up resistor size can be calculated when using the I2C module on the PIC18F57Q43 microcontroller in Fast mode (400 kHz). In this example, it can be assumed the PIC18F57Q43 is operating at a VDD of 3.3V and has a maximum output low voltage (VOL (max)) of 0.7V. The maximum output low voltage can typically be found in the Electrical Specifications section of the device data sheet.