i2c + DUE don't talk!!

Discussion in 'General Programming Discussion' started by psycho, Mar 9, 2014.

  1. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    Hi, I can not use the GY-521 sensor through Arduino UDOO. I followed this example sketch (# http://playground.arduino.cc/Main/I2cScanner. Uxy1uPl5PuN) without results, the device is not recognized. I connected the sensors (SDA-SCL) to pins 1-2 of J5 pin that on 9-10 J21. With Arduino Uno (external) I have not encountered any problems.
    Someone who has already used the i2c with UDOO can help me?
     
  2. moorsb

    moorsb New Member

    Joined:
    Feb 20, 2014
    Messages:
    36
    Likes Received:
    1
    I would verify the libraries you are using are good on a Due.
    Goto the Arduino site and get help there.
    My understanding is that the Due takes different library on the software side and is not compatible on the hardware sied with 5v devices
    Not sure why they picked the Due for the Ardunio side of things when you look at compatibility issues
    You loose a lot of the code already done.
     
  3. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    thanks I will ask directly on the Arduino forum
     
  4. moorsb

    moorsb New Member

    Joined:
    Feb 20, 2014
    Messages:
    36
    Likes Received:
    1
  5. mkopack

    mkopack Member

    Joined:
    Jun 14, 2013
    Messages:
    451
    Likes Received:
    21
    How are you powering it?

    See: http://playground.arduino.cc/Main/MPU-6050#.UyBg0l7ee3A

    Specifically this paragraph:

    GY-521
    This sensor board has a voltage regulator. When using 3.3V to the VCC the resulting voltage (after the onboard voltage regulator) might be too low for a good working I2C bus. It is preferred to apply 5V to the VCC pin of the sensor board. The board has pull-up resistors on the I2C-bus. The value of those pull-up resistors are sometimes 10k and sometimes 2k2. The 2k2 is rather low. If it is combined with other sensor board which have also pull-up resistors, the total pull-up impedance might be too low.
    This schematic is hard to find, so here is a copy: http://playground.arduino.cc/uploads/Ma ... V1-SCH.jpg


    NOTE that the Uno works on 5V, the Udoo on 3.3V, so that might be why you're having issues....
     
  6. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    I connect the sensor with 5V Udoo without pull-up resistors
     
  7. mkopack

    mkopack Member

    Joined:
    Jun 14, 2013
    Messages:
    451
    Likes Received:
    21
    I'm wondering if you're overpowering the UDoo's pins then... ALL of the IO pins are expecting 3.3V signals, not 5V.
     
  8. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Looking at the Schematics I think the udoo is fitted with pull up resistor too ?.
     
  9. francescomm

    francescomm Member

    Joined:
    Dec 14, 2013
    Messages:
    80
    Likes Received:
    4
    I can confirm the udoo is fitted with pull up resistors because I have used them to try to detect button push (pin getting to LOW on push). And yes, no 5V should get into the IO pins or you may damage the board (on the original Due too) although I may have done that too sometimes (and haven't burnt anything yet)
     
  10. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    My sensor has 2 pull-up resistors of 4K7 on SDA and SCL as UDOO on pin 20-21. On schematics I see that SDA1 and SCL1 (pin 9-10 on J21 HEADER 10F) has no resistors. I need to use those pins for mi sensor. With Arduino Due, SDA1 and SCL1 are used through the Wire1 of the Wire.h library.
    For example if i want use i2cscanner for SDA1 and SCL1:
    Code:
    /*MORE CODE*/
    void setup()
    {
      Wire1.begin();
    
      Serial.begin(9600);
      Serial.println("\nI2C Scanner");
    }
    /*CODE CODE CODE*/
    
    Is this right?

    My sensor i powered by 5V, but it have a built-in voltage regulator that produce high logic values ​​at 3.3v. The led on board (of my sensor) blinks but my sketch does not recognize it. I doubt that I can not use SDA1 and SCL1, but that is using SDA and SCL.
     
  11. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    My script and wiring is correct and working , but tried the i2c Scanner and that don`t work .
    That script doesn`t find any devices , but are there and working ..

    Wire.beginTransmission(address);
    rtn = Wire.endTransmission();

    This should return 0 if the device is there , but always returns 1 , present or not !!!



    Code:
    byte, which indicates the status of the transmission:
    
        0:success
        1:data too long to fit in transmit buffer
        2:received NACK on transmit of address
        3:received NACK on transmit of data
        4:other error 
     
  12. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    You use SDA/SCL or SDA1/SCL1? Can You paste me an example?
     
  13. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    #include <Wire.h>
    extern TwoWire Wire1;

    AND JUST CHANGE WIRE FOR WIRE1 ...




    void set_pullups( byte data1 , byte data2 )
    {
    Wire1.beginTransmission(MCP23017_ADDRESS);
    Wire1.write((byte)0x0c); // first pullup reg
    Wire1.write((byte)data1); // 1 = pullups on
    Wire1.write((byte)data2); //
    Wire1.endTransmission();
    }
     
  14. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    I need set pull-up to off because I have them on the side of the sensor. right?
     
  15. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Pull ups are installed on the board , so you don`t need them on the sensor .

    You can`t switch off the pull ups on the udoo !!!
     
  16. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    Also sda1 and scl1 have pull-up?
     
  17. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    Yep. R54 and R55
    4.7 k resistors
     
  18. psycho

    psycho New Member

    Joined:
    Mar 8, 2014
    Messages:
    8
    Likes Received:
    0
    Are you sure? I do not find the pullup resistors on the diagram.
     
  19. peter247

    peter247 New Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
  20. AntennaSmith

    AntennaSmith New Member

    Joined:
    Feb 23, 2014
    Messages:
    35
    Likes Received:
    0
    The two I2Cs on the UDOO are very confusing. page 6 shows the pull-ups on nvcc_emi0 / eim_d21 and eim_d28 which I believe from page 15 is the Due's SCL0, SDA0 (communication - J5). While I can't speak for the sensor, the Adafruit MotorShield V2 uses the Due's I2C1 or SCL1, SDA1. These can been seen on the right hand side of page 15, J21. I believe you would use wire1 to use SCL1, SDA1 from wire.h and not wire.

    I can not get this I2C to work and I haven't yet found if they are pulled up to 3v, but I'm still looking. Once I get a resistor I'll test it. I also noticed that one of the pin numbers for wire1 don't match for the UDOO Due. The UDOO documentation says 70 & 9 while the variant.h says 70 & 71 ????
     

Share This Page