Overview

The MCP23017 is a 16-bit general-purpose parallel I/O expander for the I2C bus manufactured by Microchip Technology. It provides 16 individual GPIO pins divided into two 8-bit ports (GPIOA and GPIOB).

Unlike quasi-bidirectional expanders (such as PCF8574), the MCP23017 contains explicit direction registers (IODIRA/IODIRB), internal 100 kΩ100\text{ k}\Omega pull-up resistors, input polarity inversion, and two configurable interrupt pins (INTA/INTB) with change-of-state detection.

Quick reference

Operating voltage (VDD)1.8 V to 5.5 V DC
I2C bus clock speed100 kHz (Standard), 400 kHz (Fast), 1.7 MHz (High-Speed)
I/O ports16 General-Purpose I/O pins (GPA0GPA7, GPB0GPB7)
Maximum current per pin25 mA sink or source
Maximum total current125 mA (VSSV_{SS}) / 150 mA (VDDV_{DD})
I2C slave address0x20 to 0x27 (selectable via hardware pins A0, A1, A2)
Interrupt outputs2 Open-drain / Push-pull interrupt pins (INTA, INTB)

Pinout

28-Pin DIP / SOIC Package

text
           ┌──────────┐
    GPB0 ──│ 1     28 │── GPA7
    GPB1 ──│ 2     27 │── GPA6
    GPB2 ──│ 3     26 │── GPA5
    GPB3 ──│ 4     25 │── GPA4
    GPB4 ──│ 5     24 │── GPA3
    GPB5 ──│ 6     23 │── GPA2
    GPB6 ──│ 7     22 │── GPA1
    GPB7 ──│ 8     21 │── GPA0
     VDD ──│ 9     20 │── INTA
     VSS ──│ 10    19 │── INTB
      NC ──│ 11    18 │── RESET*
     SCL ──│ 12    17 │── A2
     SDA ──│ 13    16 │── A1
      NC ──│ 14    15 │── A0
           └──────────┘
PinNameTypeDescription
1–8GPB0GPB7Digital I/OPort B general purpose I/O pins
9VDDPowerPositive supply voltage (+1.8 V to +5.5 V DC)
10VSSPowerGround (0 V)
12SCLDigital InputI2C Serial Clock input
13SDADigital I/OI2C Serial Data line
15–17A0A2Digital InputHardware address inputs
18RESETDigital InputActive-LOW hardware reset pin (Must be tied to VDD for normal run)
19–20INTB, INTADigital OutputPort B & Port A interrupt output pins
21–28GPA0GPA7Digital I/OPort A general purpose I/O pins

Specifications

ParameterSymbolMinTypMaxUnitConditions
Supply VoltageVDDV_{DD}1.83.3 / 5.05.5VDC
Standby CurrentIDDSTBI_{DDSTB}1.05.0µAVDD=5.5 VV_{DD} = 5.5\text{ V}, IIO=0I_{IO} = 0
Operating CurrentIDDI_{DD}1001000µAfSCL=400 kHzf_{SCL} = 400\text{ kHz}
Input Low VoltageVILV_{IL}VSSV_{SS}0.2VDD0.2 V_{DD}V
Input High VoltageVIHV_{IH}0.8VDD0.8 V_{DD}VDDV_{DD}V
Output Low VoltageVOLV_{OL}0.6VIOL=8.5 mAI_{OL} = 8.5\text{ mA}, VDD=5.0 VV_{DD} = 5.0\text{ V}
Output High VoltageVOHV_{OH}VDD0.7V_{DD} - 0.7VIOH=3.0 mAI_{OH} = -3.0\text{ mA}, VDD=5.0 VV_{DD} = 5.0\text{ V}
Internal Pull-up ResistanceRPUR_{PU}50100150Configurable via GPPUA/GPPUB

Key Registers (IOCON.BANK = 0 default)

Address (Port A / B)RegisterAccessDescription
0x00 / 0x01IODIRA / IODIRBR/WI/O Direction (1 = Input, 0 = Output; Reset default: 0xFF)
0x02 / 0x03IPOLA / IPOLBR/WInput Polarity Inversion (1 = Inverted logic)
0x04 / 0x05GPINTENA / GPINTENBR/WInterrupt-on-Change Enable (1 = Enabled)
0x06 / 0x07DEFVALA / DEFVALBR/WDefault Compare Register for Interrupts
0x0C / 0x0DGPPUA / GPPUBR/WPull-up Resistor Enable (1 = Enable 100 kΩ100\text{ k}\Omega pull-up)
0x12 / 0x13GPIOA / GPIOBR/WPort Register (Read input values / Write output latches)
0x14 / 0x15OLATA / OLATBR/WOutput Latch Register

Wiring

MCP23017 PinMicrocontroller (Arduino / ESP32)Notes
VDD (Pin 9)5V (or 3.3V)Power supply
VSS (Pin 10)GNDGround
RESET (Pin 18)VDD (via 10kΩ pull-up)Must be pulled HIGH to prevent hardware resets
SDA (Pin 13)SDAI2C Data line
SCL (Pin 12)SCLI2C Clock line
A0, A1, A2GNDTie to GND for base address 0x20
Warning

Floating RESET Pin Failure: Pin 18 (RESET) is active-LOW. Leaving RESET unconnected/floating causes random device resets and lost configuration state. Always connect Pin 18 to VDD directly or through a 10 kΩ10\text{ k}\Omega resistor.

Common mistakes

  • Leaving RESET pin floating: Causes erratic dropouts on the I2C bus.
  • Forgetting IODIR default is INPUT: All pins power up as inputs (0xFF). Pins intended as outputs must be explicitly cleared to 0 in IODIRA/IODIRB before writing values to GPIOA/GPIOB.
  • Mixing up MCP23017 (I2C) and MCP23S17 (SPI): MCP23017 uses I2C; MCP23S17 uses SPI. Their pinouts and protocol commands are not interchangeable.

Notes

  • Up to 8 MCP23017 chips can share the same I2C bus by configuring address pins A0A2 (0x20 to 0x27).

Assets & downloads