Home        Store        Docs        Blog

Serial comunication RS232 endpoint problem

Hi!,
I have a problem with serial comunication. I have Bluerov2 with:

  • Ardusub version 3.5.4
  • Companion Software 0.0.18
    The rov work correctly and not have a problem.

I need it connection serial sensor ouput (rs232 ascii format speed 9600 baud) at companion computer , and read this value in ground computer. For test i have connected at USB port to companion computer a Arduino UNO with little program to generate value ascii rs232 9600 baud (format example “OXY = 7,34”), tested with Hyperterminal, is OK.

In 192.168.2.2/2770 routing create endpoint to SERIAL ArduinoUNO and UDP ENDPOINT 192.168.2.1 UDP port 5555 (or differente name).

In QgroundControl 3.2.4 Bluerobotics setting COMM LINKS and create UDP link PORT to 192.168.2.1 port 5555 ( or different name).

I did a lot of tests, but the system not working.
I did not understand where I see the data, in QGC or where. I use a computer win 10 and I have no confidence with pyton scrip.
I have been trying for days without results. Thanks for your help.

2 Likes

the same problem with me,and i didn’t fix it ever

I continued to work on it. Now I can read the input of the serial converter connected to the Raspberry’s USB port via putty-ssh-screen. It works perfectly. I made a small UDP python client that can read data. They are read but “cut”. By analyzing the protocol with Wireshark the UDP packet is always 60 bytes and encapsulates the serial data in a disordered way.

How can I proceed? I have also tried other UPD serial software, they work but the reception is messy. I don’t understand why the socket is UDP. Thanks to those who can help me.

Hello, QGroundControl links will only accept connections from MAVLINK AUTOPILOTS, not just any program that you write.

To receive the data on your topside computer, you will need to open port 5555 with a network listening program, or write your own program with a udp server bound to port 5555.

@Nautiluso It sounds like you have picked up on the correct approach, but you are having problems. In order to get further help, share your code and error messages that you see.

Thanks for the reply, I need help. I describe my situation:
I have an Arduino Uno that transmits an ASCII serial string “12345678 12345678 12345678” 115200 N etc. It is connected via USB to the companion computer. Connected in putty with SCREEN / DEV / BY ID / Arduino I read on the shell “12345678 …” ok it works. In 192.168.0.1:2770 routing connect arduino serial with 0.0.0.0 port 5555.

Now compile my little python client:

#-----------------------------------------------------

Esempio client UDP

#-----------------------------------------------------

import socket, time
REMOTE_ADDR = “192.168.2.2”, 5555
LEN_UDP_BUFFER = 50000

#-----------------------------------------------------

def sock_rdt(s, timeout=10.0):
s.settimeout(timeout)
try:
return s.recvfrom(LEN_UDP_BUFFER)
except:
return “”.encode(“ascii”), ("", 0)

#-----------------------------------------------------
h=0
cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
cli.sendto(str(h+1).encode(“ascii”), REMOTE_ADDR)

dati, addr = sock_rdt(cli)
if dati:
    print(dati.decode("ascii"))
else:
    print("Timeout ricezione!")

cli.sendto(“stop server”.encode(“ascii”), REMOTE_ADDR)
cli.close()
try: raw_input("…")
except NameError: input("…")

It’s WORK but the string is cut. Example:
12345
678 1234
5678 123
4 5678

I have also used specific program :

the result is the same.

If my string is very short example: 1234

1234
1234
1234

the system works with few errors, if the string is long it is cut. If I could put photos, I don’t know how to do it anymore … thanks to those who can help me

I forgot that I also tried Wireshark. I get on the 5600 and 2000 port the UDP video packages (use QGC and VLC), Mavlink in 14550 and 5555 packet, but the serial string in UDP is cut off. Sorry for the length I hope I have provided sufficient elements. Thanks.

Hi,

There is a tool that creates serial-UDP bridges.
You can check it here: https://github.com/patrickelectric/bridges

You can download the binary for you platform or install it via cargo command line.
To run it, is simple as: bridges --port /dev/ttyUSB0:115200 -u 0.0.0.0:3636
Where: /dev/ttyUSB0 is the serial port, 115200 your baudrate, 0.0.0.0:3636 the IP and port if the UDP server.

1 Like