5 Replies Latest reply on Jan 11, 2016 11:06 PM by InPark

    Intel Edison has the i2c problem.

    InPark

      Hi, I use intel edison (with arduino board). sorry for My English that is not good. please, understand about that. I can't control my English .

      So, I want to control FND with i2c.

       

       

      I use the PCAL9555 for FND in not edison board. I connected PCAL9555 A4/A5.this is pull-up. USE 5V. I Use address 0x48. In arduino IDE 0x48 >> 1.  I use clock the DIG2,3,4.  But, It doesn't work. There is no digital output.

      This is code on Arduino IDE. Actually, I'm student.  so, I'm not sure my code is correct.

      Arduino IDE

      #include <Wire.h>

      #define DIG2 2
      #define DIG3 3
      #define DIG4 4

      #define A 10
      #define B 9
      #define C 8
      #define D 5
      #define E 4
      #define F 2
      #define G 3
      #define DP 7

      #define FNDaddress 0x48

      byte val = 0x00;
      byte ref = 0;

      byte data[3] = { 0x02, 0x0f, 0xff};

      byte receive = 0;

       

      void setup()
      {
        int ack1 = 0;
        int Dreturn = 0;
        Serial.begin(9600);
        Wire.begin(); // ijoin i2c bus
        Wire.beginTransmission(FNDaddress >> 1);
        Dreturn = Wire.write(0x02);
        //Wire.write(0x00);
        ack1 = Wire.endTransmission();
        Serial.print("First ack = ");
        Serial.println(ack1);

        Serial.print("0x02 = ");
        Serial.println(Dreturn);

        pinMode(DIG2, OUTPUT);
        pinMode(DIG3, OUTPUT);
        pinMode(DIG4, OUTPUT);

       

      }

      void loop()
      {

        int data = 0;
        int ack = 0;
        digitalWrite(DIG2, HIGH);
        digitalWrite(DIG3, HIGH); 
        digitalWrite(DIG4, HIGH);


        Wire.beginTransmission(FNDaddress >> 1);
        Wire.write(0x02);

        delay(500);

        //Wire.write(0xf0);

       

        data = Wire.write(val);

        digitalWrite(DIG2, LOW);
        digitalWrite(DIG3, LOW);
        digitalWrite(DIG4, LOW);


        ack = Wire.endTransmission(false);

       
       
        delay(1000);
        //Wire.requestFrom(FNDaddress >> 1, 1, true);
        //receive = Wire.read()<<8|Wire.read();


        val = val + 1;
        if (val == 0xff) {
          val = 0;
        }

        Serial.print("val =");
        Serial.println(val);

        Serial.print("ack =");
        Serial.println(ack);

        Serial.print("data =");
        Serial.println(data);

        Serial.print("receive =");
        Serial.println(receive);

       

        delay(500);

       

      }

       

       

      And suddenly, i2c is not work. In TeraTerm(serial terminal), print message as i2c6 error. this is a Big issue.

      This is a message.

       

      Teraterm

      [  813.009470] i2c-6: recovery ignore

      [  816.575982] i2c-designware-pci 0000:00:09.1: ===== REGISTER DUMP (i2c) =====

      [  816.576078] i2c-designware-pci 0000:00:09.1: DW_IC_CON:               0x65

      [  816.576149] i2c-designware-pci 0000:00:09.1: DW_IC_TAR:               0x4

      [  816.576218] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_HCNT:       0x2f8

      [  816.576287] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_LCNT:       0x37b

      [  816.576356] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_HCNT:       0x87

      [  816.576425] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_LCNT:       0x10a

      [  816.576494] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_STAT:         0x0

      [  816.576562] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_MASK:         0x246

      [  816.576631] i2c-designware-pci 0000:00:09.1: DW_IC_RAW_INTR_STAT:     0x410

      [  816.576700] i2c-designware-pci 0000:00:09.1: DW_IC_RX_TL:             0x20

      [  816.576769] i2c-designware-pci 0000:00:09.1: DW_IC_TX_TL:             0x20

      [  816.576837] i2c-designware-pci 0000:00:09.1: DW_IC_ENABLE:            0x1

      [  816.666282] i2c-designware-pci 0000:00:09.1: DW_IC_STATUS:            0x2

      [  816.666361] i2c-designware-pci 0000:00:09.1: DW_IC_TXFLR:             0x1

      [  816.666431] i2c-designware-pci 0000:00:09.1: DW_IC_RXFLR:             0x0

      [  816.666499] i2c-designware-pci 0000:00:09.1: DW_IC_TX_ABRT_SOURCE:    0x0

      [  816.666567] i2c-designware-pci 0000:00:09.1: DW_IC_DATA_CMD:          0x0

      [  816.666634] i2c-designware-pci 0000:00:09.1: ===============================

      [  816.666735] CPU: 0 PID: 360 Comm: sketch.elf Tainted: G        W  O 3.10.17-poky-edison+ #1

      [  816.666740] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

      [  816.666747] task: f50a3210 ti: f4a90000 task.ti: f4a90000

      [  816.666812] Stack:

      [  816.666883] Call Trace:

      [  816.667360] Code: 10 b3 ff ff 89 f8 09 d0 80 ce 04 83 ff 02 0f 45 d0 a1 94 72 bd c1 89 90 00 b3 ff ff f7 c6 00 02 00 00 74 15 e8 20 58 0b 00 56 9d <83> c4 04 5b 5e 5f 5d c3 8d b6 00 00 00 00 56 9d e8 39 5b 0b 00

      [  816.667385] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G        W  O 3.10.17-poky-edison+ #1

      [  816.667390] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48

      [  816.667399] task: f6c83d30 ti: f6e1e000 task.ti: f6e1e000

      [  816.667463] Stack:

      [  816.667531] Call Trace:

      [  816.667741] Code: 50 08 83 e2 08 75 39 31 d2 83 c0 08 89 d1 0f 01 c8 0f ae f0 89 f6 89 e0 25 00 e0 ff ff 8b 40 08 a8 08 75 07 b1 01 89 f0 0f 01 c9 <85> 1d 78 60 c1 c1 75 0d 8d 55 f0 b8 05 00 00 00 e8 47 1a d7 ff

      [  816.668369] i2c-6: recovery ignore

      I can't use i2c-6 since printed error message. Why dosen't work?

      I worked on Arduino IDE with Wire.h. and worked on mraa(C languege). But I get that message. I can't solve this problem.

      somebody else, I want you to help me.

       

      p.s. I attach the PCAL datasheet.

        • 1. Re: Intel Edison has the i2c problem.
          Intel_Alvarado

          Did you try to use the code in mraa and it worked but when you port it to the Arduino IDE it doesn’t? That may be related to the muxing settings of the Edison. Mraa handles the initialization of the i2c-1 and i2c-6. When you connect the PCAL to the Edison via A4/A5 do you see it recognized? You can use the i2cdetect command.

           

          The error you are receiving has happened to a couple of other users in the community. If it is in fact the same behavior then it might be related to a known issue with I2C. Try moving the jumper on J9 to position 2-3 by default this jumper is set to position 1-2.

           

          Let me know if this works for you.

           

          Sergio

          • 2. Re: Intel Edison has the i2c problem.
            InPark

            Thanks, Alvarado. As you told me, the jumper on J9 set to position 1-2 and FW flash, It works. very goooooood.

            But, I have the problem about PCAL. I use I2c via A4,A5. And I use PCAL as slave. I configure PCAL, A2 HIGH, A1 LOW, A0 LOW. And each SCL/SDA is A5/A4. PCAL digital OUTPUT connected FND. In Arduino IDE, I use PCAL slave address 0x48. But It doesn't work. So, slave address is shifted right 1. 0x48 >> 1. Because I think twi.h shift left 1 slave address . It's not sure. anyway, Edison write SDA/SCL vi A4/A5.  But, Digital OUTPUTs are 0V. I change write each  val 0 to 255. All the same, OUTPUT 0V. How can I handle the PCAL Digital OUTPUT?

             

            p.s. sorry. my English is not good.

            • 3. Re: Intel Edison has the i2c problem.
              Intel_Alvarado

              How are you reading the output of the PCAL? Are you reading with a multimeter or a logic analyzer? If you have one at hand I’d recommend you to use a logic analyzer and show if there are any signals in the I2C bus. You also mentioned twi.h. Did you import this successfully; did you see any errors when installing this file?

               

              Sergio

              • 4. Re: Intel Edison has the i2c problem.
                Intel_Alvarado

                Have you followed the suggestion of the previous post? Were you able to control the FND?

                 

                Sergio

                • 5. Re: Intel Edison has the i2c problem.
                  InPark

                  Problem solve! Thank you very much! Sergio.