6 Replies Latest reply on Dec 26, 2015 3:38 PM by dethSwatch

    I2C controllers


      I'm a little confused about the available I2C controllers on the Edison and Arduino breakout board. According to the Edison Product Brief (Edison Product Brief_20140908b.pdf), only 1 I2C controller is available on the breakout, but the Edison itself has 2 I2C controllers and they are both indeed broken out on the Arduino breakout board (on SCL/SDA port as well as A4/A5).


      Looking deeper at the code, the Wire.h file for Edison also only defines one I2C interface:

      #define I2C2 0x4819c000                                                                              

      #define I2C1 0x00000000                                                                              

      #define WIRE_INTERFACES_COUNT 1 


      Any chance this library could be updated so that the SDA/SCL pins on the adapter board can be used? I can make this change manually on my side in the meantime, but does anyone know what the address for I2C1 should be?


      (A little background: we created a custom breakout board for the Edison and we're using I2C1 for our I2C pins. But as it turns out, the Arduino library points to I2C6 and while we can patch the IDE to get this to work, it makes sense to have the library support both I2C interfaces since they are both indeed available.)

        • 1. Re: I2C controllers

          According to the schematic (https://communities.intel.com/servlet/JiveServlet/downloadBody/23309-102-1-27413/edison_arduino_hvm_8_26.pdf) only I2C6 is brought out to the arduino headers both as A4/A5 (on the 'analog' headers) and SDA/SCL (on the 'digital' headers). I tested my board with my multimeter, and indeed A4 and SDA(on the 'digital' headers) have continuity  and A5 and SCL have continuity.


          The reason I2C1 is not brought out on the Arduino Edison board headers is because I2C1 is used to provide all of the pin-muxing capabilities.


          I do agree that having the ability to target both I2C1 and I2C6 on the mini-breakout from within the Arduino IDE would be a nice thing to have for people who want to stick with 'Wiring/Arduino' as the programming interface.

          • 2. Re: I2C controllers

            Ah, okay. Thanks for clarifying. Do you have any idea how I can change "#define I2C2 0x4819c000" to point to I2C1 instead?

            • 3. Re: I2C controllers

              Turns out there's a hardcoded #define that points the I2C adapter to I2C6.


              In hardware/arduino/edison/cores/arduino/i2c.c:


              int i2c_getadapter(uint32_t i2c_bus_address)


                      /* Single adapter supported for now.  */

              #if 0

                      char buf[MAX_BUF];

                      DIR *d;

                      struct dirent *dir;

                      int adapter_nr = -1;

                      snprintf(buf, sizeof(buf), "/sys/devices/ocp.2/%x.i2c",


                      d = opendir(buf);

                      if (d) {

                              while ((dir = readdir(d)) != NULL) {

                                      if (!strncmp("i2c", dir->d_name, 3)) {

                                              sscanf(dir->d_name, "i2c-%d", &adapter_nr);


                                              return adapter_nr;





                      return -1;


                      return LINUX_I2C_ADAPTER;


              Would be nice if the Edison version of Arduino supported both I2C buses, even if only I2C6 is broken out on the Arduino breakout board. Changing LINUX_I2C_ADAPTER to 1 worked for me to run a sample sketch on the Edison mini breakout adapter.

              • 4. Re: I2C controllers

                Could you show me a code example of this?

                • 5. Re: I2C controllers


                  I know this is an old post, but it's currently located in /hardware/intel/i686/variants/edison_fab_b/variant.h (and edison_fab_c version, whichever one you have).


                  #define LINUX_I2C_ADAPTER 6


                  #define LINUX_I2C_ADAPTER 1

                  • 6. Re: I2C controllers

                    You guys are killing me-- is that the directory on linux?


                    On my system (osx), it's



                    and possibly below:

                    /Users/dethswatch/Library/Arduino/ ..