XBee delay?

I have 2 XBEE pros(S3B) they are both set to their default settings other then baud rate which is set to 115200, one is connected to a NANO the other to a MEGA.

The NANO begins to send data within 10sec. of power up, but the MEGA does not get good data until one minute after the NANO powers up, the MEGA gets data from the start up of the NANO but not good data, it almost seems like the NANO baud rate is different for the first minute then changes to the right Baud rate.

I'm sure it's some setting in the XBEE that is causing this issue, just not sure which.

any Ideas?

Tommy

How about starting by posting both your transmitting and receiving code here so that problems with it, if any, can be identified

NANO codes(transmit)

#include <stdint.h>
#include <stdlib.h>
const long interval = 500;
const long intervaldigital = 100;
String inputString = "";
boolean stringComplete = false;
unsigned long pxMillis = 0;
unsigned long digitalMillis = 0;
unsigned long pdigitalMillis = 0;
unsigned long xMillis=0;
unsigned long yMillis=0;
unsigned long zMillis=0;
double bat=0.0;
int count=0;
int bit1=0;
int bit2=0;
int bit3=0;
int bit4=0;
int bit5=0;
int bit6=0;
int bit7=0;
int bit8=0;
int joys=0;
int drvon=0;
void setup() {
Serial.begin(115200);
inputString.reserve(200);
delay(2000);
Serial.print("+++");
delay(2000);
Serial.print("ATCN");
Serial.print('\r');
delay(2000);
pinMode(8, INPUT_PULLUP);
pinMode(12, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
digitalWrite(12, LOW);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
}

void loop() {
xMillis = millis();
digitalMillis= millis();
bat=analogRead(A0)*.02443;
if(bat>9.5){digitalWrite(10, LOW);digitalWrite(11, LOW);digitalWrite(12, HIGH);}
if(bat<9.4999){digitalWrite(10, LOW);digitalWrite(11, HIGH);digitalWrite(12, LOW);}
if(bat<9.0){digitalWrite(10, HIGH);digitalWrite(11, LOW);digitalWrite(12, LOW);}
if (digitalMillis - pdigitalMillis >= intervaldigital)
{
if(drvon==0){bit1=0;}else{bit1=1;}
if(joys==0){bit2=0;}else{bit2=1;}
if(digitalRead(4)==1){bit3=0;}else{bit3=1;}
if(digitalRead(5)==1){bit4=0;}else{bit4=1;}
if(digitalRead(6)==1){bit5=0;}else{bit5=1;}
if(digitalRead(7)==1){bit6=0;}else{bit6=1;}
if(digitalRead(8)==1){bit7=0;}else{bit7=1;}
if(digitalRead(9)==1){bit8=0;}else{bit8=1;}

pdigitalMillis= digitalMillis;
}

if (xMillis - pxMillis >= interval)
{
// count=count+1;
Serial.print("D");
Serial.print(bit1);
Serial.print(bit2);
Serial.print(bit3);
Serial.print(bit4);
Serial.print(bit5);
Serial.print(bit6);
Serial.print(bit7);
Serial.print(bit8);
Serial.print("A");
Serial.print(analogRead(A7));
Serial.print("B");
Serial.print(analogRead(A6));
Serial.print(";");
pxMillis= xMillis;
}
if (stringComplete)
{
if(inputString.substring(0,1)=="D"){drvon=1;}
if(inputString.substring(0,1)=="d"){drvon=0;}
if(inputString.substring(1,2)=="J"){joys=1;}
if(inputString.substring(1,2)=="j"){joys=0;}
inputString="";
stringComplete=false;
}
}
void serialEvent() {
while (Serial.available()&& stringComplete == false) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == 59) {
stringComplete = true;
}
}
}

MEGA codes

const long intervaldigital = 1000;
unsigned long digitalMillis = 0;
unsigned long pdigitalMillis = 0;
int drvon=0;
int joys=1;

String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
int fault=0;
int cc=0;
void setup() {
// initialize serial:
Serial1.begin(115200);
Serial.begin(115200);
// reserve 200 bytes for the inputString:
inputString.reserve(200);
}

void loop() {
// print the string when a newline arrives:
digitalMillis= millis();
if (stringComplete) {
if(inputString.substring(0,1)=="D" && inputString.substring(inputString.length()-1,inputString.length())==";"){pdigitalMillis=digitalMillis;}
//cc=cc+1;
// Serial.println(cc);
Serial.println(inputString);
inputString = "";
stringComplete = false;
if(drvon==0 && joys==0){Serial1.print("dj;");}
if(drvon==0 && joys==1){Serial1.print("dJ;");}
if(drvon==1 && joys==0){Serial1.print("Dj;");}
if(drvon==1 && joys==1){Serial1.print("DJ;");}

}

if (digitalMillis - pdigitalMillis >= intervaldigital)
{
fault=1;
drvon==0
cc=0;
Serial.println("Digital Fault");
pdigitalMillis=digitalMillis;
}
}

/*
SerialEvent occurs whenever a new data comes in the
hardware serial RX. This routine is run between each
time loop() runs, so using delay inside loop can delay
response. Multiple bytes of data may be available.
*/
void serialEvent1() {
while (Serial1.available()) {
// get the new byte:
char inChar = (char)Serial1.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == 59) {
stringComplete = true;
}
}
}

I don't think it's codes on the Arduino's thats the issue, because it's always a 60sec. delay before good data I'm thinking a XBEE setting.

Tommy

It could be a wiring issue.
the XBEE is hard wired to the NANO
pin 1,2,3,10

it's possible some other pin's level could force the Xbee into some mode, that then times out after 60sec.

Tommy