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.
What is ST-LINK?
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.
Why ST-LINK V3 Mini?
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 deviceThe ttyACM0 device is the virtual serial port you can use for UART debug console access.
What You'll Need
ARK Pixhawk Debug Adapter - Includes 6-pin and 10-pin JST-SH debug cables
ST-LINK V3MINIE (recommended) or ST-LINK V2
Computer running Ubuntu or Windows
Firmware binary file (.bin)
Optional: JST Cable Kits
If you need additional cables for custom wiring, these pre-crimped cable kits are convenient (no crimping tool required):
JST-SH 1.0mm (debug connectors): JST SH 1.0mm Connector Kit on Amazon
JST-GH 1.25mm (peripheral connectors): GH1.25 Connectors Kit on Amazon
Hardware Setup
The ARK Pixhawk Debug Adapter makes connecting an ST-LINK to ARK products simple - no manual wiring required.
Connect the ST-LINK V3 Mini to the adapter's STDC14 connector using the cable that comes with the ST-LINK
Connect the appropriate JST-SH debug cable (6-pin or 10-pin) from the adapter to your ARK product's debug port
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.
Power: The ST-LINK can provide 3.3V power to the target. If your board is already powered from another source (battery, USB, etc.), the adapter handles this safely. However, for boards that draw significant current, power from an external source is recommended.
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
Download the ST-LINK Utility from the STMicroelectronics website
Install the utility and USB drivers
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:
st-flash takes a .bin. A .px4 is a JSON envelope for QGC / ARK-OS / px_uploader, not an SWD image.
0x08000000 is the start of flash (bootloader or single-image firmware). Application offsets: PX4 flight controllers and DroneCAN nodes.
Expected output:
Windows
Open ST-LINK Utility
Click Target > Connect to connect to your board
Click File > Open File and select your firmware binary (.bin file)
Click Target > Program & Verify
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.
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.
Bootloader (ArduPilot CAN bootloader or PX4 canbootloader)
0x08000000
Application (AP_Periph or PX4 CAN node firmware)
0x08010000
Writing the application to 0x08000000 overwrites the bootloader. st-flash reports success, but the node boots with a single LED flash and then goes dark — it never appears in the DroneCAN GUI Tool or the Mission Planner DroneCAN/UAVCAN tab. If you see this after an SWD flash, reflash with the combined image below.
Recommended: Flash the Combined Bootloader + Application Image
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:
AP_Periph_with_bl.hex
Bootloader + application
ST-LINK / SWD — no address needed
AP_Periph.bin
Application only
ST-LINK / SWD, written at 0x08010000
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.
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
"No ST-LINK detected"
Check that the USB cable is connected properly
Try a different USB port
Verify the ST-LINK USB drivers are installed (Windows)
Check
dmesgoutput (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 eraseCheck that the flash address is correct for your target —
0x08000000for a bootloader or single-image firmware,0x08020000for a PX4 STM32H7 application,0x08010000for 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