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:
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
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 (0x08000000) is correct for your target
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