title: Program Wipe with I2C on 2 Due's
body: <p>I have an interesting issue that could or could not be true for the Due only. I do not have the resources to test I2C on 2 Arduino ATMegas. Here is the issue:</p>
  
  <p>I have two Due's: The master has an Ethernet shield that will be used later; is used now for easily differentiate between master and slave. I2C is working, however the setup is: 1 12V battery connected to the Due's DC "round" input connected to the master: 3.3V and GND are tied together between the two boards: 1 USB cable for uploading sketches.</p>
  
  <p>When I unplug the USB from the master to upload a sketch on the slave, both boards remain on during the USB unplugged phase -- due to the 12 DC.
  The sketch is uploaded and the USB stay on the slave side for serial monitoring.</p>
  
  <p>THE ISSUE: When the 12V battery is not corrected to the master; during the USB unplugged phase, both boards are off. Upon uploading the same sketch to the slave, the serial monitor shows that no information is received by the slave. </p>
  
  <p>I assume that I2C setup and uploading a sketch are conflicting. How can I resolve this issue, so I don't need power to the Dues all the time. Here is the code that is working with the 12V battery supply.</p>
  
  <pre><code>/**************************************************************************************************
    MASTER
  ****************************************************************************************************/
  #include &lt;Wire.h&gt;
  
  byte ISend[4];
  
  void setup()
  {
     Wire1.begin(); // join i2c bus (address optional for master)
     intToByteA((unsigned long)72992);
  }
  
  void loop()
  { 
     Wire1.beginTransmission(4); // transmit to device #4
     for(int i = 0; i &lt; 4; i++)
     {
        Wire1.write(ISend[i]);
     } 
     Wire1.endTransmission();
     delay(500); 
  }
  
  void intToByteA(unsigned long num)
  {
     for (int i = 0; i &lt; 4; i++)
     {
        ISend[i] = (byte)((num &gt;&gt; (8 * i)) &amp; 0xFF);
     }
  }
  
  /*********************************************************************************************/
  
  
  /************************************************************************************************
   SLAVE
  *************************************************************************************************/
  #include &lt;Wire.h&gt;
  
  byte IReceive[4];
  
  void setup()
  {
    Wire1.begin(4);                // join i2c bus with address #4
    Wire1.onReceive(receiveEvent); // register event
    Serial.begin(9600);           // start serial for output
  }
  
  void loop()
  {
    delay(223);
  }
  
  // function that executes whenever data is received from master
  // this function is registered as an event, see setup()
  void receiveEvent(int howMany)
  {
    unsigned long test = 11;
    for(int i = 0; i &lt; 4; i++)
    {
       IReceive[i] = Wire1.read();
    } 
    test = byteAToInt();
    Serial.println(test);
  }
  
  unsigned long byteAToInt()
  {
    unsigned long temp = 0;
    for (int i = 0; i &lt; 4; i++)
    {
       temp += (((unsigned long)IReceive[i]) &lt;&lt; (8 * i));
    }
    return temp; 
  }
  </code></pre>