Interfacing with Pixhawk using the NSH

This article explains how to communicate with a Pixhawk using the NuttX Shell (NSH) using either a serial or remote connection.

Overview

The Pixhawk runs the NuttX real-time operating system which includes the NuttX Shell terminal “NSH”. This allows running some Unix style commands including “top” and “ls”.

NSH is very useful for diagnosing low level issues. Some of the things you can do with it include:

  • Display performance counters with the perf command
  • Display px4io status information
  • Diagnose microSD errors
  • Diagnose sensor failures
  • Assist in debugging new drivers

This topic explains how to connect and send NSH commands from MAVProxy via remote and serial connections.

Running NSH using Debug Cable and Serial5

To use the NSH while Copter or Plane is running you can connect using Serial 4/5. To do this you will need an FTDI 3.3V cable and then modify a DF13 6 Position cable so that it can be connected to the FTDI cable.

../_images/Pixhawk_FTDICable_NSH.jpg

You should then be able to plug the FTDI cable into your computer and connect with any Serial program including the Mission Planner’s Terminal screen. Ensure to select the FTDI cable’s COM port and set the Baud rate to 57600. You will need to press return for the “nsh>” prompt to appear.

../_images/Pixhawk_NSH_MP.png