Skip to content

Latest commit

 

History

History
145 lines (98 loc) · 5.31 KB

system_console.md

File metadata and controls

145 lines (98 loc) · 5.31 KB

PX4 System Console

The system console allows low-level access to the system, debug output and analysis of the system boot process. The most convenient way to connect it is by using a Dronecode probe, but a plain FTDI cable can be used as well.

System Console vs. Shell

There are multiple shells, but only one console: The system console is the location where all boot output (and applications auto-started on boot) is printed.

  • System console (first shell): Hardware serial port
  • Additional shells: Pixhawk on USB (e.g. lists as /dev/tty.usbmodem1 on Mac OS)

Info USB shell: To just run a few quick commands or test an application connecting to the USB shell is sufficient. The Mavlink shell can be used for this, see below. The hardware serial console is only needed for boot debugging or when USB should be used for MAVLink to connect a GCS.

Snapdragon Flight: Wiring the Console

The developer kit comes with a breakout board with three pins to access the console. Connect the bundled FTDI cable to the header and the breakout board to the expansion connector.

Pixracer / Pixhawk v3: Wiring the Console

Connect the 6-pos JST SH 1:1 cable to the Dronecode probe or connect the individual pins of the cable to a FTDI cable like this:

Pixracer / Pixhawk v3 FTDI
1 +5V (red) N/C
2 UART7 Tx 5 FTDI RX (yellow)
3 UART7 Rx 4 FTDI TX (orange)
4 SWDIO N/C
5 SWCLK N/C
6 GND 1 FTDI GND (black)

Pixhawk v1: Wiring the Console

The system console can be accessed through the Dronecode probe or an FTDI cable. Both options are explained in the section below.

Connecting via Dronecode Probe

Connect the 6-pos DF13 1:1 cable on the Dronecode probe to the SERIAL4/5 port of Pixhawk.

Connecting via FTDI 3.3V Cable

If no Dronecode probe is at hand an FTDI 3.3V (Digi-Key: 768-1015-ND) will do as well.

Pixhawk 1/2 FTDI
1 +5V (red) N/C
2 S4 Tx N/C
3 S4 Rx N/C
4 S5 Tx 5 FTDI RX (yellow)
5 S5 Rx 4 FTDI TX (orange)
6 GND 1 FTDI GND (black)

The connector pinout is shown in the figure below.

The complete wiring is shown below.

Opening the Console

After the console connection is wired up, use the default serial port tool of your choice or the defaults described below:

Linux / Mac OS: Screen

Install screen on Ubuntu (Mac OS already has it installed):

sudo apt-get install screen
  • Serial: Pixhawk v1 / Pixracer use 57600 baud
  • Serial: Snapdragon Flight uses 115200 baud

Connect screen at BAUDRATE baud, 8 data bits, 1 stop bit to the right serial port (use ls /dev/tty* and watch what changes when unplugging / replugging the USB device). Common names are /dev/ttyUSB0 and /dev/ttyACM0 for Linux and /dev/tty.usbserial-ABCBD for Mac OS.

screen /dev/ttyXXX BAUDRATE 8N1

Windows: PuTTY

Download PuTTY and start it.

Then select 'serial connection' and set the port parameters to:

  • 57600 baud
  • 8 data bits
  • 1 stop bit

Getting Started on the Console

Type ls to view the local file system, type free to see the remaining free RAM. The console will also display the system boot log when power-cycling the board.

nsh> ls
nsh> free

MAVLink Shell

For NuttX-based systems (Pixhawk, Pixracer, ...), the nsh console can also be accessed via mavlink. This works via serial link or WiFi (UDP/TCP). Make sure that QGC is not running, then start the shell with e.g. ./Tools/mavlink_shell.py /dev/ttyACM0 (in the Firmware source). Use -h to get a description of all available arguments. You may first have to install the dependencies with sudo pip install pymavlink pyserial.

Snapdragon DSP Console

When you are connected to your Snapdragon board via usb you have access to the px4 shell on the posix side of things. The interaction with the DSP side (QuRT) is enabled with the qshell posix app and its QuRT companion.

With the Snapdragon connected via USB, open the mini-dm to see the output of the DSP:

${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug/mini-dm

Note: Alternatively, especially on Mac, you can also use nano-dm.

Run the main app on the linaro side:

cd /home/linaro
./px4 px4.config

You can now use all apps loaded on the DSP from the linaro shell with the following syntax:

pxh> qshell command [args ...]

For example, to see the available QuRT apps:

pxh> qshell list_tasks

The output of the executed command is displayed on the minidm.