Modern embedded framework, using Rust and async. https://embassy.dev
  • Rust 99.7%
  • Linker Script 0.1%
Find a file
xoviat aca5a5466c
Merge pull request #6393 from s7g4/fix/can-fd-brs
stm32/can: use Header::new_fd in FdFrame constructors
2026-06-21 18:20:02 +00:00
.github ci: update embassy-devtool and force incremental compilation on check 2026-06-05 09:04:20 -05:00
.helix Add helix cargo settings overrides 2025-09-24 14:03:41 +02:00
.vscode mspm0: add MSPM0G518x support and new packages for others 2025-12-14 00:37:30 -06:00
cyw43 Merge pull request #6355 from cedrivard/cyw43-disassoc-ind-link-down 2026-06-16 12:22:58 +00:00
cyw43-firmware cyw: update write nvrams script 2026-04-21 10:26:52 -05:00
cyw43-pio cyw43-pio: revert back to use slice::from_ref on DMA cmd 2026-05-04 23:46:31 +02:00
docs chore: prepare nrf hal release 2026-06-16 11:48:38 +02:00
embassy-boot chore: update changelogs for release 2026-03-12 09:58:32 +01:00
embassy-boot-nrf chore: prepare nrf hal release 2026-06-16 11:48:38 +02:00
embassy-boot-rp Allow splitting WatchdogFlash back into components 2026-05-29 22:02:29 +02:00
embassy-boot-stm32 chore: prepare crate releases 2026-03-10 12:28:26 -04:00
embassy-embedded-hal Implement SetConfig for YieldingAsync and BlockingAsync adapters. 2026-06-11 12:48:19 -05:00
embassy-executor executor: add missing feature change to CHANGELOD 2026-05-27 09:58:42 -07:00
embassy-executor-macros add z7 platform support 2026-05-16 01:17:11 +02:00
embassy-executor-timer-queue Edition 2024. 2025-10-06 23:19:53 +02:00
embassy-futures Edition 2024. 2025-10-06 23:19:53 +02:00
embassy-hal-internal cyw: doc and bugs 2026-05-11 16:31:14 -05:00
embassy-imxrt Prepare ETQU 0.3.2 2026-04-21 23:34:07 +02:00
embassy-mcxa Merge pull request #6387 from felipebalbi/mcxa-devguide-driver-patterns 2026-06-19 20:54:41 +00:00
embassy-microchip Prepare ETQU 0.3.2 2026-04-21 23:34:07 +02:00
embassy-mspm0 mspm0: add tim module and implement marker traits for instances and pins 2026-05-21 20:29:30 -04:00
embassy-net embassy-net: also add may_recv to TcpWriter to check on the receive side status 2026-06-17 00:06:17 +01:00
embassy-net-adin1110 Add slot API to zerocopy channel 2026-04-05 23:21:12 +02:00
embassy-net-driver embassy-net-driver: add empty packet metadata constant 2026-06-11 19:04:11 +02:00
embassy-net-driver-channel wpan: refactor net mod to use net driver channel and refactor basic control 2026-05-21 11:34:51 -05:00
embassy-net-enc28j60 chore: update changelogs for release 2026-03-12 09:58:32 +01:00
embassy-net-esp-hosted Separate responses and events 2026-06-14 23:05:37 +02:00
embassy-net-nrf91 Merge pull request #6374 from embassy-rs/nrf91-link-state 2026-06-17 12:23:17 +00:00
embassy-net-ppp Add slot API to zerocopy channel 2026-04-05 23:21:12 +02:00
embassy-net-tuntap refactor(tuntap): use an OwnedFd internally 2026-06-12 10:51:07 +02:00
embassy-net-wiznet Add slot API to zerocopy channel 2026-04-05 23:21:12 +02:00
embassy-nrf Merge pull request #6326 from zyp/fix_buffered_uarte_drop_hang 2026-06-17 12:27:43 +00:00
embassy-nxp Prepare ETQU 0.3.2 2026-04-21 23:34:07 +02:00
embassy-rp Merge pull request #6236 from HenriqueDomiciano/feat/add-pio-baud-rate-update 2026-06-14 22:14:09 +00:00
embassy-stm32 Merge pull request #6393 from s7g4/fix/can-fd-brs 2026-06-21 18:20:02 +00:00
embassy-stm32-wpan wpan/platform: put pka to sleep when not used 2026-06-05 10:37:35 -05:00
embassy-sync embassy-sync: make Signal::poll_wait public 2026-06-17 10:58:09 +02:00
embassy-time Provide with_timeout and try_with_timeout with with_deadline. 2026-06-01 12:24:31 +01:00
embassy-time-driver Add a 62.5 MHz tick rate (which is what QEMU's MPS3-AN536 machine runs at). 2026-05-10 18:52:34 +01:00
embassy-time-queue-utils Prepare ETQU 0.3.2 2026-04-21 23:34:07 +02:00
embassy-usb fix(dfu): call system_reset upon reception of USB Reset event if we are in ManifestWaitReset 2026-06-11 12:27:22 +02:00
embassy-usb-dfu chore: update changelogs for release 2026-03-12 09:58:32 +01:00
embassy-usb-driver Merge branch 'main' into usb-chunking 2026-05-31 23:17:32 +02:00
embassy-usb-host Prepare 0.2.2 2026-05-28 11:09:20 +02:00
embassy-usb-logger chore: prepare crate releases 2026-03-10 12:28:26 -04:00
embassy-usb-synopsys-otg Prepare 0.2.2 2026-05-28 11:09:20 +02:00
examples Add PWM example 2026-06-19 23:46:28 +02:00
release chore: move tool to separate repo 2025-08-25 19:44:51 +02:00
tests tests: stm32: add DMA hardware hash test 2026-06-21 18:55:27 +02:00
.gitattributes Use merge=union for changelogs to avoid constant conflicts. 2025-09-05 16:27:48 +02:00
.gitignore ci: update docserver and remove --cleanup 2026-03-11 21:17:06 -05:00
ci-nightly.sh ci: use devtool to build. 2025-09-11 21:52:47 +02:00
ci-xtensa.sh ci: use devtool to build. 2025-09-11 21:52:47 +02:00
ci.sh [MCXA] i2c/target: report end-of-transfer via ReadStatus/WriteStatus 2026-06-05 11:34:53 -07:00
fmtall.ps1 fmt 2026-05-27 11:05:43 -05:00
fmtall.sh Add a basic "format all" script 2025-12-10 15:32:11 +01:00
LICENSE-APACHE Centralize license and MSRV boilerplate into the repo readme. 2024-01-11 18:18:35 +01:00
LICENSE-CC-BY-SA Explicitly license the book prose CC-BY-SA 2024-05-23 09:57:10 +02:00
LICENSE-MIT Centralize license and MSRV boilerplate into the repo readme. 2024-01-11 18:18:35 +01:00
NOTICE.md Fix spelling and white space mistakes 2024-04-11 19:45:38 +00:00
README.md Add link to ra-hal in the README. 2026-05-22 18:35:42 -07:00
RELEASE.md docs: fix markdown syntax 2025-07-14 12:02:42 +02:00
rust-toolchain-nightly.toml executor: add platform-riscv64 support 2026-05-19 20:30:47 -07:00
rust-toolchain.toml executor: add platform-riscv64 support 2026-05-19 20:30:47 -07:00
rustfmt.toml Edition 2024. 2025-10-06 23:19:53 +02:00

Embassy

Embassy is the next-generation framework for embedded applications. Write safe, correct, and energy-efficient embedded code faster, using the Rust programming language, its async facilities, and the Embassy libraries.

Documentation - API reference - Website - Chat

Rust + async ❤️ embedded

The Rust programming language is blazingly fast and memory-efficient, with no runtime, garbage collector, or OS. It catches a wide variety of bugs at compile time, thanks to its full memory- and thread-safety, and expressive type system.

Rust's async/await allows for unprecedentedly easy and efficient multitasking in embedded systems. Tasks get transformed at compile time into state machines that get run cooperatively. It requires no dynamic memory allocation and runs on a single stack, so no per-task stack size tuning is required. It obsoletes the need for a traditional RTOS with kernel context switching, and is faster and smaller than one!

Batteries included

  • Hardware Abstraction Layers

    • HALs implement safe, idiomatic Rust APIs to use the hardware capabilities, so raw register manipulation is not needed. The Embassy project maintains HALs for select hardware, but you can still use HALs from other projects with Embassy.
    • embassy-stm32, for all STM32 microcontroller families.
    • embassy-nrf, for the Nordic Semiconductor nRF52, nRF53, nRF54 and nRF91 series.
    • embassy-rp, for the Raspberry Pi RP2040 and RP23xx microcontrollers.
    • embassy-mspm0, for the Texas Instruments MSPM0 microcontrollers.
    • embassy-mcxa, for NXP's MCX-A series of microcontrollers.
    • esp-rs, for the Espressif Systems ESP32 series of chips.
      • Embassy HAL support for Espressif chips, as well as Async Wi-Fi, Bluetooth, and ESP-NOW, is being developed in the esp-rs/esp-hal repository.
    • ch32-hal, for the WCH 32-bit RISC-V(CH32V) series of chips.
    • mpfs-hal, for the Microchip PolarFire SoC.
    • py32-hal, for the Puya Semiconductor PY32 series of microcontrollers.
    • ra-hal, for the Renesas RA family of microcontrollers.
  • Time that Just Works - No more messing with hardware timers. embassy_time provides Instant, Duration, and Timer types that are globally available and never overflow.

  • Real-time ready - Tasks on the same async executor run cooperatively, but you can create multiple executors with different priorities so that higher priority tasks preempt lower priority ones. See the example.

  • Low-power ready - Easily build devices with years of battery life. The async executor automatically puts the core to sleep when there's no work to do. Tasks are woken by interrupts, there is no busy-loop polling while waiting.

  • Networking - The embassy-net network stack implements extensive networking functionality, including Ethernet, IP, TCP, UDP, ICMP, and DHCP. Async drastically simplifies managing timeouts and serving multiple connections concurrently.

  • Bluetooth

    • The trouble crate provides a Bluetooth Low Energy 4.x and 5.x Host that runs on any microcontroller implementing the bt-hci traits (currently nRF52, nrf54, rp2040, rp23xx and esp32 and serial controllers are supported).
    • The nrf-softdevice crate provides Bluetooth Low Energy 4.x and 5.x support for nRF52 microcontrollers.
    • The embassy-stm32-wpan crate provides Bluetooth Low Energy 5.x support for stm32wb microcontrollers.
  • LoRa - The lora-rs project provides an async LoRa and LoRaWAN stack that works well on Embassy.

  • USB - embassy-usb implements a device-side USB stack. Implementations for common classes such as USB serial (CDC ACM) and USB HID are available, and a rich builder API allows building your own.

  • Bootloader and DFU - embassy-boot is a lightweight bootloader supporting firmware application upgrades in a power-fail-safe way, with trial boots and rollbacks.

Sneak peek

use defmt::info;
use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull};
use embassy_nrf::{Peri, Peripherals};

