Gents, I've found a solution for who's having problems with the xBee being corrupted when starting Ardupilot.

Everytime I had to pull of the blue wire to not damage my xBee, but now I found a solution.

I've added a delay command right before the serial initialization serial.begin() in the setup() session of ardupilot.

Looks like that:

void setup() {
#if GPS_PROTOCOL == 0
delay(3000);
Serial.begin(FIFTY_SEVEN_K_BAUD);
#endif
#if GPS_PROTOCOL == 1
delay(3000);
Serial.begin(FIFTY_SEVEN_K_BAUD);
#endif
#if GPS_PROTOCOL == 2
delay(3000);
Serial.begin(THIRTY_EIGHT_K_BAUD);
#endif
#if GPS_PROTOCOL == 3
delay(3000);
Serial.begin(THIRTY_EIGHT_K_BAUD);
#endif
#if GPS_PROTOCOL == 5
delay(3000);
Serial.begin(THIRTY_EIGHT_K_BAUD);
#endif

init_ardupilot();
}

That causes a 3 seconds delay during the initialization, allowing the modem to startup before sending the serial init.

Cheers,
Leonardo

Views: 485

Reply to This

Replies to This Discussion

Sweet! We'll test that and add it if it works on all our setups...

Many thanks!
Looks like this already got integrated into the SVN checkout for 2.6

Nice...this one has caused me a lot of frustration!

JC
Yes, we'll be rolling out a bunch of bug fixes in 2.61 next week, including that one..
Ack, unfortunately, it didn't work for me. Plugged in the XBee, then the main power.

My start up procedure was a bit off, as I turned the plane on about 2 seconds before the transmitter....Other than that, it still resulted in a corrupted XBee....

=(
Hmm. Maybe I was just lucky when I tried it...will investigate further.

BTW, this is not a problem with ArduPilot Mega, which has a dedicated serial port for the Xbees.
Has anyone confirmed this is an affirmative solution yet?
I was just now cussing because I had to re-write my airborne xbee again.

I always plug it in after main power, not sure what's going on, but it's a pain, because I have it wrapped in heatshrink.

Using the latest 2.6 checkout.
Sorry to hear that. I've been too chicken to try it myself!
Well, after adding those delays to my ardupilot the problem stopped for me. Maybe we have different configurations.
Did you try to increase a bit the delay?
As long as the xbee has time to boot before data is applied, it should not crap out (I also have the irritation of plugging in the xbee after all is working)

the code above looks right to me, you could even give it 5-10 secs if need be as usually the IMU is calibrating anyway....at least this was no data is applied to Xbee in boot..

I will try it tomorrow on my system see what theupshot is?

(pain in the a*se re-configuring xbees when corrupted)

Mike
Leonardo,

What is your configuration?
Exactly the one I've posted in this topic...probably the one that they've added to Ardupilot 2.6... you can check and tune increasing the delay if it's not working for you.

Reply to Discussion

RSS

Groups

Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service