2 Replies Latest reply on Oct 31, 2016 4:01 PM by Intel Corporation

    How to find which I2c bus? on Edison using arduino breakout board

    JoachimLindborg

      I have read piles of doc's and different threads but I'm unable to be sure of which i2c bus to use and what pins to use when hooking up my i2c device.

       

      looking in the hookup guide for the board http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edisonarduino_hg_331191007.pdf

      I have followed the configuation of the ports which gives me that 18/19 should be used

       

      Initiating the i2c according to intel PDF breakoutboard for Io18,Io19

      echo low > /sys/class/gpio/gpio214/direction

      echo high > /sys/class/gpio/gpio204/direction

      echo high > /sys/class/gpio/gpio205/direction

      echo in > /sys/class/gpio/gpio14/direction

      echo in > /sys/class/gpio/gpio165/direction

      echo low > /sys/class/gpio/gpio236/direction

      echo low > /sys/class/gpio/gpio237/direction

      echo in > /sys/class/gpio/gpio212/direction

      echo in > /sys/class/gpio/gpio213/direction

      echo mode1 > /sys/kernel/debug/gpio_debug/gpio28/current_pinmux

      echo mode1 > /sys/kernel/debug/gpio_debug/gpio27/current_pinmux

      echo high > /sys/class/gpio/gpio214/direction

       

      enclosed are the two ways I've tried first to the "SCL/SCA" which is the most obvious, The second using "A4/A5"

       

      the board I use is the MS5803-14BA Pressure Sensor Hookup Guide - learn.sparkfun.com  from spark fun.

      it has the default adress 0x76, end a byte reset command 0x1E

       

      python exampel failing

      >>> import mraa

      >>>

      >>> b=mraa.I2c(0)

      >>>

      >>> b.address(0x76)

      0

      >>>

      >>> b.writeByte(0x1E)

      99

      >>>

       

      So to the question:

      Which I2C bus should i use? 0,1 or 6?

      Which of the connections should I use for i2c? (SCL/SCA" or AI4/AI5)

      The sparkfun sensor board has two pullup resistors on it. With the config above described in the edison documentation the edison itself shouldn't have pullup activated right?

        • 1. Re: How to find which I2c bus? on Edison using arduino breakout board
          0andriy

          It's easy. There is (in newest kernel, but in BSP you may find it as well) a pin mappings in the pinctrl-merrifield.c driver, from which we can see the I2C pins:

           

                 /* Family 7: I2C (14 pins) */

                  PINCTRL_PIN(101, "GP19_I2C_1_SCL"),
                  PINCTRL_PIN(102, "GP20_I2C_1_SDA"),
                  PINCTRL_PIN(103, "GP21_I2C_2_SCL"),
                  PINCTRL_PIN(104, "GP22_I2C_2_SDA"),
                  PINCTRL_PIN(105, "GP17_I2C_3_SCL_HDMI"),
                  PINCTRL_PIN(106, "GP18_I2C_3_SDA_HDMI"),
                  PINCTRL_PIN(107, "GP23_I2C_4_SCL"),
                  PINCTRL_PIN(108, "GP24_I2C_4_SDA"),
                  PINCTRL_PIN(109, "GP25_I2C_5_SCL"),
                  PINCTRL_PIN(110, "GP26_I2C_5_SDA"),
                  PINCTRL_PIN(111, "GP27_I2C_6_SCL"),
                  PINCTRL_PIN(112, "GP28_I2C_6_SDA"),
                  PINCTRL_PIN(113, "GP29_I2C_7_SCL"),
                  PINCTRL_PIN(114, "GP30_I2C_7_SDA"),

                  /* Family 12: MSIC (15 pins) */
                  PINCTRL_PIN(180, "I2C_0_SCL"),
                  PINCTRL_PIN(181, "I2C_0_SDA"),

          Bus 0 is dedicated for MSIC and can't be accessed.

           

          The rest has a GPIO number prefix, and according to the schematics http://www.intel.com/content/www/us/en/support/boards-and-kits/000005829.html (page 10) the buses are 1 and 6:

          I2C1_SCL     GP19 6,7,11

          I2C1_SDA     GP20 6,7,11

           

          I2C6_SCL     GP27 6,11

          I2C6_SDA     GP28 6,11

           

          1 of 1 people found this helpful
          • 2. Re: How to find which I2c bus? on Edison using arduino breakout board
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi JoachimLindborg,

            Did you tried 0andriy recommendation? It was useful?

            Let us know if you still have issues.

            Regards,
            -Leonardo