---
title: Swan Quickstart
description: Learn how to get up an running with Blues Swan, including step debugging with Swan using Visual Studio Code and an STLink programmer
source_url: https://dev.blues.io/quickstart/swan-quickstart/
canonical_url: https://dev.blues.io/quickstart/swan-quickstart/
markdown_url: https://dev.blues.io/quickstart/swan-quickstart.md
---

# Swan Quickstart

#### Watch a video of this tutorial

[Video: quickstart-step-2.1280w.20260521.mp4](https://dev.blues.io/_media/quickstart-step-2.1280w.20260521.mp4)

In this tutorial you'll learn how to set up and flash firmware to **Swan**, a powerful Feather-compatible STM32L4R5-based microcontroller board.

![Swan](https://dev.blues.io/images/quickstart/swan/swan-small.png?v=d1f618e8)

> **Note:**
>
> This guide shows how to flash firmware to Swan using Arduino IDE because of its ease of use.
>
> After completing this quickstart tutorial, you may wish try out of one the following alternative platforms for writing Swan firmware:
>
> - [Using PlatformIO with Swan](https://dev.blues.io/feather-mcus/swan/using-platformio-with-swan.md)
> - [Using STM32CubeIDE with Swan](https://dev.blues.io/feather-mcus/swan/using-stm32cubeide-with-swan.md)
> - [Using CircuitPython with Swan](https://dev.blues.io/feather-mcus/swan/using-circuitpython-with-swan.md)

## Install Prerequisites

Before working with firmware in Arduino IDE, you must first install the following prerequisites.

1. Download and install [Arduino IDE](https://www.arduino.cc/en/software/).

2. Download and install [STM32CubeCLT](https://www.st.com/en/development-tools/stm32cubeclt.html), which is a toolset that allows third-party environments to work with STM32-based host MCUs.

   > **Note:**
   >
   > Alternatively, you may install both [STM32CubeIDE](https://www.st.com/en/development-tools/stm32cubeide.html#st-get-software) and [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html#get-software). These are much larger software packages that may not be necessary for your local development environment. Be sure to also follow [these installation notes](https://dev.blues.io/notecard/notecard-walkthrough/updating-notecard-firmware.md#stm32cubeprogrammer-installation-notes) when installing STM32CubeProgrammer.

**Linux-only setup required for accessing the device in DFU mode and virtual COM port.**

1. Create a `/etc/udev/rules.d/` rule for the device in DFU mode.

   ```bash
   (echo '# DFU (Internal bootloader for STM32 MCUs)';  echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"') | sudo tee /etc/udev/rules.d/49-stdfu-permissions.rules > /dev/null
   ```

2. Create a `/etc/udev/rules.d/` rule for the device's virtual COM port.

   ```bash
   (echo '# Virtual COM Port for STM32 MCUs'; echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"') | sudo tee /etc/udev/rules.d/49-stvcp-permissions.rules > /dev/null
   ```

3. Add active user to `plugdev` group in `/etc/group`.

   ```bash
   sudo usermod -aG plugdev $USER
   ```

**Using the Arduino CLI**

As an alternative to using Arduino IDE to configure and build your project, you can use the [Arduino CLI](https://arduino.github.io/arduino-cli/1.1/installation/).

1. In order to specify Swan as the board, you need to first install the STM32duino core. You'll need a minimum of version `2.9.0` of the STM32duino core installed.

   ```bash
   arduino-cli core install STMicroelectronics:stm32
   ```

2. You can then specify the Swan by using the board part number. For example:

   ```bash
   arduino-cli compile --fqbn STMicroelectronics:stm32:Blues blinky.ino
   ```

## Configuring Arduino IDE

With Arduino IDE installed, you next need to configure your environment to build and flash code to your Swan.

### Installing STM32duino in the Arduino IDE

1. Within Arduino IDE open your **Settings/Preferences**.

2. Locate the **Additional boards manager URLs** (see screenshot below), and add the following URL: `https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json`

   ![Update ArduinoIDE preferences](https://dev.blues.io/images/quickstart/swan/arduinoide-bsp-config.png?v=1b069d1b)

3. Click **OK** to save your changes, and then restart Arduino IDE.

4. Next, click the Boards Manager icon (second icon down in the left panel), search for **STM32 MCU based boards**, and install version `2.9.0` or greater. ![Board manager in Arduino IDE](https://dev.blues.io/images/quickstart/swan/arduino-board-manager.png?v=1baab9bb)

5. Restart Arduino IDE.

### Using STM32duino in the Arduino IDE

1. Under **Tools > Board**, select **STM32 MCU based boards**, and then **Blues boards**.

   ![Select STM32 Board](https://dev.blues.io/images/quickstart/swan/arduinoide-stm32-board.png?v=ca633cfb)

2. Next, under **Tools > Board part number**, select **Swan R5**."

   ![Select STM32 Board Part](https://dev.blues.io/images/quickstart/swan/arduinoide-stm32-board-part.png?v=9b09ef53)

3. Lastly, under **Tools > USB support (if available)**, select **CDC (generic 'Serial' supersede U(S)ART)**.

## Flashing Firmware

Now that you have Arduino IDE configured to work with Swan, you're ready to flash firmware.

To do so, we recommend using programmer like the [STLINK-V3MINI](https://shop.blues.com/products/stlink-v3mini?utm_source=dev-blues\&utm_medium=web\&utm_campaign=store-link), however, you may also program Swan via a USB cable connected to your computer.

> **Tip:**
>
> **Let AI write your firmware.** Blues Expert MCP connects your AI coding assistant (Claude Code, GitHub Copilot, Cursor) directly to our API docs, providing live request validation and firmware best practices for Arduino, C, Zephyr, and Python. [Install the Blues Expert MCP →](https://dev.blues.io/tools-and-sdks/generative-ai-tools/blues-expert-mcp.md)

### Programming Swan *with* the STLINK-V3MINI (Recommended)

1. In Arduino IDE, under **Tools > Upload method**, select **STM32CubeProgrammer (SWD)**."

2. Plug the STLINK-V3MINI into your computer over USB.

3. Plug the Swan into a power source (e.g. a LiPo battery or your computer via USB).

   **NOTE:** If you want to see Serial output from the Swan, you need to either use a USB cable as the power source or [customize your sketch](https://dev.blues.io/feather-mcus/serial-logging-with-stlink.md) to use the STLINK-V3MINI for Serial output.

4. Plug the Cortex-Debug connector from the STLINK-V3MINI into the Swan.

   ![swan to stlink](https://dev.blues.io/images/quickstart/swan/swan-stlink.jpg?v=a06272f9)

5. Skip to the [**Blink the Onboard LED**](#blink-the-onboard-led) instructions below.

### Programming Swan *without* the STLINK-V3MINI

1. In Arduino IDE, under **Tools > Upload method**, select **STM32CubeProgrammer (DFU)**."

2. Connect the Swan's Micro USB port to your computer with a USB cable.

   ![swan micro usb](https://dev.blues.io/images/quickstart/swan/swan-micro-usb.jpg?v=796c6f54)

3. Press and hold the `BOOT` button on the Swan, press and release `RESET`, then release `BOOT` to cause the Swan to jump into its bootloader. This sequence **must be done every time** you want to upload firmware to the Swan.

4. Proceed to the **Blink the Onboard LED** instructions below.

### Blink the Onboard LED

1. In the Arduino IDE, use **File > New Sketch** to create a new sketch.

2. Overwrite the provided boilerplate code with the following to cause the onboard LED to blink repeatedly:

   ```cpp
   // the setup function runs once when you press reset or power the board
   void setup() {
     // initialize digital pin LED_BUILTIN as an output.
     pinMode(LED_BUILTIN, OUTPUT);
   }

   // the loop function runs over and over again forever
   void loop() {
     digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
     delay(1000);                       // wait for a second
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     delay(1000);                       // wait for a second
   }
   ```

3. Use the **Upload** button to upload this sketch to your Swan.

If the Swan's LED blinks on and off every second—you're good to go! Follow the next section if you have an STLINK programmer and want to learn about step debugging, or move on to the [next steps](#next-steps).

## Step Debugging with Arduino IDE

Swan supports step debugging with [Arduino Native Debugging](https://github.com/stm32duino/Arduino_Core_STM32/wiki/How-to-debug) on Arduino IDE when used with an attached [STLINK programmer/debugger](https://shop.blues.com/collections/accessories/products/stlink-v3mini?utm_source=dev-blues\&utm_medium=web\&utm_campaign=store-link).

1. Set one or more breakpoints on your sketch.

   ![swan set breakpoints](https://dev.blues.io/images/quickstart/cygnet/swan-cygnet-set-breakpoint.png?v=e8c852de)

2. In the **Sketch** menu, select **Optimize for Debugging**.

   ![swan optimize for debugging in arduino ide](https://dev.blues.io/images/quickstart/cygnet/swan-cygnet-optimize-debug.png?v=fcdc93f1)

3. **Upload** the sketch to Swan.

4. Click the **Start Debugging** button.

   ![swan start debugging](https://dev.blues.io/images/quickstart/cygnet/swan-cygnet-start-debugging.png?v=4e4cfda7)

5. When a breakpoint is hit, use the Arduino IDE to step through relevant code blocks and inspect variables, view the call stack, and watch expressions.

   ![swan step debugging](https://dev.blues.io/images/quickstart/cygnet/swan-cygnet-step-debug.png?v=82456ddc)

## Next Steps

**Congratulations!** You've configured your Swan and flashed new firmware to it using Arduino IDE.

If you're following the Cell+WiFi Quickstart, next we recommend building your first IoT app:

1. ~~Use the Notecard to Send Data~~
2. ~~Set Up Your Microcontroller~~
3. [Build Your First IoT App With Blues](https://dev.blues.io/guides-and-tutorials/collecting-sensor-data.md)
4. [Send Data to Your Cloud](https://dev.blues.io/guides-and-tutorials/routing-data-to-cloud.md)

At any time, if you find yourself stuck, please reach out on the [community forum](https://discuss.blues.com/).
