Ran into something yesterday that I was pulling hairs out to try to figure out. I put in the automatic reconfigure the XBee code in my Teensy version for the Phoenix, and it was failing. When it failed to properly talk at first 38400 with a short time out, then the standard 1 second timeout and then at 9600 baud, on the Commander version, I just looped forever with a fast blink of the LED. This was happening in the Phantom Phoenix code on the Teensy. I removed the forever loop and then it would come up. Note: this only happens on powerup, works fine if there is a reboot.
So I hooked it up to Logic Analyzer with a real simple program:
Code:
#define XBeeSerial Serial2
void setup() {
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
delay(250); // give time to settle
XBeeSerial.begin(38400);
digitalWrite(2, HIGH);
}
void loop() {
if (XBeeSerial.read() != -1)
digitalWrite(2, !digitalRead(2));
}
had the Commander on and started the logic Analyzer and powered up the board and found:

Sure enough there was over a 10 second wait at startup before it would see the packets coming in. There was some garbage at the start of the session as well. Turns out it was not garbage but output at 9600 baud: the TX line had: 0xff 0xff 0xff,
The RX line (simultaneous to TX) showed OK<CR>. It appears that the system entered Command mode at 9600. This is probably the XBee mechanism that for example when you think you have a bricked on, you can tell it to read/or write without the XBee in the socket and then when it errors, you insert it...
I did a quick change to the test program and, brought the code up at 9600 first, output ATCN<cr> and then entered 38400 and it appears to cut that off. So I am going to change my default code that at init time it will try to detect data coming in at 9600 and if so output the ATCN command and get back out...
But it also made me wonder if I have been running into this in the past as there are times when it appears like the PhantomX takes a long time to respond to the Arbotix...
Kurt
Bookmarks