Go Down

Topic: MCP23017 pullup resistors (Read 8389 times) previous topic - next topic


Feb 13, 2013, 07:38 pm Last Edit: Feb 14, 2013, 12:01 am by Lurkars Reason: 1
Hope this is the right category.

First: The MCP23017 work fine for me with switch buttons with 220R. It would be much easier to use the internal pullup resistors, but I do not get this to work.  I simply want to extend this http://arduino.cc/en/Tutorial/InputPullupSerial to the MCP23017-Inputs. Is this possible?

I found this code:
Code: [Select]
Wire.beginTransmission(0x20); //23017 address
Wire.write(0x12); // set MCP23017 memory pointer to GPIOA address
Wire.write(0xFF); //enable pullup???

source: http://www.gammon.com.au/forum/?id=10945

but that does not seem to work and I cannot find a better tutorial.


The chip documentation reads "corresponding port pin is internally pulled up with a 100 k? resistor"  when you set the register 0x0C  (not sure why you have 0x12)  to "1".  In your case "all" due to the 0xFF.

Nick's Example Shows :
Code: [Select]
expanderWriteBoth (GPPUA, 0xFF);   // pull-up resistor for switch - both ports

...where GPPUA is defined as : #define GPPUA    0x0C

So maybe that is part of the issue?

To me, 100K is a damn weak pull up... so weak in fact  that I would tend to ignore it even exists.


yes, the register address was wrong, I thought it act like the arduino internal pull-up by just writing HIGH to all inputs, that's why I used 0x12. Reading the documentation would have helped. It all work fine now. 100K is bigger than the internal pullup of the arduino pins with 20K, and I just connect switch buttons to it, so I think it will work for me. So thank you, problem is solved!

Go Up