Skip to content

cpu/efm32: add ethernet driver#22306

Open
basilfx wants to merge 9 commits into
RIOT-OS:masterfrom
basilfx:feature/efm32_eth
Open

cpu/efm32: add ethernet driver#22306
basilfx wants to merge 9 commits into
RIOT-OS:masterfrom
basilfx:feature/efm32_eth

Conversation

@basilfx
Copy link
Copy Markdown
Member

@basilfx basilfx commented May 19, 2026

Contribution description

Note

Development of this PR happens in parallel to the LPC1768 ethernet driver in #22305. Any feedback on this one is likely applicable to the other one as well. I will try to keep both PRs in sync where it matters.

This PR adds an ethernet driver for the EFM32. While working on the LPC1768 version, I decided to also add support for the EFM32.

What is provided:

  • Low-level driver with netdev driver on top of it.
  • Separate modules (efm32_eth_link_up, efm32_eth_auto) like the STM32.
  • lwIP/GNRC auto-initialization.
  • Kconfig tunables for buffers/timeouts/etc.

Testing procedure

The only EFM32 board with ethernet in RIOT's code base, is the SLSTK3701a.

Like the LPC1768 ethernet driver, I would rather receive feedback on the general structure and adoption. I will then do my best to collect as much evidence as possible.

Testing has been performed as follows:

  • Compile tests (mixes options and toolchains, see below)
  • Benchmark UDP
  • Driver test in tests/drivers/efm32_eth
  • Ping test (including fragmentation and large frames, >12 hours)
  • lwIP iPerf (depends on examples/networking/misc/lwiperf: add application #22286).
  • IPv4/IPv6.
  • Monkey testing (link up/down etc).

Based on this, I believe it is in a working state.

With efm32_eth_auto enabled, the link speed is ~7.5-10 MBit/sec (measured using lwIP iPerf).

Compile test
#!/bin/sh

set -e

BOARD=slstk3701a make -C tests/drivers/efm32_eth -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_link_up make -C tests/drivers/efm32_eth -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_auto make -C tests/drivers/efm32_eth -j 14

BOARD=slstk3701a make -C examples/networking/misc/benchmark_udp -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_link_up make -C examples/networking/misc/benchmark_udp -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_auto make -C examples/networking/misc/benchmark_udp -j 14

BOARD=slstk3701a LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_link_up LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_auto LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14

# lwIP IPerf application is still a PR
# BOARD=slstk3701a LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# BOARD=slstk3701a USEMODULE=efm32_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# BOARD=slstk3701a USEMODULE=efm32_eth_auto LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14

BOARD=slstk3701a LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
BOARD=slstk3701a USEMODULE=efm32_eth_auto LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14

TOOLCHAIN=llvm BOARD=slstk3701a make -C tests/drivers/efm32_eth -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_link_up make -C tests/drivers/efm32_eth -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_auto make -C tests/drivers/efm32_eth -j 14

TOOLCHAIN=llvm BOARD=slstk3701a make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_link_up make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_auto make -C examples/networking/misc/benchmark_udp -j 14

TOOLCHAIN=llvm BOARD=slstk3701a LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_link_up LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_auto LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14

# lwIP IPerf application is still a PR
# TOOLCHAIN=llvm BOARD=slstk3701a LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_auto LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14

TOOLCHAIN=llvm BOARD=slstk3701a LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
TOOLCHAIN=llvm BOARD=slstk3701a USEMODULE=efm32_eth_auto LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14

Issues/PRs references

None

Declaration of AI-Tools / LLMs usage:

AI-Tools / LLMs that were used are:

  • Claude Code generated the first (non-working) version of the driver in cpu/efm32. I then refined, reworked and tested it myself. I did ask Claude Code to analyze bugs I encountered during testing. The final PR review was also done with Claude Code, but changes were applied manually. The test application, auto-init adoption and several other parts are simply copy-paste of existing drivers.

@github-actions github-actions Bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: network Area: Networking Area: doc Area: Documentation Area: tests Area: tests and testing framework Area: build system Area: Build system Area: pkg Area: External package ports Area: drivers Area: Device drivers Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: sys Area: System Area: Kconfig Area: Kconfig integration labels May 19, 2026
@basilfx basilfx added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label May 19, 2026
@crasbe crasbe added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label May 19, 2026
@riot-ci
Copy link
Copy Markdown

riot-ci commented May 19, 2026

Murdock results

FAILED

42ecd8b fixup! cpu/efm32: add ethernet support

Success Failures Total Runtime
6257 0 10672 06m:20s

Artifacts

basilfx added 9 commits May 20, 2026 08:39
Although the ethernet peripheral isn't a common peripheral, it is best
placed under the peripheral configuration in the Kconfig menu.
This commit adds a driver for the ethernet peripheral. It is split
into a low-level peripheral driver, and a higher-level netdev driver.

Two pseudo-modules are introduced for link state monitoring and auto
negotiation.

Kconfig support has been added too.
@basilfx basilfx force-pushed the feature/efm32_eth branch from 0c09c87 to 42ecd8b Compare May 20, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants