Page 1 of 2

Running a MCP23017 on 5V

Posted: Sun Feb 16, 2020 6:43 pm
by apuder
Hi,

I want to use the MCP23017 port expander for a project. The logic I'm driving with the MCP23017 is on 5V so I want to use 5V to power the MCP23017. My question is: since SDA and SDC are open drain connections on the I2C bus, is it OK to use the ESP to drive the MCP23017? The ESP has internal pullups to 3.3V on its I2C port so I think it should be fine. However, the datasheet for the MCP23017 has some AC characteristics in section 1.2: http://ww1.microchip.com/downloads/en/D ... 01952C.pdf

It shows a pullup to VDD in that schematics. Is that an internal pull in the MCP23017? I could not find any indication.

Long in short: is it OK to connect an ESP via I2C to a MCP23017 running on 5V without any level-shifters?

TIA,
AP

Re: Running a MCP23017 on 5V

Posted: Mon Feb 17, 2020 3:31 am
by username
That AC diagram your referring to is to show what the pin with those loads will meet for the timing specifications.
Yes, you can power the MCP23017 from 5V. The only thing you need to do is run your 2 pullup resistors to +3.3v and not +5v

Re: Running a MCP23017 on 5V

Posted: Mon Feb 17, 2020 4:51 am
by apuder
Thanks for your response. Just to clarify on the pull-ups: the built-in pull-ups that get enabled with sda_pullup_en and scl_pullup_en of i2c_config_t are sufficient, correct?

AP

Re: Running a MCP23017 on 5V

Posted: Mon Feb 17, 2020 10:08 am
by ESP_Sprite
It could work but wouldn't count on it if you want a high-speed bus: internal pull-ups are 50K'ish while I2C normally wants something in the 5K range.

Re: Running a MCP23017 on 5V

Posted: Tue Aug 11, 2020 6:22 am
by kissinno
I'm gonna to do MCP23017 +5V supply with fast I2C ESP32 3.3V and INTA/INTB.

I will have a short I2C length (5cm), so I'm not sure if I really need strong pull-up resistors (5kohm) for SDA and SCL at 400kHz or 1.7MHz. So, I think that I will first test with the internal 30...50kohm pull-up ESP32. If it does not work, I could always add 2pcs 5k later on.

However, I'm gonna to use MCP23017 with its INTA output. There, INTA 5V output signal could domage ESP32 irremediably. Therefore, I will apply not a voltage shifter but just 2 stupide resistors as voltage divider to step down INTA to 3V, to be compatible to ESP32 GPIO. Does it look correct?

Anybody who has ever try MCP23017 5V supply with INTA/INTB link to ESP32 GPIO?

Re: Running a MCP23017 on 5V

Posted: Tue Aug 11, 2020 10:38 am
by ESP_Sprite
That should work. I would still advise against using the internal pull-ups, though; just add those two resistors, they're cheap anyway.

Re: Running a MCP23017 on 5V

Posted: Tue Aug 11, 2020 4:14 pm
by martinayotte
Here is a quote from MCP23017 specs :
The INTn interrupt output can be configured as active-
low, active-high or open-drain via the IOCON register.

Re: Running a MCP23017 on 5V

Posted: Wed Aug 12, 2020 9:38 am
by ESP_Sprite
martinayotte wrote:
Tue Aug 11, 2020 4:14 pm
Here is a quote from MCP23017 specs :
The INTn interrupt output can be configured as active-
low, active-high or open-drain via the IOCON register.
However, do note that by default it's not an open-drain configuration, so in theory you can have a startup scenario where the chip will output 5V on the pin. I'd personally not be comfortable with that.

Re: Running a MCP23017 on 5V

Posted: Wed Aug 12, 2020 2:44 pm
by apuder
ESP_Sprite wrote:
Wed Aug 12, 2020 9:38 am
martinayotte wrote:
Tue Aug 11, 2020 4:14 pm
Here is a quote from MCP23017 specs :
The INTn interrupt output can be configured as active-
low, active-high or open-drain via the IOCON register.
However, do note that by default it's not an open-drain configuration, so in theory you can have a startup scenario where the chip will output 5V on the pin. I'd personally not be comfortable with that.
The specs say that on POR the default is to have interrupts disabled (GPINTEN register). So it is possible to configure that pin as open drain and then enable interrupts. That is what I have been doing and it is working as expected.

AP

Re: Running a MCP23017 on 5V

Posted: Thu Aug 13, 2020 8:06 am
by kissinno
Thanks you very much for all your valuable comments.

My I2C:
ADS1115 : 100kHz, 400kHz, 3.4MHz
ADS1115 : 100kHz, 400kHz, 3.4MHz
MCP23017 :100kHz, 400kHz, 1.7MHz
I don't want to apply several I2C bus's, so I will have to limit to 400kHz. For 400kHz with 5cm bus, internal R's should be OK. At least, it is worth to try.

I was not aware of this open-drain INT output but I like it! I will re-investigate Datasheet....

Apuder, can't you share an SW exemple how to configure MCP23017 INT open-drain at boot? I guess this is only few line inside void setup().