Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    1.21 I2C Transmission Error

    Scheduled Pinned Locked Moved
    General Discussion
    2
    4
    674
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • timmit99undefined
      timmit99
      last edited by

      I am trying to send a byte value to an Arduino in order for it to activate a feature i am working on. Sending "M260 A2 B49" which should send the byte "1" to the Arduino at address 2. Sending it gives an "Error: M260: I2C transmission error"

      My arduino is started with "Wire.begin(2);" which adds the Arduino to the I2C bus on address 2.

      Not sure what the issue is or how to fix it.

      Here is my Arduino code if this helps:

      #include <Wire.h> //starts the library
      #define LED_1 13
      int x = 0; // give a value to the varable to be change with I/Os

      void setup() {
      Serial.begin(9600); // used to debug
      Wire.begin(2); // Start I2C Bus as a Slave (Device Number 9)
      Wire.onReceive(receiveEvent); // register event
      pinMode(LED_1, OUTPUT);
      for (int i = 0; i < 2; i++)
      {
      digitalWrite(LED_1, HIGH);
      delay(200);
      digitalWrite(LED_1, LOW);
      delay(200);
      }
      }

      void loop ()
      {
      Serial.println(x);
      if (x == 1) {
      digitalWrite(LED_1, HIGH);
      delay(200);
      digitalWrite(LED_1, LOW);
      delay(200);
      }
      }

      void receiveEvent()
      {
      x = Wire.read(); // receive byte as an integer
      }

      1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators
        last edited by

        Is it a 3.3V Arduino, or are you using bidirectional level shifters between the Duet and the Arduino?

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        1 Reply Last reply Reply Quote 0
        • timmit99undefined
          timmit99
          last edited by

          The board is an Arduino Due which is a 3.3V System.

          I can try an Uno with a 5V level shifter.

          1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators
            last edited by

            That should be OK then. How long are the I2C wires between the Duet and the Arduino? Can you confirm that you have 3 wires between the two: ground, I2C clock, and I2C data?

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA