Running a MCP23017 on 5V

apuder
Posts: 53
Joined: Mon Mar 26, 2018 7:27 pm

Running a MCP23017 on 5V

Postby apuder » Sun Feb 16, 2020 6:43 pm

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

username
Posts: 528
Joined: Thu May 03, 2018 1:18 pm

Re: Running a MCP23017 on 5V

Postby username » Mon Feb 17, 2020 3:31 am

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

apuder
Posts: 53
Joined: Mon Mar 26, 2018 7:27 pm

Re: Running a MCP23017 on 5V

Postby apuder » Mon Feb 17, 2020 4:51 am

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

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: Running a MCP23017 on 5V

Postby ESP_Sprite » Mon Feb 17, 2020 10:08 am

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.

kissinno
Posts: 10
Joined: Tue Apr 14, 2020 11:31 am

Re: Running a MCP23017 on 5V

Postby kissinno » Tue Aug 11, 2020 6:22 am

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?

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: Running a MCP23017 on 5V

Postby ESP_Sprite » Tue Aug 11, 2020 10:38 am

That should work. I would still advise against using the internal pull-ups, though; just add those two resistors, they're cheap anyway.

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

Re: Running a MCP23017 on 5V

Postby martinayotte » 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.

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: Running a MCP23017 on 5V

Postby ESP_Sprite » 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.

apuder
Posts: 53
Joined: Mon Mar 26, 2018 7:27 pm

Re: Running a MCP23017 on 5V

Postby apuder » Wed Aug 12, 2020 2:44 pm

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

kissinno
Posts: 10
Joined: Tue Apr 14, 2020 11:31 am

Re: Running a MCP23017 on 5V

Postby kissinno » Thu Aug 13, 2020 8:06 am

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().

Who is online

Users browsing this forum: Google [Bot] and 175 guests