whiteshepherd
Posts: 73
Joined: Thu Nov 03, 2011 7:59 pm

MCP23017-E/SP not found?

Thu May 14, 2015 4:48 pm

Ok, this is my first attempt at using the Raspberry Pi GPIO so perhaps I made a NOOB mistake someone can point out for me?

I decided it would be fun to make a spaceship out of painted wood the kids could go inside and add blinking lights/switches old Star Trek style. I know there is limited GPIO ports on the Raspberry Pi so after a little research I ordered x5 MCP23017-E/SP chips which should control all the LEDs, switches, levers, and POTs.

I decided to test on just one MCP23017-E/SP first before chaining them. My Pi is a v1 with 256MB (got it the first 2 weeks they started selling). I downloaded the latest Rasbian yesterday and in the initial boot raspconfig I enabled SSH and I2C in advanced menu (nothing else was changed). I edited /etc/modules and added:
i2c-bcm2708
i2c-dev

I then ran as root:
apt-get update
apt-get install -y python-smbus i2c-tools

Rebooting lsmod | grep i2c_ gives me:
i2c_dev 6709 0
i2c_bcm2708 6200 0

As far as connections from chip to my Pi:
Pin 9 (VDD) to +3.3V
Pin 10 (VSS) to Ground
Pin 12 (SCL) to Pin 5 on Pi
Pin 13 (SDA) to Pin 3 on Pi
Pin 18 (Reset) to +3.3V
Pins 15, 16 & 17 to Ground

When I run (as root) i2cdetect -y 0 I get:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

So the chip is not detected? I have gone over all my connections carefully and used a volt meter to check power is going to the MCP23017-E/SP. I have even swapped 23017 chips on the off chance the chip was bad.

I am now at a loss why I cannot see the chip with I2C. Any one with more experience can point me in the right direction or what I might be missing?

User avatar
joan
Posts: 14878
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: MCP23017-E/SP not found?

Thu May 14, 2015 5:19 pm

Everything you've done sounds okay. Could you post a photo of your set-up?

whiteshepherd
Posts: 73
Joined: Thu Nov 03, 2011 7:59 pm

Re: MCP23017-E/SP not found?

Thu May 14, 2015 6:35 pm

My old phone does not take great pictures. But here is what I got.

Wire color:
Red +3.3V
Brown Ground
Black Ground
Orange SDA
Yellow SCL
Little white jumper wires (spares I had) from left to right:
+3.3 to reset
Ground to Vss
+3.3 to Vdd

The wires above is just a RGB LED I have not hooked up yet (till the extender is working). If you see a mistake I'd love to know.

Image

User avatar
joan
Posts: 14878
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: MCP23017-E/SP not found?

Thu May 14, 2015 7:09 pm

Unfortunately, I can see nothing wrong.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5578
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: MCP23017-E/SP not found?

Thu May 14, 2015 9:17 pm

This may be a "red herring" but when I've used a MCP23017 (or the single port MCP23008) I've not connected the RESET pin directly to Vdd, but via a pull-up resistor (8K2) to ensure that the pin does see a (short) /RESET (low) signal. (I also tend to power them with Vdd=5V since they can still be O.K. with 3.3V logic levels from the Pi **, but may be more reliable with level-shifters interposed ****).
Trev.
** FWIW, see this example:
http://www.cpmspectrepi.webspace.virgin ... OfPio.html (some info. now old)
**** and others, with level shifters:
http://www.cpmspectrepi.webspace.virgin ... oFull.html
http://www.cpmspectrepi.webspace.virgin ... alLCD.html
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
mikronauts
Posts: 2774
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: MCP23017-E/SP not found?

Thu May 14, 2015 9:55 pm

Looks ok to me too.

Perhaps you have a defective MCP23017?

I'd try another one.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

danjperron
Posts: 3499
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: MCP23017-E/SP not found?

Fri May 15, 2015 12:38 am

Did you try to put 5V on the MCP23017.

It won't hurt the Pi since the SDA and SLA are open collector type.

http://www.mathworks.com/help/supportpk ... 23017.html

Also you should add a small capacitor between the GND and VDD pin to prevent glitches. ~0.1µF.


And like the last post said used a 1K pull-up resistor to the reset pin. pull-up to 5V if you use 5V.

But if you add pull-up to SLA or SDA keep it at 3.3V. Maybe Try to add 10K pull-up on the I2C bus, SLA and SDA, in case of one of your resistor has been removed.

