36.3.2 SDA and SCL Pins

The SDA and SCL pins must be configured as open-drain outputs. Open-drain configuration is accomplished by setting the appropriate bits in the Open-Drain Control (ODCONx) registers, while output direction configuration is handled by clearing the appropriate bits in the Tri-State Control (TRISx) registers. Input threshold, slew rate, and internal pull-up settings are configured using the RxyI2C registers. The RxyI2C registers are used exclusively on the default I2C pin locations, and provide the following selections:

  • Input threshold levels:
    • SMBus 3.0 (1.35V) input threshold
    • SMBus 2.0 (2.1V) input threshold
    • I2C-specific input thresholds
    • Standard GPIO input thresholds (controlled by the Input Level Control (INLVLx) registers)
  • Slew rate limiting:
    • I2C-specific slew rate limiting
    • Standard GPIO slew rate (controlled by the Slew Rate Control (SLRCONx) registers)
  • I2C pull-ups:
    • Programmable ten or two times the current of the standard internal pull-up
    • Standard GPIO pull-up (controlled by the Weak Pull-Up Control (WPUx) registers)
Important: The pin locations for SDA and SCL are remappable through the Peripheral Pin Select (PPS) registers. If new pin locations for SDA and SCL are desired, user software must configure the INLVLx, SLRCONx, ODCONx, and TRISx registers for each new pin location. The RxyI2C registers cannot be used since they are dedicated to the default pin locations. Additionally, the internal pull-ups for non-I2C pins are not strong enough to drive the pins; therefore, external pull-up resistors must be used.