Skip to content

cpu/lpc1768: add ethernet driver#22305

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

cpu/lpc1768: add ethernet driver#22305
basilfx wants to merge 9 commits into
RIOT-OS:masterfrom
basilfx:feature/lpc1768_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 EFM32 ethernet driver in #22306. 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 LPC1768. Although this CPU is ancient and not the best-supported one, it is still an active one. It is also very well supported by other projects and I have a board (Seeeduino Arch Pro) that has ethernet support.

I have no former experience with ethernet drivers, so that's why I chose this one. Together with the help of LLMs, I figured this would be an OK challenge, which is a small side-step to get Modbus TCP support testable.

I took the ethernet driver of the SAM0 and the STM32 as a basis, and modelled it closely to that one.

What is provided:

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

Testing procedure

The only LPC1768 board with ethernet in RIOT's code base, is the Seeeduino Arch Pro. I don't think many people will own this board, so it is noted that actual testing will a be a bit harder.

At this point, 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/lpc1768_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).

With lpc1768_eth_auto enabled, the link speed is ~15-20 MBit/sec (measured using lwIP iPerf). Without, it is ~75-100 KBit/sec (classical issue due to link negotation issues).

Compile test
#!/bin/sh

set -e

BOARD=seeeduino_arch-pro make -C tests/drivers/lpc1768_eth -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up make -C tests/drivers/lpc1768_eth -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto make -C tests/drivers/lpc1768_eth -j 14

BOARD=seeeduino_arch-pro make -C examples/networking/misc/benchmark_udp -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up make -C examples/networking/misc/benchmark_udp -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto make -C examples/networking/misc/benchmark_udp -j 14

BOARD=seeeduino_arch-pro LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14

# lwIP IPerf application is still a PR
# BOARD=seeeduino_arch-pro LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14

BOARD=seeeduino_arch-pro LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14

TOOLCHAIN=llvm BOARD=seeeduino_arch-pro make -C tests/drivers/lpc1768_eth -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up make -C tests/drivers/lpc1768_eth -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto make -C tests/drivers/lpc1768_eth -j 14

TOOLCHAIN=llvm BOARD=seeeduino_arch-pro make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto make -C examples/networking/misc/benchmark_udp -j 14

TOOLCHAIN=llvm BOARD=seeeduino_arch-pro LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto LWIP=1 make -C examples/networking/misc/benchmark_udp -j 14

# lwIP IPerf application is still a PR
# TOOLCHAIN=llvm BOARD=seeeduino_arch-pro LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14
# TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_auto LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/networking/misc/lwiperf -j 14

TOOLCHAIN=llvm BOARD=seeeduino_arch-pro LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_eth_link_up LWIP_IPV4=1 LWIP_IPV6=1 make -C examples/basic/default -j 14
TOOLCHAIN=llvm BOARD=seeeduino_arch-pro USEMODULE=lpc1768_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/lpc1768. 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
@basilfx basilfx force-pushed the feature/lpc1768_eth branch from 1393b11 to 6a742ef Compare May 19, 2026 10:03
@riot-ci
Copy link
Copy Markdown

riot-ci commented May 19, 2026

Murdock results

✔️ PASSED

257d4a6 fixup! cpu/lpc1768: add ethernet support

Success Failures Total Runtime
11108 0 11108 10m:41s

Artifacts

basilfx added 8 commits May 19, 2026 23:08
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/lpc1768_eth branch from e7c2cc8 to 257d4a6 Compare May 19, 2026 21:08
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