Skip to content

arch/risc-v: Support the ethernet driver on ESP32-P4#18827

Open
tmedicci wants to merge 4 commits intoapache:masterfrom
tmedicci:feature/esp32p4_eth
Open

arch/risc-v: Support the ethernet driver on ESP32-P4#18827
tmedicci wants to merge 4 commits intoapache:masterfrom
tmedicci:feature/esp32p4_eth

Conversation

@tmedicci
Copy link
Copy Markdown
Contributor

Summary

Enables the ethernet driver support on ESP32-P4 based on a common-source implementation. This required a set of changes regarding the event handler for the Wi-Fi driver (which is now shared with the ethernet driver).

Impact

Impact on user: Yes. Users can now use Ethernet on ESP32-P4.

Impact on build: No.

Impact on hardware: Yes. Mostly ESP32-P4, but all the supported SoCs from Espressif required small changes and optimization.

Impact on documentation: Yes. Documentation for the Ethernet network was properly added to ESP32-P4 chip its Functio EV board.

Impact on security: No.

Impact on compatibility: No.

Testing

esp32p4-function-ev-board:ethernet defconfig can be used to test Ethernet on ESP32-P4. iperf testing is also possible. Please note that for v1.5.2 of the board, it's easier to flash using the USB-Serial/JTAG port (usually /dev/ttyACM) and use an externally connected USB-to-serial converter attached to UART0.

Building

make -j distclean
./tools/configure.sh -S esp32p4-function-ev-board:ethernet
make flash ESPTOOL_PORT=/dev/ttyACM0 -s -j$(nproc)
picocom -b 115200 /dev/ttyUSB1

Running

Checking eth0 with DHCP client enabled:

Attach the ethernet cable to the board and check the interface status and its IP address (please ensure that the cable is connected to a network with a DHCP server enabled):

nsh> ifconfig
eth0	Link encap:Ethernet HWaddr 30:ed:a0:ec:f1:60 at RUNNING mtu 1500
	inet addr:10.0.10.50 DRaddr:10.0.10.1 Mask:255.255.255.0

iperf testing:

Both UDP and TCP modes can be tested.

UDP

On the host PC, run the iperf server:

iperf -u -s -p 11111 -i 1

On the device, run the iperf client:

nsh> iperf -u -c <host_pc_ip_address> -p 11111 -i 1 -t 5 &
TCP

On the host PC, run the iperf server:

iperf -s -p 11111 -i 1

On the device, run the iperf client:

nsh> iperf -c <host_pc_ip_address> -p 11111 -i 1 -t 5 &

Results

For ifconfig, the network's status should be RUNNING and it should acquire a valid IP address.

iperf's results are the following. Both are closed to the port's bandwidth limit of 100Mbits/sec.

UDP

nsh>      IP: 10.0.10.50

 mode=udp-client sip=10.0.10.50:5001,dip=10.0.10.81:11111, interval=1, time=5

           Interval         Transfer         Bandwidth

   0.00-   1.01 sec   11992384 Bytes   94.99 Mbits/sec
   1.01-   2.02 sec   12082176 Bytes   95.70 Mbits/sec
   2.02-   3.03 sec   12083648 Bytes   95.71 Mbits/sec
   3.03-   4.04 sec   12082176 Bytes   95.70 Mbits/sec
   4.04-   5.05 sec   12082176 Bytes   95.70 Mbits/sec
   0.00-   5.05 sec   60322560 Bytes   95.56 Mbits/sec
iperf exit

TCP

nsh>      IP: 10.0.10.50

 mode=tcp-client sip=10.0.10.50:5001,dip=10.0.10.81:11111, interval=1, time=5

           Interval         Transfer         Bandwidth

   0.00-   1.01 sec   10256384 Bytes   81.24 Mbits/sec
   1.01-   2.02 sec   10338304 Bytes   81.89 Mbits/sec
   2.02-   3.03 sec   10338304 Bytes   81.89 Mbits/sec
   3.03-   4.04 sec   10338304 Bytes   81.89 Mbits/sec
   4.04-   5.05 sec   10338304 Bytes   81.89 Mbits/sec
   0.00-   5.05 sec   51609600 Bytes   81.76 Mbits/sec
iperf exit

This commit enables the ethernet driver support on ESP32-P4 based
on a common-source implementation. This required a set of changes
regargind the event handler for the Wi-Fi driver (which is now
shared with the ethernet driver).

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
After recent changes on the event handler for the RISC-V-based
Espressif SoCs, the same set of changes were ported back to xtensa
devices.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
This commit simply enables the ethernet support for the ESP32-P4's
Function EV board.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
This commit describes ethernet support on ESP32-P4 SoC and its
ESP32-P4-Function-EV-Board v1.5.2.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: xtensa Issues related to the Xtensa architecture Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: risc-v labels Apr 30, 2026
@acassis acassis requested review from cederom and linguini1 April 30, 2026 19:07
Copy link
Copy Markdown
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big Thank You @tmedicci :-)


struct esp_emac_s
{
struct net_driver_s dev;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use the common upperhalf to avoid the code duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: xtensa Issues related to the Xtensa architecture Area: Documentation Improvements or additions to documentation Board: risc-v Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants