For the complete documentation index, see llms.txt. This page is also available as Markdown.

ST-LINK Flashing Guide

Guide for using ST-LINK to flash firmware and access the debug console on ARK products.

Overview

What is SWD?

SWD (Serial Wire Debug) is a two-wire debug interface for ARM microcontrollers. It provides programming and debugging capabilities using just two signals (SWDIO and SWCLK) plus ground. All ARK products with STM32 microcontrollers include an SWD interface on their debug connector.

ST-LINK is a programmer/debugger from STMicroelectronics designed for their STM32 microcontroller family. It connects to your computer via USB and to the target board via the SWD interface, allowing you to flash firmware and debug applications.

We recommend the ST-LINK V3 Mini because it is a composite USB device that provides both the programmer interface and a virtual serial port in a single USB connection. This means you can flash firmware and access the UART debug console without needing a separate USB-to-serial adapter.

When you connect an ST-LINK V3 Mini to your computer, it creates multiple USB interfaces:

Example dmesg output:

usb 1-3: new high-speed USB device number 66 using xhci_hcd
usb 1-3: New USB device found, idVendor=0483, idProduct=3754, bcdDevice= 1.00
usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-3: Product: STLINK-V3
usb 1-3: Manufacturer: STMicroelectronics
usb 1-3: SerialNumber: 003500313133510F37363734
cdc_acm 1-3:1.1: ttyACM0: USB ACM device

The ttyACM0 device is the virtual serial port you can use for UART debug console access.


What You'll Need

Optional: JST Cable Kits

If you need additional cables for custom wiring, these pre-crimped cable kits are convenient (no crimping tool required):


Hardware Setup

The ARK Pixhawk Debug Adapter makes connecting an ST-LINK to ARK products simple - no manual wiring required.

  1. Connect the ST-LINK V3 Mini to the adapter's STDC14 connector using the cable that comes with the ST-LINK

  2. Connect the appropriate JST-SH debug cable (6-pin or 10-pin) from the adapter to your ARK product's debug port

  3. Connect the ST-LINK to your computer via USB

The adapter routes SWD signals (SWDIO, SWCLK, GND) and UART signals (TX, RX) between the ST-LINK and the Pixhawk Standard Debug connector.


Software Installation

Ubuntu

Install the stlink tools from the official repository:

Alternatively, you can build from source by following the instructions on the stlink-org/stlink GitHub page.

Permissions: If you encounter permission errors, add your user to the dialout group:

Log out and back in for the change to take effect.

Windows

  1. Download the ST-LINK Utility from the STMicroelectronics website

  2. Install the utility and USB drivers

  3. Refer to the ST-LINK documentation for detailed usage instructions


Flashing Firmware

Ubuntu

Test the Connection

After connecting your ST-LINK to both your computer and the target board, verify the connection:

Expected output (example for ARK FPV):

Expected output (example for ARK 4IN1 ESC):

If you see an error or no device found, check your wiring connections.

Erase Flash Memory (Optional)

Before flashing new firmware, you may want to erase the existing flash. On PX4 boards with FLASH based parameters (ARK FPV, ARK Pi6X) this will also wipe all parameters back to default. If you don't mass erase, parameters will remain unchanged.

Flash Firmware

Navigate to the directory containing your firmware binary, then flash:

Expected output:

Windows

  1. Open ST-LINK Utility

  2. Click Target > Connect to connect to your board

  3. Click File > Open File and select your firmware binary (.bin file)

  4. Click Target > Program & Verify

  5. Verify the success message in the log window


Flashing PX4 Flight Controllers

ARKV6X, ARKV6S, ARK FPV, and ARK Pi6X are STM32H7 with 128 KB flash sectors.

Image
File
Address

Bootloader

<target>_bootloader.bin

0x08000000

Application

<target>_default.px4

USB (QGC / ARK-OS)

Then flash the .px4 application over USB.

The bootloader .bin is in PX4-Autopilot at boards/ark/<board>/extras/ and on PX4 GitHub releases as <target>_bootloader.bin.

SWD of the application is 0x08020000.


Flashing DroneCAN Nodes