whiteshepherd
Posts: 73
Joined: Thu Nov 03, 2011 7:59 pm

Re: MCP23017-E/SP not found?

Fri May 15, 2015 4:51 am

Ok, thanks for the help so far. Here is where I am with the suggestions. I took a meter and tested all the wires good. I tried using 2 different MCP23017 chips. I then tried using resistors on the reset. I have a variable power supply. So I then disconnected power from the Pi. I tried adding a capacitor (only had a 1.5F 5.5v on hand, overkill but should work) and connected it across Vdd and Vss. I then powered it with 5V DC from the power supply. All provided the same result. Nothing seen at any address.

I'm beginning to wonder if the new kernel has issues with the v1 Raspberry Pi? I could try an older version of Raspbian or try another Pi (I have 2 more of the ver1 Pi but nothing newer). Perhaps in the morning I will try those ideas. Anyone else have any suggestions? It looked pretty straight forward from the tutorials. Hope there is a break. Would love to finish this space ship.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5578
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: MCP23017-E/SP not found?

Fri May 15, 2015 7:13 am

whiteshepherd wrote: ...
I'm beginning to wonder if the new kernel has issues with the v1 Raspberry Pi? I could try an older version of Raspbian or try another Pi (I have 2 more of the ver1 Pi but nothing newer). Perhaps in the morning I will try those ideas. Anyone else have any suggestions? It looked pretty straight forward from the tutorials. Hope there is a break. Would love to finish this space ship.
TBH I've never tried the new(est) kernel/version of Raspbian on my B1 Pi** - most of my "GPIO/I2C/SPI stuff" is running on an updated B+ or A+ and, occasionally on the P2B. FWIW, if you want to download and revert to any older (pre-P2B?) images (or NOOBS installed equivalent) the archives are here:
http://downloads.raspberrypi.org/raspbian/images/
http://downloads.raspberrypi.org/NOOBS/images/
W.r.t. the new kernel, you may find you (still) need to do something that's discussed here:
viewtopic.php?f=28&t=97314
Trev.
** It's mainly used to run the wiki from which I export my "Raspberry Pi Webpages" (see sig.) and thus, rarely updated "If it ain't broke, don't fix it " ;)
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
joan
Posts: 14878
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: MCP23017-E/SP not found?

Fri May 15, 2015 7:48 am

I suggest you install wiringPi or my pigpio library. I think some diagnostic tools may be needed (at some stage, even if not now).

danjperron
Posts: 3499
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: MCP23017-E/SP not found?

Fri May 15, 2015 11:01 am

I do have an old Pi B rev 1 in spare. It is used for my pond temperature controller in winter.

I installed the newest raspian and followed exactly what you did and the i2c works!
I do not have a mcp23017 on hand but I tried a pcf8574.

If the 5V didn't work , but it back to 3.3V and use a gpio to reset it before doing i2cdetect. Just toggle off and on the reset pin.

Maybe move the I.C. in another place on the breadboard just in case you have a bad contact.

Could you try some other i2c component?

Check you gpio 0 and 1 using python in IN and OUT mode just in case one of the GPIO is damaged.

whiteshepherd
Posts: 73
Joined: Thu Nov 03, 2011 7:59 pm

Re: MCP23017-E/SP not found?

Sat May 16, 2015 3:42 am

I had another v1 Pi I had turned into a UV camera. With much reservation I took it apart and swapped the Pis. Still no detection. I then downloaded a older version of of the OS. Still no detection. I'm down to perhaps all 5 chips the vendor sold me were bad?

User avatar
mikronauts
Posts: 2774
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: MCP23017-E/SP not found?

Sat May 16, 2015 4:21 am

Try another i2c device, but it sounds like you got a batch of bad chips.
whiteshepherd wrote:I had another v1 Pi I had turned into a UV camera. With much reservation I took it apart and swapped the Pis. Still no detection. I then downloaded a older version of of the OS. Still no detection. I'm down to perhaps all 5 chips the vendor sold me were bad?
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
joan
Posts: 14878
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: MCP23017-E/SP not found?

Sat May 16, 2015 7:55 am

As a last gasp perhaps buzz through each wire used (between breadboard to Pi and breadboard to breadboard).

Return to “Interfacing (DSI, CSI, I2C, etc.)”