Skip to content

SWD Debug Port

PX4 runs on ARM Cortex-M microcontrollers, which contain dedicated hardware for interactive debugging via the Serial Wire Debug (SWD) interface and non-invasive profiling and high-bandwidth tracing via the Serial Wire Ouput (SWO) and TRACE pins.

The SWD debug interface allows direct, low-level, hardware access to the microcontroller's processor and peripherals, so it does not depend on any software on the device. Therefore it can be used to debug bootloaders and operating systems such as NuttX.

Debug Signals

Four signals are required for debugging (in bold) while the rest is recommended.

명칭형식설명
GND전원Shared potential, common ground.
VREF전원The target reference voltage allows the debug probe to use level shifters on the signals.
SWDIOI/OSerial Wire Debug data pin.
SWCLKInputSerial Wire Debug clock pin.
nRSTInputThe reset pin is optional (n = active low).
SWO출력Single wire trace asynchronous data out can output ITM and DWT data.
TRACECK출력Trace clock for parallel bus.
TRACED[0-3]출력Trace synchronous data bus with 1, 2, or 4 bits.

The hardware reset pin is optional, as most devices can also be reset via the SWD lines. However, quickly resetting the device via a button can be great for development.

The SWO pin can emit low-overhead, real-time profiling data with nanosecond timestamping and is therefore strongly recommended to have accessible for debugging.

The TRACE pins require specialized debug probes to deal with the high bandwidth and subsequent datastream decoding. They are usually not accessible and are typically only used to debug very specific timing issues.

자동비행장치 디버그 포트

Flight controllers commonly provide a single debug port that exposes both the SWD Interface and System Console.

The Pixhawk Connector Standards formalize the port that must be used in each FMU version. However there are still many boards that use different pinouts or connectors, so we recommend you check the documentation for your autopilot to confirm port location and pinout.

The debug port location and pinouts for a subset of autopilots are linked below:

오토파일럿디버그 포트
Holybro Pixhawk 6X-RT (FMUv6X-RT)Pixhawk Debug Full
Holybro Pixhawk 6X (FMUv6x)Pixhawk Debug Full
Holybro Pixhawk 5X (FMUv5x)Pixhawk Debug Full
Holybro DurandalPixhawk Debug Mini
Holybro Kakute F7Solder pads
Holybro Pixhawk 4 Mini (FMUv5)Pixhawk Debug Mini
Holybro Pixhawk 4 (FMUv5)Pixhawk Debug Mini
Drotek Pixhawk 3 Pro (FMU-v4pro)Pixhawk Debug Mini
CUAV V5+6-pin JST GH
Digikey: BM06B-GHS-TBT(LF)(SN)(N) (vertical mount), SM06B-GHS-TBT(LF)(SN)(N) (side mount)
CUAV V5nano6-pin JST GH
Digikey: BM06B-GHS-TBT(LF)(SN)(N) (vertical mount), SM06B-GHS-TBT(LF)(SN)(N) (side mount)
3DR PixhawkARM 10-pin JTAG Connector (also used for FMUv2 boards including: mRo Pixhawk, HobbyKing HKPilot32).

Pixhawk Connector Standard Debug Ports

The Pixhawk project has defines a standard pinout and connector type for different Pixhawk FMU releases:

TIP

Check your specific board to confirm the port used.

FMU 버전Pixhawk Version디버그 포트
FMUv2Pixhawk / Pixhawk 110핀 ARM 디버그
FMUv3Pixhawk 26핀 SUR 디버그
FMUv4Pixhawk 3Pixhawk Debug Mini
FMUv5Pixhawk 4 FMUv5Pixhawk Debug Mini
FMUv5XPixhawk 5XPixhawk Debug Full
FMUv6Pixhawk 6Pixhawk Debug Full
FMUv6XPixhawk 6XPixhawk Debug Full
FMUv6X-RTPixhawk 6X-RTPixhawk Debug Full

INFO

There FMU and Pixhawk versions are (only) consistent after FMUv5X.

Pixhawk Debug Mini

The Pixhawk Connector Standard defines the Pixhawk Debug Mini, a 6-Pin SH Debug Port that provides access to both SWD pins and the System Console.

