ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Arduino Due - Unable to sync with device - Then works fine

asked 2016-07-29 18:34:24 -0600

Wilsonator gravatar image

updated 2016-08-04 19:02:28 -0600

I have an odd error occurring for my arduino Due.

I have a sketch which defined '#define USE_USBCON' and is running as a publisher. The baud rate is set 'nh.getHardware()->setBaud(115200);' with a value of 115200.

When I run rosserial_python to connect to the arduino (using the Programming Port, I cannot get the native port to work with ROS) I run the following command:

rosrun rosserial_python _port:=/dev/ttyACM0 _baud:=115200

rosserial_python then outputs:

[INFO] [WallTime: 1469834947.678725] ROS Serial Python Node
[INFO] [WallTime: 1469834947.687998] Connecting to /dev/ttyACM0 at 115200 baud

Then paused for about 10-15 seconds and outputs:

[ERROR] [WallTime: 1469834964.796031] Unable to sync with device; possible link problem or link software version mismatch such as hydro rosserial_python with groovy Arduino

Immediately after this the program starts to work normally and outputs:

[INFO] [WallTime: 1469834965.178744] Note: publish buffer size is 512 bytes
[INFO] [WallTime: 1469834965.179308] Setup publisher on raw_pot_data [geometry_msgs/Vector3Stamped]

Why could this be occurring? While everything seems to be running fine after the first error, it does make me nervous that something is waiting to crash.

* EDIT *

I performed further testing as per Steven_Daniluk's suggestion, however 'while(!nh.connected()) {nh.spinOnce();}' did not work for me.

I have tried using the standard tutorial HelloWorld script, only adding a single line at the top:

#define USB_USBCON

The result was the same sync error, then a successful connection.

I tried adding 'while(!nh.connected()) {nh.spinOnce();}' after 'nh.advertise(chatter)', however this did not work either (same error).

Furthermore I have seen even worse behavior where it will be stuck permanently with the sync error, and only reloading the Arduino script appear to fix this.

I have no idea what is going on.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-29 21:36:56 -0600

Steven_Daniluk gravatar image

I'm not able to give you a full answer, however I did experience something similar so maybe I can be of some help to you or others. The sync error may have something to do with your script getting stuck before it is connected.

When I would run rosserial_python, let it run for a while then close it, the next time I started it I would always get the unable to sync error message. Sometimes I would gave to reload the script onto the arduino to get it to work again.

You can add a line in the setup to wait until your node handle is connected. I think this is definitely needed when you are getting parameters from the parameter server, as you need to make sure you are connected before the line to fetch the parameters is reached. Below is an example:

void setup(){



  while(!nh.connected()) {nh.spinOnce();}

  ... get parameters, do more stuff, etc.

This appeared to have solved my sync issue for me, as I think my script was getting hung up occasionally when getting parameters. Maybe after the sync error is issued it retries, and that is why yours connects?

edit flag offensive delete link more


This did not work. See more details in my edit.

Wilsonator gravatar image Wilsonator  ( 2016-08-04 18:57:19 -0600 )edit

Question Tools

1 follower


Asked: 2016-07-29 18:34:24 -0600

Seen: 999 times

Last updated: Aug 04 '16