7 Replies Latest reply on Sep 24, 2015 5:43 PM by chrwei

    Grove - I2C Motor Driver does not work with Arduino Expansion Kit

    ek

      Has anyone succeeded using Grove - I2C Motor Driver (Buy Grove - I2C Motor Driver [ROB72212P] | Seeedstudio) with Edison Arduino Expansion board?

       

      The driver works fine with Arduino UNO. But, nothing happens with the Edison combination. It seems to be caused by lower driving capability of I2C on Edison. When observed with logic analyzer, there is no ACK signal. The driver board uses Atmega 8L to pull up I2C line with its internal 10~Kohm register, which seems to be too low for Edison.

       

      I tested two sets of Edison Arduino Kits and two sets of Motor Drivers without any success. Strangely, though, one of my friends had no problem under same configuration. I used Oct 14th. firmware version under 5V I/O configuration, and the Grove sample program on GitHub.

       

      If someone can advise me a way to enhance the I2C signal, I would very much appreciate it.

        • 1. Re: Grove - I2C Motor Driver does not work with Arduino Expansion Kit
          DiegoV_Intel

          Hi ek,

           

          I have not tested the Motor Driver you are using, however I will suggest you to check the Intel® Edison, Galileo & Galileo Gen 2 Shield Testing Report in order to know the test results for other Motor Drivers. Also you can find a couple of threads regarding the I2C in Edison that probably you can find interesting:

          Re: Edison Arduino i2c

          I2C with Edison Breakout board

          I am basically lost with i2c... trying to connect grove shield to arduino.

           

          One more thing. Could you please confirm if the code you are using is from here: https://github.com/Seeed-Studio/Grove_I2C_Motor_Driver?

           

          Regards,

          Diego.

          1 of 1 people found this helpful
          • 2. Re: Grove - I2C Motor Driver does not work with Arduino Expansion Kit
            ek

            Diego,

            Thank you for the information. These are very much helpful. I have had several I2C devices working with Edison and observed similar situations.

             

            I used ver.1.2 driver, which you can find from following URL. Grove - I2C Motor Driver V1.2 - Wiki.

            Sorry, I was pointing to ver 1.0 in above question.

             

            Regards,

            Eiichi

            • 3. Re: Grove - I2C Motor Driver does not work with Arduino Expansion Kit
              DiegoV_Intel

              Hi ek,

               

              Were you able to use the Motor Driver? Unfortunately I don't have that shield but if you are still getting issues with it please post the code you are using to give it a look.

               

              Regards,

              Diego.

              • 4. Re: Grove - I2C Motor Driver does not work with Arduino Expansion Kit
                ek

                Diego, the issue still exists. Test code is the one posted at the wiki:

                http://www.seeedstudio.com/wiki/images/4/43/I2CMotorDriver12Demo.zip

                There are two examples. I used DCDemoCode.ino.

                thanks!

                Eiichi

                • 5. Re: Grove - I2C Motor Driver does not work with Arduino Expansion Kit
                  DiegoV_Intel

                  Hi ek,

                   

                  I've tested the code and it seems to work fine. I don't have the shield to test it but I could get the following:

                   

                  I2C signal.JPG

                   

                  That is the signal for this code section:

                   

                  MotorDirectionSet(0b1010);  //0b1010  Rotating in the positive direction
                  

                   

                  If you look the MotorDirectionSet() function you will find the following code:

                   

                  void MotorDirectionSet(unsigned char Direction)  {    //  Adjust the direction of the motors 0b0000 I4 I3 I2 I1
                    Wire.beginTransmission(I2CMotorDriverAdd); // transmit to device I2CMotorDriverAdd
                    Wire.write(DirectionSet);        // Direction control header
                    Wire.write(Direction);              // send direction control information
                    Wire.write(Nothing);              // need to send this byte as the third byte(no meaning) 
                    Wire.endTransmission();    // stop transmitting
                  }
                  

                   

                  The first data sent is the direction which is "I2CMotorDriverAdd" and the value of it is 0x0F, then "DirectionSet" is sent; the value of it is 0xAA, the next data sent is "Direction" and its value is 0b1010, and the next data sent is "Nothing" and its value is 0x01. All the data is showed in the screenshot above so I believe the code is working properly.

                   

                  My suggestion would be to check if the direction of the shield is the correct. I hope you find this helpful.

                   

                  Regards,

                  Diego.

                  • 6. Re: Grove - I2C Motor Driver does not work with Arduino Expansion Kit
                    formal

                    Hi All.

                     

                    I'm also having this problem with a Grove Motor Controller v1.3. I'm using the following code from the Grove website:

                    #include <Wire.h>
                    
                    const int ledPin = 4;
                    
                    #define MotorSpeedSet             0x82
                    #define PWMFrequenceSet           0x84
                    #define DirectionSet              0xaa
                    #define MotorSetA                 0xa1
                    #define MotorSetB                 0xa5
                    #define Nothing                   0x01
                    
                    #define I2CMotorDriverAdd         0x0c   // Set the address of the I2CMotorDriver
                    
                    void MotorSpeedSetAB(unsigned char MotorSpeedA , unsigned char MotorSpeedB)  {
                      MotorSpeedA=map(MotorSpeedA,0,100,0,255);
                      MotorSpeedB=map(MotorSpeedB,0,100,0,255);
                      Wire.beginTransmission(I2CMotorDriverAdd); // transmit to device I2CMotorDriverAdd
                      Wire.write(MotorSpeedSet);        // set pwm header 
                      Wire.write(MotorSpeedA);              // send pwma 
                      Wire.write(MotorSpeedB);              // send pwmb    
                      Wire.endTransmission();    // stop transmitting
                    }
                    
                    void MotorPWMFrequenceSet(unsigned char Frequence)  {    
                      Wire.beginTransmission(I2CMotorDriverAdd); // transmit to device I2CMotorDriverAdd
                      Wire.write(PWMFrequenceSet);        // set frequence header
                      Wire.write(Frequence);              //  send frequence 
                      Wire.write(Nothing);              //  need to send this byte as the third byte(no meaning)  
                      Wire.endTransmission();    // stop transmitting
                    }
                    
                    void MotorDirectionSet(unsigned char Direction)  {     //  Adjust the direction of the motors 0b0000 I4 I3 I2 I1
                      Wire.beginTransmission(I2CMotorDriverAdd); // transmit to device I2CMotorDriverAdd
                      Wire.write(DirectionSet);        // Direction control header
                      Wire.write(Direction);              // send direction control information
                      Wire.write(Nothing);              // need to send this byte as the third byte(no meaning)  
                      Wire.endTransmission();    // stop transmitting 
                    }
                    
                    void MotorDriectionAndSpeedSet(unsigned char Direction,unsigned char MotorSpeedA,unsigned char MotorSpeedB)  {  //you can adjust the driection and speed together
                      MotorDirectionSet(Direction);
                      MotorSpeedSetAB(MotorSpeedA,MotorSpeedB);  
                    }
                    
                    void setup()  {
                      Wire.begin(); // join i2c bus (address optional for master)
                      delayMicroseconds(10000); //wait for motor driver to initialization
                      pinMode(ledPin, OUTPUT); 
                    }
                    
                    void loop()  {
                      while(1)  {
                         digitalWrite(4, HIGH);
                    
                        MotorSpeedSetAB(100,100);
                        delay(10); //this delay needed
                        MotorDirectionSet(0b1010);  //0b1010  Rotating in the positive direction 
                        delay(1000); 
                        MotorDirectionSet(0b0101);  //0b0101  Rotating in the opposite direction
                        
                        digitalWrite(4, LOW);
                    
                        delay(500);
                      }
                    }

                     

                    I get the following dump within Linux:

                    [   71.878314] i2c-designware-pci 0000:00:09.1: ===== REGISTER DUMP (i2c) =====
                    [   71.878414] i2c-designware-pci 0000:00:09.1: DW_IC_CON:               0x65
                    [   71.878489] i2c-designware-pci 0000:00:09.1: DW_IC_TAR:               0xc
                    [   71.878560] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_HCNT:       0x2f8
                    [   71.878633] i2c-designware-pci 0000:00:09.1: DW_IC_SS_SCL_LCNT:       0x37b
                    [   71.878705] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_HCNT:       0x87
                    [   71.878777] i2c-designware-pci 0000:00:09.1: DW_IC_FS_SCL_LCNT:       0x10a
                    [   71.878849] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_STAT:         0x0
                    [   71.878920] i2c-designware-pci 0000:00:09.1: DW_IC_INTR_MASK:         0x246
                    [   71.878992] i2c-designware-pci 0000:00:09.1: DW_IC_RAW_INTR_STAT:     0x10
                    [   71.879063] i2c-designware-pci 0000:00:09.1: DW_IC_RX_TL:             0x20
                    [   71.879135] i2c-designware-pci 0000:00:09.1: DW_IC_TX_TL:             0x20
                    [   71.879206] i2c-designware-pci 0000:00:09.1: DW_IC_ENABLE:            0x1
                    [   71.879277] i2c-designware-pci 0000:00:09.1: DW_IC_STATUS:            0x2
                    [   71.879347] i2c-designware-pci 0000:00:09.1: DW_IC_TXFLR:             0x3
                    [   71.879418] i2c-designware-pci 0000:00:09.1: DW_IC_RXFLR:             0x0
                    [   71.879489] i2c-designware-pci 0000:00:09.1: DW_IC_TX_ABRT_SOURCE:    0x0
                    [   71.879559] i2c-designware-pci 0000:00:09.1: DW_IC_DATA_CMD:          0x0
                    [   71.879629] i2c-designware-pci 0000:00:09.1: ===============================
                    [   71.879732] CPU: 1 PID: 191 Comm: sketch.elf Tainted: G        W  O 3.10.17-poky-edison+ #1
                    [   71.879737] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 466 2014.06.23:19.20.05
                    [   71.879743] task: f5d9a6f0 ti: f506e000 task.ti: f506e000
                    [   71.879804] Stack:
                    [   71.879872] Call Trace:
                    [   71.880306] Code: b3 ff ff 89 f8 09 d0 80 ce 04 83 ff 02 0f 44 c2 8b 15 54 4b b9 c1 89 82 00 b3 ff ff f7 c6 00 02 00 00 74 14 e8 e7 f8 0a 00 56 9d  c4 04 5b 5e 5f 5d c3 90 8d 74 26 00 56 9d e8 d1 f4 0a 00 83
                    [   71.880330] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W  O 3.10.17-poky-edison+ #1
                    [   71.880335] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 466 2014.06.23:19.20.05
                    [   71.880343] task: c1b8c120 ti: c1b86000 task.ti: c1b86000
                    [   71.880405] Stack:
                    [   71.880473] Call Trace:
                    [   71.880725] Code: 8b 42 08 a8 08 75 24 31 c9 8d 42 08 89 ca 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  1d 58 a6 bc c1 75 0d 8d 55 f0 b8 05 00 00 00 e8 bd 31 d9 ff
                    [   71.881315] i2c-6: recovery ignore
                    
                    

                     

                    Has anyone got a solution to this problem?

                     

                    Regards,

                    David

                    • 7. Re: Grove - I2C Motor Driver does not work with Arduino Expansion Kit
                      chrwei

                      I'm also having issues.  the driver and sample code work fine on an Uno, and I can get other i2c devices to work with Edison, but they are special purpose ICs not atmega8 with twi_slave.h.  it may be the twi_slave code not doing the Right Thing, but good enough for an Uno.  that code is also on the driver's wiki.

                       

                      David, you need to initialize the port mux to enable i2c6, details are on this page, among other things http://archreactor.org/project/intel-edison-notes-and-resources

                       

                      however, i2cdetect does not find the motor driver, and neither does the arduino i2cscanner.  both do find other i2c sensors, so I know i2c itself it working on the edison, just something it doesn't like about this motor driver.  I've started a thread on seeed's forum as well. http://www.seeedstudio.com/forum/viewtopic.php?f=17&t=6268