Nios® V Embedded Processor Design Handbook

ID 726952
Date 5/13/2024

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

5.7.2. Configuring MAC and IP Addresses

You can configure the MAC and IP addresses of the µC/TCP-IP module by editing the struct network_conf conf in software/app/main.c source code.

If a DHCP server is available on your network, enable the DHCP feature by modifying the use_dhcp field to true (DEF_TRUE). If the DHCP feature is enabled, the provided IP addresses, network mask, and gateway are left unused. It is not required to clear their contents.

If the development board is connected directly to your PC with a crossover Ethernet cable, or no DHCP server is available, disable the DHCP feature (!DEF_TRUE) and specify the IP addresses, network mask, and gateway.

Default “struct network_conf conf” in main.c

struct network_conf conf = {
    .tse_sys_info = tse_sys_info,
    .mac_addr = "00:07:ed:ff:8c:05",
    .use_dhcp = !DEF_TRUE,
    .ipv4_addr_str    = "",
    .ipv4_mask_str    = "",
    .ipv4_gateway_str = ""
  • Choose your default IP and gateway addresses carefully. Some secure router configurations block DHCP request packets on local subnetworks such as the 192.168.X.X subnetwork. If you encounter problems, try using as your default IP and gateway addresses.
  • You can configure the DHCP waiting time (DHCP_WAIT_MS) in the uc_tcp_ip_init.c source code. The DHCP waiting time is the amount of time delayed before verifying that a valid IP address is acquired by the TSE IP.