1.. _nxp_s32_netc-samples: 2 3NXP S32 NETC Sample Application 4############################### 5 6Overview 7******** 8 9The sample application shows how to configure NXP S32 Network Controller (NETC) 10for the different use-cases: 11 121. Zephyr application controls the Physical Station Interface (PSI) and the 13 Ethernet PHY through EMDIO. 14 152. Zephyr application controls the PSI, Virtual SI 1, and the Ethernet PHY 16 through EMDIO. 17 18The sample enables the net-shell and mdio-shell (only available when Zephyr 19controls PSI) to allow users visualize the networking settings. Telnet shell 20and backend is also enabled. 21 22The source code for this sample application can be found at: 23:zephyr_file:`samples/boards/nxp_s32/netc`. 24 25Requirements 26************ 27 28To run this sample is needed to set-up a host machine running GNU/Linux or Windows 29with a network adapter connected to the target board ETH0 port through an Ethernet 30cable. 31 32Building and Running 33******************** 34 35To build and run the sample application for use-case 1: 36 37.. zephyr-app-commands:: 38 :zephyr-app: samples/boards/nxp_s32/netc 39 :board: s32z270dc2_rtu0_r52 40 :goals: build flash 41 42Once started, you should see the network interface details, for example: 43 44.. code-block:: console 45 46 [00:00:00.051,000] <inf> phy_mii: PHY (7) ID 1CC916 47 48 [00:00:00.052,000] <inf> nxp_s32_eth_psi: SI0 MAC: 00:00:00:01:02:00 49 [00:00:00.058,000] <inf> shell_telnet: Telnet shell backend initialized 50 [00:00:00.058,000] <inf> nxp_s32_netc_sample: Starting sample 51 [00:00:00.058,000] <inf> nxp_s32_netc_sample: Waiting for iface 1 to come up 52 [00:00:07.595,000] <inf> phy_mii: PHY (7) Link speed 1000 Mb, full duplex 53 54 [00:00:07.595,000] <inf> nxp_s32_netc_sample: Configuring iface 1 (0x318008f0) 55 [00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv6 address: 2001:db8::1 56 [00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv4 address: 192.0.2.1 57 58To build and run the sample application for use-case 2: 59 60.. zephyr-app-commands:: 61 :zephyr-app: samples/boards/nxp_s32/netc 62 :board: s32z270dc2_rtu0_r52 63 :goals: build flash 64 :gen-args: -DDTC_OVERLAY_FILE="./vsi-and-psi.overlay" 65 66Once started, you should see the network interfaces details, for example: 67 68.. code-block:: console 69 70 [00:00:00.051,000] <inf> phy_mii: PHY (7) ID 1CC916 71 72 [00:00:00.052,000] <inf> nxp_s32_eth_psi: SI0 MAC: 00:00:00:01:02:00 73 [00:00:00.052,000] <inf> nxp_s32_eth_vsi: SI1 MAC: 00:00:00:01:02:11 74 [00:00:00.058,000] <inf> shell_telnet: Telnet shell backend initialized 75 [00:00:00.058,000] <inf> nxp_s32_netc_sample: Starting sample 76 [00:00:00.058,000] <inf> nxp_s32_netc_sample: Waiting for iface 1 to come up 77 [00:00:07.595,000] <inf> phy_mii: PHY (7) Link speed 1000 Mb, full duplex 78 79 [00:00:07.595,000] <inf> nxp_s32_netc_sample: Configuring iface 1 (0x3182f31c) 80 [00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv6 address: 2001:db8::1 81 [00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv4 address: 192.0.2.1 82 [00:00:07.595,000] <inf> nxp_s32_netc_sample: Configuring iface 2 (0x3182f328) 83 [00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv6 address: 2001:db8::2 84 [00:00:07.595,000] <inf> nxp_s32_netc_sample: IPv4 address: 192.0.2.2 85 86Setting up Host 87*************** 88 89To be able to reach the board from the host, it's needed to configure the host 90network interface IP's and default routes. This guide assumes the host IPv4 and 91IPv6 addresses are `192.0.2.3` and `2001:db8::3`, respectively. For example, 92using a network interface named `enp1s0` in a GNU/Linux host or `Ethernet` in 93a Windows host, this can be done with the following commands: 94 95.. tabs:: 96 97 .. group-tab:: Linux 98 99 .. code-block:: console 100 101 ip -4 addr add 192.0.2.3/24 dev enp1s0 102 ip -6 addr add 2001:db8::3/128 dev enp1s0 103 route -A inet6 add default dev enp1s0 104 105 .. group-tab:: Windows 106 107 .. code-block:: console 108 109 netsh interface ipv4 set address "Ethernet" static 192.0.2.3 255.255.255.0 110 netsh interface ipv6 add address "Ethernet" 2001:db8::3/128 111 netsh interface ipv6 add route ::/0 "Ethernet" :: 112 113.. note:: 114 The above commands must be run as priviledged user. 115 116If everything is configured correctly, you will be able to successfully execute 117the following commands from the Zephyr shell: 118 119.. code-block:: console 120 121 net ping -I<iface> 192.0.2.3 122 net ping -I<iface> 2001:db8::3 123 124Where `<iface>` is the interface number starting from 1. 125