DroneCAN nodes — ARK RTK GPS, ARK CANnode, ARK Flow, ARK MAG, ARK DIST, and the other CAN products — run two separate images: a bootloader at the start of flash and the application at a fixed offset above it. On ARK CAN nodes the bootloader region is 64 KB, so the application lives at 0x08010000, not 0x08000000. This applies to both ArduPilot AP_Periph and PX4 CAN node firmware.

Image
Flash address

Bootloader (ArduPilot CAN bootloader or PX4 canbootloader)

0x08000000

Application (AP_Periph or PX4 CAN node firmware)

0x08010000

ArduPilot publishes a combined bootloader and application image as an Intel HEX file. HEX files carry their own load addresses, so there is no offset to get wrong. This is the recommended way to flash a node over SWD, and the only way to bring up a node that has no bootloader at all.

Download AP_Periph_with_bl.hex for your board from the ArduPilot firmware server, then flash it:

Power-cycle the node afterward. It should enumerate on the CAN bus within a few seconds.

Firmware Files

Each board directory on the ArduPilot firmware server contains several files. Pick the one that matches how you are flashing:

File
Contents
Use with

AP_Periph_with_bl.hex

Bootloader + application

ST-LINK / SWD — no address needed

AP_Periph.bin

Application only

ST-LINK / SWD, written at 0x08010000

AP_Periph.apj

Application only

DroneCAN GUI Tool or flight controller CAN update

Flashing the Application Only

If the node already has a working bootloader and you only want to replace the application, write the .bin at the application offset:

Prefer the combined HEX unless you have a specific reason not to — an application flashed at the wrong address is the most common way to leave a node unresponsive.

Once a bootloader is installed, SWD is no longer needed for routine updates. Firmware can be pushed over CAN from the flight controller's SD card or with the DroneCAN GUI Tool.

PX4 Nodes

PX4 CAN nodes use the same split — the PX4 canbootloader at 0x08000000 and the node application at 0x08010000. Flash the bootloader first, then the application at its offset. PX4 does not publish a combined image, so both writes are separate:


UART Debug Console

The debug connector provides a serial console (UART) for viewing system output and debugging. This is useful for accessing the NuttX shell, viewing boot messages, and debugging issues.

Connection

When using the ARK Pixhawk Debug Adapter with an ST-LINK V3 Mini, the UART signals are routed through the adapter. The ST-LINK V3 Mini's composite USB creates a virtual serial port (/dev/ttyACM0 on Linux, COMx on Windows) that provides access to the debug console.

No additional wiring or adapters are needed.

Serial Terminal Settings

  • Baud rate: 57600

  • Data bits: 8

  • Stop bits: 1

  • Parity: None

  • Flow control: None

Ubuntu

Using screen:

To exit screen, press Ctrl+A then K, then Y to confirm.

Windows

Use a serial terminal application such as:

  • PuTTY - Select "Serial" connection type, enter the COM port, and set speed to 57600

  • Tera Term - Select serial port and configure 57600 baud, 8N1


Troubleshooting

  • Check that the USB cable is connected properly

  • Try a different USB port

  • Verify the ST-LINK USB drivers are installed (Windows)

  • Check dmesg output (Linux) to see if the device is recognized

"Target voltage detected" or Similar Errors

  • Ensure proper power configuration - either power from ST-LINK OR external source, not both.

  • Disconnect peripheral devices in case they are drawing too much power.

Permission Denied (Linux)

Add your user to the dialout group:

Then log out and back in.

Flash Verification Failed

  • Ensure the correct firmware binary for your target

  • Try erasing flash first with st-flash erase

  • Check that the flash address is correct for your target — 0x08000000 for a bootloader or single-image firmware, 0x08020000 for a PX4 STM32H7 application, 0x08010000 for a DroneCAN node application

Node Flashes Its LED Once at Boot, Then Nothing

The application was almost certainly written over the bootloader at 0x08000000. The node has no bootloader to hand off to, so it never joins the CAN bus and no DroneCAN tool will see it. Reflash with the combined image — see Flashing DroneCAN Nodes.

Serial Console Shows Garbage Characters

  • Verify the baud rate is set to 57600

  • Check TX/RX connections are not swapped

  • Ensure common ground between ST-LINK and target board

Last updated