Rust on XIAO nRF52840 with Embassy · Part 1 of 2

Installation and setup

Before we write our first Embassy program, let’s prepare the hardware and development tools. This setup is shared by the tutorials in Rust on XIAO nRF52840 with Embassy; you only need to do it once.

If your toolchain and debug probe are already configured for this repository, you can go straight to Blinky.

What you’ll need

  • A XIAO nRF52840 board and a USB cable to power it.
  • A probe-rs-compatible debug probe connected to the board’s SWD interface. This repository uses the probe to flash firmware and read logs. The board’s USB connection alone doesn’t provide that debug connection.
  • A current stable Rust toolchain installed through rustup.
  • Git to clone the xiao-ble-embassy repository.

Connect the debug probe

Follow the Seeed board documentation to locate the SWD pads. You’ll need SWDIO, SWCLK, and a common ground, plus any target-voltage reference connection required by your probe. Use the board’s 3.3 V logic levels and check your probe’s wiring instructions before connecting it.

The probe serves two purposes: programming the microcontroller and reading RTT debug logs. The USB cable powers the board, but it doesn’t replace the SWD connection used by this repository’s runner.

Install Rust and the ARM target

Install the current stable Rust toolchain using the instructions at rustup.rs if you haven’t already. Rustup installs Rust’s compiler and Cargo, the build and package manager we’ll use throughout the series.

Add the compilation target for the nRF52840:

rustup target add thumbv7em-none-eabihf

This lets us compile firmware for the microcontroller rather than for the computer running Cargo.

Install probe-rs

Install probe-rs using the approach in the repository’s README:

cargo install cargo-binstall
cargo binstall probe-rs-tools

With your debug probe connected to the computer, check that it’s detected:

probe-rs list

This checks probe discovery, not the SWD connection to the target chip. If no probe appears, check the probe’s USB connection and any platform-specific setup described in the probe-rs documentation.

Clone the example repository

git clone https://github.com/sarmadgulzar/xiao-ble-embassy.git
cd xiao-ble-embassy

The repository is a Cargo workspace, with examples under crates/. The workspace already supplies the dependencies and build setup, and .cargo/config.toml selects the ARM target and the probe-rs runner for nRF52840_xxAA.

You don’t need to create a new Cargo project or install Embassy separately. Cargo downloads and builds the dependencies declared by the workspace.

Our first example is crates/01-blinky. You can check that it compiles without flashing the board:

cargo build --bin blinky

Run this from the repository root. --bin blinky selects the example’s binary from the workspace; it is not the directory name 01-blinky.

Ready for Blinky

Once the build succeeds and your probe is detected, continue to Blinky. That article follows the video: we’ll map the LED pins, write the RGB cycle, and flash and run the program.

If flashing later finds the probe but can’t connect to the chip, check target power and the SWD wiring. A successful build and probe listing don’t yet verify the target connection.