This is used in FMUv4 and FMUv5.

The pinout is as shown below (pins required for debugging are bold):

신호
1VREF
2콘솔 TX
3콘솔 RX
4SWDIO
5SWDCLK
6GND

The debug port definition includes the following solder pads (on board next to connector):

패드신호전압
1nRST+3.3V
2GPIO1+3.3V
3GPIO2+3.3V

The socket is a 6-pin JST SH - Digikey number: BM06B-SRSS-TBT(LF)(SN) (vertical mount), SM06B-SRSS-TBT(LF)(SN)(side mount).

You can connect to the debug port using a cable like this one.

6-pin JST SH Cable

Pixhawk Debug Full

The Pixhawk Connector Standard defines Pixhawk Debug Full, a 10-Pin SH Debug Port that provides access to both SWD pins and the System Console. This essentially moves the solder pads from beside the Pixhawk Debug Mini into the connector, and also adds an SWO pin.

This port is specified for use in FMUv5x, FMUv6, FMUv6x.

The pinout is as shown below (pins required for debugging are bold):

신호
1VREF
2콘솔 TX
3콘솔 RX
4SWDIO
5SWDCLK
6SWO
7GPIO1
8GPIO2
9nRST
10GND

The GPIO1/2 pins are free pins that can be used to generate signals in software for timing analysis with a logic analyzer.

The socket is a 10-pin JST SH - Digikey number: BM10B-SRSS-TB(LF)(SN) (vertical mount) or SM10B-SRSS-TB(LF)(SN) (side mount).

You can connect to the debug port using a cable like this one.

10-pin JST SH Cable

Debug Probes for PX4 Hardware

Flight controllers commonly provide a single debug port that exposes both the SWD Interface and System Console.

There are several debug probes that are tested and supported for connecting to one or both of these interfaces:

  • SEGGER J-Link: commercial probe, no built-in serial console, requires adapter.
  • Black Magic Probe: integrated GDB server and serial console, requires adapter.
  • STLink: best value, integrated serial console, adapter must be soldered.
  • MCU-Link: best value, integrated serial console, requires adapter.

An adapter to connect to the debug port may come with your flight controller or debug probe. Other options are given below.

Debug Adapters

Holybro Pixhawk Debug Adapter

The Holybro Pixhawk Debug Adapter is highly recommended when debugging controllers that use one of the Pixhawk-standard debug connectors.

It is the easiest way to connect:

Holybro Pixhawk Debug Adapter

CUAV C-ADB Pixhawk Debug Adapter

The CUAV C-ADB Secondary Development Pixhawk Flight Controller Debug Adapter comes with an STLinkv3-MINIE Debug Probe.

This has a ports for connecting to the Pixhawk Debug Full (10-pin SH) and CUAV-standard DSU interface (but not the Pixhawk Debug Mini (6-pin SH)).

The M2 connector on the adaptor is 14-pin CN4 STDC14 (see the STLinkv3-MINIE User Manual for more information). The cable used to connect the M2 and the STLinkv3-MINIE comes with the adaptor.

CUAV C-ADB adaptor connected to the STLinkv3-MINIE

Debug Probe Adapters

Some SWD debug probes come with adapters/cables for connecting to common Pixhawk debug ports. Probes that are known to come with connectors are listed below:

Board-specific Adapters

Some manufacturers provide cables to make it easy to connect the SWD interface and System Console.

6-pin JST SH Cable

Custom Cables

You can also create custom cables for connecting to different boards or probes:

  • Connect SWDIO, SWCLK and GND pins on the debug probe to the corresponding pins on the debug port.
  • Connect the VREF pin, if supported by the debug probe.
  • Connect the remaining pins, if present.

See the STLinkv3-MINIE for a guide on how to solder a custom cable.

TIP

Where possible, we highly recommend that you create or obtain an adapter board rather than custom cables for connecting to SWD/JTAG debuggers and computers. This reduces the risk or poor wiring contributing to debugging problems, and has the benefit that adapters usually provide a common interface for connecting to multiple popular flight controller boards.