MCP23017 nano problem

I have a Nano set up to connect to a MCP23017 using the adafruit library to connect
when I try the sketch on the Nano it locks up at the mcp.beginei2c() line.
for reference I am also using the i2cscanner sketch.
now just to check to see i connected it to a uno board same sketches and everything works.

anybody know what might be the problem?


Hi, @jrweikle
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

This will help with advice on how to present your code and problems.

A circuit diagram would be appreciated, hand drawn and photographed is perfectly acceptable.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

the code i am using for testing is located here

I would start by checking each board to determine which is SCL and SDA, not all are the same. Connect A4 to A4 and A5 goes to A5, they do not cross. Be sure to connect the grounds, but if both the Uno and Nano are connected by their USB don't connect the 5V together. You may need external pull up resistors (4.7K). Not knowing your physical layout you may need to add the pull up resistors. Your schematic does not show both as the same. I may be wrong as there are several different board assemblies available. I have always done the following:
Connect SCL to SCL pin (analog 5 on Arduino UNO to analog 5 on Nano)
Connect SDA to SDA pin (analog 4 on Arduino UNO to analog 4 on Nano)

some explanation on the diagram
these are 2 different circuits
1 is the uno to the mcp23017 and associated wiring this circuit works IRL (In Real Life)
the other is the nano to the mcp23017 and associated wiring this circuit does not work IRL

they are wired the same the scl to A5 and sda to a4
(nano and uno ports are the same)

so unless there is something in the internal pull up resistors on the nano i cant figure out what is different

Try external pull up resistors, my nano does not have them. You need something between 2K to 10K depending on bus capacitance. Default for most is 4.7K. The analog pins do not have pull up resistors, they are open drain outputs.

So I don't have a clue why but it is now working properly on the nano

Can you please post picture(s) of your project so we can see your component layout?

Tom... :smiley: :+1: :coffee: :australia:

Currently it is working so I don't k ow why it didn't before