Jetson Nano GPIO to Arduino Mega Serial1 UART communication using ROS Rosserial

Hey everyone, this is my first post here and I’m struggling to figure out this problem.

My hardware:
Jetson Nano 2Gb running stock OS
Arduino Mega 2560
logic level converter

I am attempting to connect the Mega to the Jetson Nano using ROS rosserial. I have the Serial1 pins on the Mega (18, 19) connected to the UART pins on the jetson nano (through a ribbon cable breakout on a breadboard). I am using a logic level converter between them to convert from 3.3 to 5V. I made sure they have a common ground as well.

I know the UART connection itself works because using the Serial Passthrough Arduino example I can send strings through and read them on cutecom on the Jetson Nano (/dev/ttyTHS1).

I also know that ROS is working because it works perfectly well through a USB connection on /dev/ttyACM0.

The problem is just when I try to connect rosserial to /dev/ttyTHS1. I get the “Unable to sync with device” error.

I set up ArduinoHardware.h and ros.h as instructed here: http://wiki.ros.org/rosserial_arduino/Tutorials/NodeHandle%20and%20ArduinoHardware. I changed Serial to Serial1. The baud rate is still 57600 and the subscriber and publisher buffers are both 512 bytes. These parameters work over USB.

Unfortunately I cannot share my code, but does anyone have any idea what could be generating this error despite the solutions I have tried?

Edit: I am using ROS melodic on the Jetson nano

Hi @imbeech37, sorry I’m not familiar with rosserial, but perhaps someone from the community may share their experience.

Since you have confirmed the serial connection is indeed working (outside of rosserial), have you come across any of these suggestions?

I think I fixed the problem. I now have a good connection from pins 18 and 19 on the Mega to pins 8 and 10 on the Jetson Nano.

The things I changed:
1.
typedef NodeHandle from <25, 25, 256, 256> to <1, 1, 512, 512>
in other words I increased the input and output buffer and am using only one subscriber and publisher. They are Int16MultiArray

I increased the baud rate from 57600 to 500000 on the arduino and I ensured that the rosserial on the jetson connected at 500000 as well. I think something about communicating over wires instead of usb requires a higher baud rate.

I decreased the delay at the end of the Arduino loop from 10 to 5 milliseconds.

I made sure there wasn’t another Serial.begin() somewhere. This will give a port busy error.

  1. added the following line to the ros.h file that wasn’t included in the tutorial

#include <ros.h> this was the only way it would compile