Getting started connecting to Telem 2 over UART

I’m trying to connect to the pixhawk over the Telem 2 port with a Jetson Nano to receive/send mavlink messages. Can anyone provide a brief script on how to get started with this? I’ve tried

master=mavlink.mavlink_connection("/dev/ttyTHS1") 
master.wait_heartbeat()
Print("heartbeat heard") 

And I get nothing. If I connect with minicom on Jetson Nano I also get nothing. I have the serial2 connection set as mavlink2 at baud of 57600 in QGC

Got a solution. It seems that the UART on Jetson Nano is the issue. I don’t have a USB to TTL cable on hand, but I found that you can connect GND to RESET on an arduino uno and use it as a USB to TTL cable. Using this I am able to connect on /dev/ttyACM0

Hopefully someone finds this useful

Hi @cmarq,

I’ve edited your post to include a code block, so it’s easier to read and understand. You can read about that and more in the How to use the Blue Robotics Forums post :slight_smile:

You don’t seem to have posted your full code, but from what you’ve provided my main guesses are

  1. You’re trying to connect with mavlink.mavlink_connection instead of mavutil.mavlink_connection
  2. You haven’t specified the baudrate you want to connect with, so it’s using Pymavlink’s default of 115200, which won’t work when the port is set to 57600
    → try
    master = mavutil.mavlink_connection("/dev/ttyTHS1", baud=57600)
    
  3. Perhaps the "/dev/ttyTHS1" device is incorrect
    → you may need to try listing the available devices on your Jetson Nano in case the Pixhawk is showing up at a different one, assuming that’s possible
  4. You may need to send a ping or heartbeat message before it will send messages back
    I don’t expect this is a requirement, but it likely doesn’t hurt to try if nothing else is working

Good that you’ve managed to also find a workaround, in case it doesn’t work to directly use the UART port :slight_smile:

1 Like