Ask Your Question

rosserial "Lost sync" over Arduino Uno XBee connection

asked 2011-11-20 00:56:35 -0500

Pi Robot gravatar image


I have run through the rosserial tutorials on my Arduino Uno and everything works perfectly over a hard line USB connection to my PC (Ubuntu 10.04 and the latest ROS Electric debs).

Now I am trying to get things to work over an XBee connection. (NOTE: I am not using the rosserial_xbee method since I have only two XBee radios and I am using them in transparent mode.) With the rosserial "Hello World" example loaded on the Arduino and my XBee radios set at 9600 baud, I turn on the Arduino + XBee shield for at least 10 seconds, then on the PC I run:

$ rosrun rosserial_python /dev/ttyUSB0 _baud:=9600
[INFO] [WallTime: 1321800497.336925] ROS Serial Python Node
[INFO] [WallTime: 1321800497.340397] Connected on /dev/ttyUSB0 at 9600 baud
[ERROR] [WallTime: 1321800512.341590] Lost sync with device, restarting...
[ERROR] [WallTime: 1321800527.345303] Lost sync with device, restarting...
[ERROR] [WallTime: 1321800542.350331] Lost sync with device, restarting...

If instead of rosserial, I simply load a sketch that does a Serial.println("Hello World!"), then I do see the message over the XBee link via the Arduino Serial Monitor. So I know the basic wireless connection is working.

I am using this XBee shield and a pair of non-Pro XBee radios.

Anyone know how I can fix this?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-11-20 15:09:39 -0500

fergs gravatar image

Is it possible that your communication is only working in one direction? The println("Hello World") confirms that your arduino can send to the computer -- but, if the PC can't talk to the Arduino then the "request for sync" from the PC to the Arduino would never get through (and thus we would never actually connect).

We should probably add a check that decides whether we have "lost sync" or "never synced" as is probably your case.

edit flag offensive delete link more


Communication is working in both directions. To confirm, I used minicom to talk to the radio on the explorer attached to the PC using baud rate 9600 and device /dev/ttyUSB0. I then powered up the Arduino with XBee shield and loaded the loopback test program listed here Entering a number or letter in minicom returned the correct result (e.g. 5 returns 6, x returns y).
Pi Robot gravatar image Pi Robot  ( 2011-11-21 01:19:09 -0500 )edit
You did change the baud rate for the sketch right? Default is 57600...
fergs gravatar image fergs  ( 2011-11-21 08:35:20 -0500 )edit
Yes I had changed it to 9600 using Serial.begin(9600). After further experimentation, even when using the hard line USB connection to the Arduino Uno, the only baud rate that works for is 57600. Any other baud rate fails with "Lost sync" even though I can see that the baud rate is getting passed properly to And it doesn't matter if I use Serial.begin() in the sketch to match the baud rate I am trying with (I am using pyserial 2.3 and Python 2.6.5 in case that matters.) But at least now I have a working solution at 57600 which works for both a direct connection and an XBee link after setting both radios to 57600.
Pi Robot gravatar image Pi Robot  ( 2011-11-21 11:30:00 -0500 )edit

answered 2013-02-27 23:45:54 -0500

priths gravatar image

it works with only xbee series1 y not with series 2.. what changes are to be made.. or is it not possible to use it with series 2. any code for series 2 is available?????

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-11-20 00:56:35 -0500

Seen: 1,331 times

Last updated: Feb 27 '13