Skip to content
Embedded Ethernet driver in Rust
Branch: master
Clone or download
Latest commit 780b1d9 May 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples examples: update and simplify Mar 10, 2019
src setup, rx, tx: update doc Mar 14, 2019
.gdbinit .gdbinit: continue instead of step Mar 10, 2019
.travis.yml port setup to stm32f4xx-hal gpio interface Mar 10, 2019
LICENSE add LICENSE Apr 25, 2018 Fix Travis CI badge May 7, 2019
memory.x memory.x: fix linker script Mar 10, 2019 port setup to stm32f4xx-hal gpio interface Mar 10, 2019

Rust Ethernet Driver for STM32F* microcontrollers

Build Status

Supported microcontrollers

  • STM32F4xx

Please send pull requests.


Add to the [dependencies] section in your Cargo.toml:

stm32f4xx-hal = { version = "*", features = ["stm32f429"] }
stm32-eth = { version = "0.1.1", features = ["nucleo-f429zi"] }

In src/ add:

use stm32f4xx_hal::{
use stm32_eth::{Eth, RingEntry};

fn main() {
    let p = Peripherals::take().unwrap();

    // Setup pins and initialize clocks.
    stm32_eth::setup(&p.RCC, &p.SYSCFG);
    let gpioa = p.GPIOA.split();
    let gpiob = p.GPIOB.split();
    let gpioc = p.GPIOC.split();
    let gpiog = p.GPIOG.split();
        gpioa.pa1, gpioa.pa2, gpioa.pa7, gpiob.pb13, gpioc.pc1,
        gpioc.pc4, gpioc.pc5, gpiog.pg11, gpiog.pg13
    // Allocate the ring buffers
    let mut rx_ring: [RingEntry<_>; 8] = Default::default();
    let mut tx_ring: [RingEntry<_>; 2] = Default::default();
    // Instantiate driver
    let mut eth = Eth::new(
        &mut rx_ring[..], &mut tx_ring[..]
    // If you have a handler, enable interrupts
    eth.enable_interrupt(&mut cp.NVIC);

    if let Ok(pkt) = eth.recv_next() {
        // handle received pkt

    eth.send(size, |buf| {
        // write up to `size` bytes into buf before it is being sent

[smoltcp] support

Use feature-flag smoltcp-phy

You can’t perform that action at this time.