// Declare async tasks
#[embassy_executor::task]
async fn blink(pin: Peri<'static, AnyPin>) {
    let mut led = Output::new(pin, Level::Low, OutputDrive::Standard);

    loop {
        // Timekeeping is globally available, no need to mess with hardware timers.
        led.set_high();
        Timer::after_millis(150).await;
        led.set_low();
        Timer::after_millis(150).await;
    }
}

// Main is itself an async task as well.
#[embassy_executor::main]
async fn main(spawner: Spawner) {
    let p = embassy_nrf::init(Default::default());

    // Spawned tasks run in the background, concurrently.
    spawner.spawn(blink(p.P0_13.into()).unwrap());

    let mut button = Input::new(p.P0_11, Pull::Up);
    loop {
        // Asynchronously wait for GPIO events, allowing other tasks
        // to run, or the core to sleep.
        button.wait_for_low().await;
        info!("Button pressed!");
        button.wait_for_high().await;
        info!("Button released!");
    }
}

Examples

Examples are found in the examples/ folder separated by the chip manufacturer they are designed to run on. For example:

  • examples/nrf52840 run on the nrf52840-dk board (PCA10056) but should be easily adaptable to other nRF52 chips and boards.
  • examples/nrf5340 run on the nrf5340-dk board (PCA10095).
  • examples/stm32xx for the various STM32 families.
  • examples/rp are for the RP2040 and RP235x chips.
  • examples/mcxa run on the FRDM-MCXA266 board.
  • examples/std are designed to run locally on your PC.

Running examples

  • Install probe-rs following the instructions at https://probe.rs.
  • Change directory to the sample's base directory. For example:
cd examples/nrf52840
  • Ensure Cargo.toml sets the right feature for the name of the chip you are programming. If this name is incorrect, the example may fail to run or immediately crash after being programmed.

  • Ensure .cargo/config.toml contains the name of the chip you are programming.

  • Run the example

For example:

cargo run --release --bin blinky

For more help getting started, see Getting Started and Running the Examples.

Developing Embassy with Rust Analyzer-based editors

The Rust Analyzer is used by Visual Studio Code and others. Given the multiple targets that Embassy serves, there is no Cargo workspace file. Instead, the Rust Analyzer must be told of the target project to work with. In the case of Visual Studio Code, please refer to the .vscode/settings.json file's rust-analyzer.linkedProjectssetting.

Minimum supported Rust version (MSRV)

Embassy is guaranteed to compile on latest stable Rust. It might compile with older versions, but that may change in any new patch release.

Why the name?

EMBedded ASYnc! :)

License

Embassy is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.