more G-Labs products

Author Topic: How to make MCP23017 module work on i2c  (Read 2825 times)

July 16, 2014, 10:25:58 PM
Read 2825 times

Kohinoor

  • *
  • Information
  • Newbie
  • Posts: 4
Hi!
Im totaly new to this.
Im trying to make a controler for a greenhouse an need many in and out ports.
I have been concidering differnet ways, and the MCP23017 stock example looks promising.

The problem is that I cant make it work. When i activate the module i get:

Line 0, Column 0 (Code to Run):
    Read operation failed with BCM2835_I2C_REASON_ERROR_NACK status

How can i make the module work?

I start from a fresh image of Homegenie on my Pi.
« Last Edit: July 16, 2014, 10:28:11 PM by Kohinoor »

July 16, 2014, 10:59:11 PM
Reply #1

Boeky

  • **
  • Information
  • Jr. Member
  • Posts: 31
Hi,


Have you followed the complete Adafruit tutorial yet?
https://learn.adafruit.com/mcp230xx-gpio-expander-on-the-raspberry-pi/overview

In this tutorial you have to prepare your Raspberry Pi to get the I2C bus working. Didn't you forget this step?
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c

What does i2cdetect tell you. Do you have a deveice connected on 0x20?

Did you connect the 5V permanently to the reset pin of the MCP23017?
Have you grounded all address pins? (For address 0x20)
« Last Edit: July 16, 2014, 11:00:49 PM by Boeky »

July 17, 2014, 12:56:44 PM
Reply #2

Kohinoor

  • *
  • Information
  • Newbie
  • Posts: 4
Thank you!
I was not aware that not all software was configured on the HG image.

I have followed the instructions. This is the result:

pi@raspberrypi ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --   

I dont get anything at 0x20 and i still get the error:

Line 0, Column 0 (Code to Run):
    Read operation failed with BCM2835_I2C_REASON_ERROR_NACK status

Seems the code don't start at all.

any clues?

July 17, 2014, 06:49:35 PM
Reply #3

baptist

  • **
  • Information
  • Jr. Member
  • Posts: 27
I had similar issues previously, I tried everything, in the end resorted to reinstalling HG.
The quickest and easiest way is to download the deb file and run 'sudo gdebi homegenie-beta_1.00.r394_all.deb
« Last Edit: July 17, 2014, 06:51:48 PM by baptist »

July 17, 2014, 09:14:26 PM
Reply #4

Boeky

  • **
  • Information
  • Jr. Member
  • Posts: 31
Hi,


I2Cdetect had nothing to do with homegenie.
It runs directly on raspbian and displays all connected I2C devices on the bus.
If they dont display there, they will never work in homegenie.

Control every step of the tutorials again and make sure you didnt make any mistakes or writing errors.

Are you sure the address pins of the MCP23017 are grounded? (to the GND pin of the raspberry pi.) Make sure not to use a seperate voltage supply or connect the grounds together

Make sure the reset pin of the MPC23017 is always connected to the 5V or 3.3V of the raspberry pi

Make sure the I2C wires (2) are connected to the right pins of the raspberry pi (no crossing like a rx/tx serial system but straight)

Make sure the chip is not dead (wrong supply voltage to wrong pins might killid it during installation or tests)

Last solution : start from a fresh rasbian image an follow the  I2c Adafruit tutorials first, before installing homegenie or other programs

July 17, 2014, 09:38:44 PM
Reply #5

Kohinoor

  • *
  • Information
  • Newbie
  • Posts: 4
Thank you guys for giving me hope to continue!

I started from scratch with a new image, followed adafriuts tutorial step by step and wired all connections again.

Now i´m up and running!

btw: the error message is back again, but is still working.
« Last Edit: July 18, 2014, 01:27:56 PM by Kohinoor »