2142271_en-US

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2142271_en-US

2142271_en-US

Sample application for Ethernet send and receive with internal loopback on Zephyr.

#zephyr S32K148EVB #ethernet #Enet_ip

I would like to use net_if ,ethernet APIs and create a application where i can send and receive net package in loopback manner. 

I can see the driver apis in zephyr but cannot see much use of it in any sample application or not doing in loopback manner. I would like to design any of below sample application. the major gap for me is receiving the package.

-enet

-net_if.

One more hint i would like to make similar project to s32k1 SDK/Eth_InternalLoopback_S32k148 project


Re: Sample application for Ethernet send and receive with internal loopback on Zephyr.

Hello @keykur ,

This use case seems best suited for a low-level API approach (i.e., working directly with the Ethernet driver). However, due to how the ethernet_api is designed in Zephyr, Ethernet MAC drivers submit received frames directly to the Zephyr TCP/IP stack. As a result, it's necessary to interact with the stack itself rather than just the driver.

From what I’ve found, the packet socket API appears to be the most appropriate solution for this scenario:
https://docs.zephyrproject.org/3.7.0/samples/net/sockets/packet/README.html#packet-socket

Additionally, Zephyr provides a traffic capture API, which can also be used to observe Ethernet frames:
https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/net/lib/capture/capture.c

This capture API is primarily intended for monitoring and analysis, rather than for processing frames as part of the application logic. Therefore, for active send/receive use cases, the packet socket API is likely the better fit.

Best regards,

Pavel

Re: Sample application for Ethernet send and receive with internal loopback on Zephyr.

I can see how to configure TX callback. but nothign for rx. so i would like a callback or the point of execution in zephyr where does it goes when we receive a pkt.

Tags (1)
No ratings
Version history
Last update:
‎11-21-2025 06:17 PM
Updated by: