Modern embedded framework, using Rust and async. https://embassy.dev
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
leftger 0bf016d305
Merge pull request #7604 from leftger/feat/embassy-usb-mtp
embassy-usb: add MTP (Media Transfer Protocol) device class
2026-11-20 06:41:34 +00:00
.github stm32/exti: remove cargo feature 2026-11-18 22:36:20 +01:00
.helix stm32/exti: remove cargo feature 2026-11-18 22:36:20 +01:00
.vscode crypto: merge embassy-crypto-driver into embassy-crypto, split software drivers into embassy-crypto-rustcrypto. 2026-09-08 18:00:42 +02:00
cyw43 chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01:00
cyw43-firmware cyw: update write nvrams script 2026-04-21 10:26:52 -05:00
cyw43-pio deps: remove fixed 2026-10-19 20:26:22 +02:00
docs stm32/exti: remove cargo feature 2026-11-18 22:36:20 +01:00
embassy-ambiq Do not enable debug and defmt impls in PACs by default. 2026-11-17 01:00:00 +01:00
embassy-boot Merge pull request #7356 from romixlab/boot-fuzz-pr 2026-11-12 10:03:38 +00:00
embassy-boot-nrf deps: remove unused deps 2026-10-20 00:51:30 +02:00
embassy-boot-rp deps: remove unused deps 2026-10-20 00:51:30 +02:00
embassy-boot-stm32 stm32/rcc g0: keep flash prefetch off in dual-bank mode (ES0547/ES0548/ES0549) 2026-10-20 14:56:51 +02:00
embassy-crypto Implement core::error::Error for embassy_crypto::driver::Error 2026-11-16 11:27:39 +01:00
embassy-crypto-rand crypto: add RNG public API, make it infallible. 2026-09-09 23:51:03 +02:00
embassy-crypto-rustcrypto fix: chacha counter wrap on 32 bit targets 2026-10-29 13:08:49 +01:00
embassy-crypto-stub add embassy-crypto-stub crate 2026-10-13 19:36:14 -05:00
embassy-crypto-test Various typo fixes in comments and strings 2026-10-25 11:21:46 +01:00
embassy-embedded-hal chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01:00
embassy-executor chore: remove never type hack 2026-11-14 18:07:45 -06:00
embassy-executor-macros chore: remove never type hack 2026-11-14 18:07:45 -06:00
embassy-executor-timer-queue Add links to embassy-executor-timer-queue 2026-10-17 16:17:00 +02:00
embassy-futures Edition 2024. 2025-10-06 23:19:53 +02:00
embassy-hal-internal chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01:00
embassy-imxrt Do not enable debug and defmt impls in PACs by default. 2026-11-17 01:00:00 +01:00
embassy-mcxa rustfmt 2026-11-17 11:02:36 -08:00
embassy-microchip Do not enable debug and defmt impls in PACs by default. 2026-11-17 01:00:00 +01:00
embassy-mspm0 fmt 2026-11-18 16:47:29 -05:00
embassy-net chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01:00
embassy-net-adin1110 Fix more typos 2026-10-25 13:29:05 +01:00
embassy-net-driver-channel deps: remove unused deps 2026-10-19 17:50:50 +02:00
embassy-net-enc28j60 deps: remove unused deps 2026-10-19 17:50:50 +02:00
embassy-net-esp-hosted chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01:00
embassy-net-nrf91 fix: use dedicated buffer for control commands 2026-11-18 13:07:26 +01:00
embassy-net-ppp chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01:00
embassy-net-tuntap Merge pull request #7306 from ThoFrank/fix/tuntap_waker_registration 2026-10-23 07:34:52 +00:00
embassy-net-wiznet embassy-net-wiznet: yield while waiting on the controller 2026-10-18 23:17:33 +13:00
embassy-nrf usb: add IsoEndpointIn and IsoInSlot for scheduled isochronous IN 2026-11-19 11:16:31 -07:00
embassy-nxp Do not enable debug and defmt impls in PACs by default. 2026-11-17 01:00:00 +01:00
embassy-ptp-driver net: port to new xarxa 2026-08-29 01:52:39 +02:00
embassy-rp usb: add IsoEndpointIn and IsoInSlot for scheduled isochronous IN 2026-11-19 11:16:31 -07:00
embassy-stm32 stm32/npu: apply nightly rustfmt 2026-11-19 20:35:48 -07:00
embassy-stm32-neochrom deps: remove unused deps 2026-10-19 17:50:50 +02:00
embassy-stm32-wpan Merge pull request #7536 from OueslatiGhaith/wba-ble-reinit-state 2026-11-13 18:44:27 +00:00
embassy-sync sync: implement Format and Debug where possible 2026-11-19 11:27:03 +01:00
embassy-time Various typo fixes in comments and strings 2026-10-25 11:21:46 +01:00
embassy-time-driver Adds 24.567 MHz, 25.6 MHz and 38.4MHz as supported tick rates for embassy-time and embassy-time-driver. 2026-10-14 10:51:44 +08:00
embassy-time-queue-utils Prepare ETQU 0.3.2 2026-04-21 23:34:07 +02:00
embassy-usb Merge pull request #7604 from leftger/feat/embassy-usb-mtp 2026-11-20 06:41:34 +00:00
embassy-usb-dfu usb: add role/class features and host foundation 2026-11-09 22:48:12 -07:00
embassy-usb-driver usb: add IsoEndpointIn and IsoInSlot for scheduled isochronous IN 2026-11-19 11:16:31 -07:00
embassy-usb-logger usb: add EndpointOptions. 2026-11-11 19:03:13 +01:00
embassy-usb-synopsys-otg usb: add IsoEndpointIn and IsoInSlot for scheduled isochronous IN 2026-11-19 11:16:31 -07:00
examples stm32/npu: run streaming-engine epochs 2026-11-19 16:34:23 -07:00
release chore: move tool to separate repo 2025-08-25 19:44:51 +02:00
tests Merge pull request #7585 from gworkman/stm32-flash-ecc-program 2026-11-19 13:56:17 +00:00
.gitattributes Use merge=union for changelogs to avoid constant conflicts. 2025-09-05 16:27:48 +02:00
.gitignore ignore work 2026-08-21 16:16:25 -05:00
API-GUIDELINES.md usb: merge ControlPipe into Bus 2026-11-16 20:53:57 -07:00
ci-nightly.sh net: migrate smoltcp -> xarxa 2026-07-28 14:21:40 +02:00
ci-xtensa.sh net: migrate smoltcp -> xarxa 2026-07-28 14:21:40 +02:00
ci.sh stm32/low-power: restore clocks after Stop, run HIL tests in real Stop 2026-11-18 19:35:30 +01:00
CONTRIBUTING.md Add contributor guide. 2026-07-25 22:48:39 +02: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 mcxa: rename board examples 2026-10-15 14:54:42 -07:00
RELEASE.md Fix more typos 2026-10-25 13:29:05 +01:00
rust-toolchain-nightly.toml chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01:00
rust-toolchain.toml chore: update rustc and use drop guard from core 2026-11-13 12:32:20 +01: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. embassy-ptp-driver provides a network-stack-independent interface for reading and adjusting PTP hardware clocks.

  • 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/mcxa266 run on the FRDM-MCXA266 board.
  • examples/mcxa577 run on the FRDM-MCXA577 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.