Being able to connect to PX4 via Serial is essential for development. It allows you to run individual apps in PX4 and it provides a straight forward interface for debugging. I have successfully connected to a HK Pilot 32 using a FTDI breakout adapter in Ubuntu, and here is how I did it.


A quick summary:

  1. Connect FTDI cable and USB cable
  2. Install putty, launch and configure
  3. Run some applications

1. Connect FTDI cable

PX4 serial connection works a bit different than Ardupilot. If you connect your Pixhawk to the computer via a micro USB cable, you will only see gibberish in the console. The correct way is to use the serial port on Pixhawk and connect to the computer via a FTDI cable. A FTDI cable is something like this:

FTDI cableftdicable
FTDI breakout adapter
ftdivreakout

The breakout adapter is the same as the cable, except you need to bring your own micro USB cable to connect it to the computer. The tricky part is to get the pin out match correctly.For the serial connection you only need three wires, the RX, TX and GND.

serial_to_ftdi

FTDI to Pixhawk serial pin matching table

The complete setup is shown below.

ftdi_breakout_adapter

Pixhawk serial to FTDI adapater

complete_setup

Complete setup

The official guide can be found here: PX4 serial connection

So far I have only successfully connected a Pixhawk/HK Pilot 32 to Ubuntu. I haven’t found a way to connect a Pixfalcon to the console, as there is no serial port.

Update: it turns out you can connect to serial via micro USB cable if you remove the micro SD card.


2. Install putty, launch and configure

There are many serial console applications on Ubuntu (e.g. screen, minicom, piocom etc.). Putty is the preferred application in UAB lab. To install putty, open a terminal window, and type:
sudo apt-get install putty

If it is installed correctly, launch putty by using the command (use the sudo prefix to make sure you have access to all the ports):

sudo putty

Now you should see a window like this:

Putty Interface

Putty Interface

The key configurations here are connection type and serial line as circled in red. For connection type choose Serial. The serial line is usually /dev/ttyUSB0 or /dev/ttyACM0 on Linux. If you want to check which one is it you can type “ls /dev/tty*” in the terminal before and after you plug in the cable, and see which one has changed. You can save your session by clicking the save below so you don’t have to configure every time you launch putty.

Now click open at the bottom to start the session. You should see a new window with title “/dev/ttyXXXX – PuTTY”.


3. Run some applications

To check if your connection is established successfully, type “help” into the PuTTY console. If you see something like the screen shot below, congratulations! You can also play around some of the Builtin Apps from help, such as “tone_alarm” and “rgbled”.

What you should see if you type help in PuTTY

What you should see if you type help in PuTTY