Go Down

Topic: Program Wipe with I2C on 2 Due's (Read 785 times) previous topic - next topic

hachidan

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:

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.

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.

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.

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.

Code: [Select]
/**************************************************************************************************
  MASTER
****************************************************************************************************/
#include <Wire.h>

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 < 4; i++)
   {
      Wire1.write(ISend[i]);
   }
   Wire1.endTransmission();
   delay(500);
}

void intToByteA(unsigned long num)
{
   for (int i = 0; i < 4; i++)
   {
      ISend[i] = (byte)((num >> (8 * i)) & 0xFF);
   }
}

/*********************************************************************************************/


/************************************************************************************************
SLAVE
*************************************************************************************************/
#include <Wire.h>

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 < 4; i++)
  {
     IReceive[i] = Wire1.read();
  }
  test = byteAToInt();
  Serial.println(test);
}

unsigned long byteAToInt()
{
  unsigned long temp = 0;
  for (int i = 0; i < 4; i++)
  {
     temp += (((unsigned long)IReceive[i]) << (8 * i));
  }
  return temp;
}


...3.3V and GND are tied together between the two boards: 1 USB cable for uploading sketches.


I read this as: There is a wire connecting 3.3V from DUE#1 to 3.3V to DUE#2 (Perhaps to power DUE#2?).

If this is the case, then this is really not a good idea. 

  • You can jumper the 12V connection from DUE to DUE.

  • You can jumper "VIN" on the POWER header from DUE to DUE.

  • With consideration, you can even jumper "+5V" on the POWER header from DUE to DUE (but you should know what you're doing).



However, you should not connect 3.3V from DUE to DUE, without making one DUE very unhappy.  The design of the power circuitry cannot handle this.

You can pick your friends.  You can pick your nose.  You cannot pick your friend's nose.(1)

See the PDF file here, for a clearer depiction of the power scheme (right-side):
http://arduino.cc/forum/index.php/topic,146574.0.html

-Chris
(1)Maybe George Carlin?

hachidan

When you say jumper the 12V what do you mean? Are you implying i use another circular 12V connector? If so I don,t have one currently but I can buy one.


When you say jumper the 12V what do you mean? Are you implying i use another circular 12V connector? If so I don,t have one currently but I can buy one.


Sure.  Or power the first DUE with a 12V circular connector, and power the 2nd DUE by connecting "VIN" (on the POWER header) on the first DUE to "VIN" on the second DUE.  Be aware that the power supply provided with the DUE may not supply enough current to power both DUE's simultaneously (I haven't looked).  You'll need to figure that out.

"Vin" is located on the "Power" header, shown middle-bottom in the picture below.  Remember to connect a GND from the first DUE to the second DUE as well.
( http://arduino.cc/en/uploads/Main/ArduinoDue_Front.jpg )


-Chris

Go Up