8 releases (breaking)

0.6.0 Jan 5, 2025
0.5.0 Nov 28, 2024
0.4.0 Jan 11, 2024
0.3.0 Jan 4, 2024
0.0.0 Oct 20, 2021

#354 in Embedded development

Download history 2024/week @ 2024-09-23 1567/week @ 2024-09-30 1846/week @ 2024-10-07 1582/week @ 2024-10-14 1896/week @ 2024-10-21 1938/week @ 2024-10-28 2484/week @ 2024-11-04 2218/week @ 2024-11-11 2501/week @ 2024-11-18 2626/week @ 2024-11-25 1728/week @ 2024-12-02 1710/week @ 2024-12-09 2180/week @ 2024-12-16 927/week @ 2024-12-23 1150/week @ 2024-12-30 2477/week @ 2025-01-06

6,877 downloads per month
Used in 9 crates (7 directly)

MIT/Apache

435KB
9K SLoC

embassy-net

embassy-net is a no-std no-alloc async network stack, designed for embedded systems.

It builds on smoltcp. It provides a higher-level and more opinionated API. It glues together the components provided by smoltcp, handling the low-level details with defaults and memory management designed to work well for embedded systems, aiming for a more "Just Works" experience.

Features

  • IPv4, IPv6
  • Ethernet and bare-IP mediums.
  • TCP, UDP, DNS, DHCPv4
  • TCP sockets implement the embedded-io async traits.
  • Multicast

See the smoltcp README for a detailed list of implemented and unimplemented features of the network protocols.

Hardware support

  • esp-wifi for WiFi support on bare-metal ESP32 chips. Maintained by Espressif.
  • cyw43 for WiFi on CYW43xx chips, used in the Raspberry Pi Pico W
  • embassy-usb for Ethernet-over-USB (CDC NCM) support.
  • embassy-stm32 for the builtin Ethernet MAC in all STM32 chips (STM32F1, STM32F2, STM32F4, STM32F7, STM32H7, STM32H5).
  • embassy-net-wiznet for Wiznet SPI Ethernet MAC+PHY chips (W5100S, W5500)
  • embassy-net-esp-hosted for using ESP32 chips with the esp-hosted firmware as WiFi adapters for another non-ESP32 MCU.

Examples

  • For usage with Embassy HALs and network chip drivers, search here for eth or wifi.
  • The esp-wifi repo has examples for use on bare-metal ESP32 chips.
  • For usage on std platforms, see the std examples

Adding support for new hardware

To add embassy-net support for new hardware (i.e. a new Ethernet or WiFi chip, or an Ethernet/WiFi MCU peripheral), you have to implement the embassy-net-driver traits.

Alternatively, embassy-net-driver-channel provides a higher-level API to construct a driver that processes packets in its own background task and communicates with the embassy-net task via packet queues for RX and TX.

Drivers should depend only on embassy-net-driver or embassy-net-driver-channel. Never on the main embassy-net crate. This allows existing drivers to continue working for newer embassy-net major versions, without needing an update, if the driver trait has not had breaking changes.

Interoperability

This crate can run on any executor.

embassy-time is used for timekeeping and timeouts. You must link an embassy-time driver in your project to use this crate.

Dependencies

~4MB
~78K SLoC