Wiznet makers

ronpang

Published July 22, 2025 © Apache License 2.0 (Apache-2.0)

130 UCC

51 WCC

32 VAR

0 Contests

1 Followers

0 Following

Hardwired TCP/IP Chapter 1: W55MH32 Network Initialization Example

Hardwired TCP/IP Chapter 1: W55MH32 Network Initialization Example

COMPONENTS
PROJECT DESCRIPTION

Chapter 1 W55MH32 Network Initialization Example

The W55MH32 chip demonstrates outstanding performance advantages. Its core is equipped with a 32-bit Arm® Cortex®-M3 Core, and the operating frequency can reach an impressive 216 MHz, providing a solid foundation for efficient data processing. The chip is equipped with 1024KB of FLASH and 96KB of SRAM, and the large-capacity storage configuration is sufficient to meet the storage requirements of complex programs and data. At the same time, it has strong support for peripherals, with a maximum of 61 GPIO, greatly expanding the diversity and flexibility of its applications.

What is particularly noteworthy is that the W55MH32 chip is equipped with WIZnet's TCP/IP Unloading Engine (TOE), which integrates a full hardware TCP/IP protocol stack, MAC, and PHY. This highly integrated design enables the easy realization of embedded Ethernet applications with just this one chip, significantly reducing the complexity and cost of development, bringing great convenience and efficiency to the development of embedded Ethernet applications, and making it the preferred chip for embedded Ethernet projects.

In this article, we will how to use the TOE function on the W55MH32 chip initialize the initial TOE engine and perform network initialization configuration and start the Ethernet chapter tutorial.

For information on the registers of TOE please refer to "Chapter 9 of the 'W55MH32 Reference Manual' - TCP/IP Unloading Engine (TOE)".

1 Introduction to TCP/IP Unloading Engine (TOE)

The TCP/IP Unloading Engine (TOE) is an embedded all-hardware TCP/IP Ethernet controller that can offer a more streamlined embedded network access solution. The 10/100M Ethernet data link layer (MAC) and physical layer (PHY) enable users to expand their network connections using a single chip in their applications.

The proven WIZnet all-hardware TCP/IP protocol stack supports TCP, UDP, IPv4, ICMP, ARP, IGMP, and PPPoE protocols. An on-chip 32K byte cache is embedded for Ethernet packet processing. Using the TCP/IP Unloading Engine (TOE), only some simple Socket programming is required to implement Ethernet applications. This will be faster and more convenient than other embedded Ethernet solutions. Users can simultaneously use 8 hardware Sockets for independent communication. To reduce system energy consumption, network wake-up mode (WOL) and power-off mode are provided for customers to choose to use.

2 Introduction to Network Address Information

Network address information is a digital identifier used in computer networks to identify and locate devices, hosts, networks, and other resources. It plays a crucial role in network communication, facilitating the transmission of data packets between different network nodes and reaching the target device. Network addresses are typically composed of IP addresses, subnet masks, gateway addresses, and DNS addresses, and they perform different functions at different levels.

Note: The IP addresses used in this article and all subsequent ones are of the IPv4 version.

  • IP Address: The IP address is an address used in computer networks to uniquely identify devices. Each device connected to the network has an IP address, which is used for communication on the network. It is usually represented by a series of decimal numbers separated by periods, with each number ranging from 0 to 255. For example: 192.168.1.1.
  • Subnet Mask: The subnet mask is used to divide an IP address into the network part and the host part. The part corresponding to 1 in the subnet mask represents the network address, while the part corresponding to 0 represents the host address. For example, if a device's IP address is 192.168.1.100 and the subnet mask is 255.255.255.0, performing an AND operation (bitwise AND) with the IP address and the subnet mask results in 192.168.1.0, indicating that the device belongs to the 192.168.1.0 network segment. If it wants to communicate with devices in the 192.168.2.0 network segment, it needs to hand over the data to the gateway for processing.
  • Gateway Address: The gateway address is the IP address that a device passes through when it needs to access different networks. This device is usually a router or firewall at the network edge, helping local devices communicate with external networks (such as the Internet).
  • DNS Address: The DNS address is the IP address of the Domain Name System. DNS is used to convert easily memorable domain names into IP addresses that computers can understand. For example, when you type www.example.com in the browser, the DNS server will resolve the domain name www.example.com into the corresponding IP address (possibly 192.168.1.1 or other). Generally, our DNS address is set to public DNS server addresses (such as 114.114.114.114 provided by China Telecom), or private DNS server addresses (such as a server running in your own network).
  • In addition, there is the MAC address, also known as the hardware address or physical address.
  • MAC Address: The MAC address is a unique identifier used by the network interface card at the data link layer (Layer 2 of the OSI model). Each network device should be assigned a unique MAC address for identification in the local area network. It is 6 bytes long and is usually represented in hexadecimal format. The first three bytes identify the manufacturer, for example, the MAC address of WIZnet devices starts with 00 08 DC. The last three bytes represent different devices of the same manufacturer. It should be noted that the first byte of the MAC address must be an even number, and the odd number is a multicast address.
  • Note: When there is an IP address conflict or MAC address conflict, the network will be unable to communicate.

3 The implementation process

Next, we implement the function of network initialization on the W55MH32.

Note: The test instances require that the PC and W55MH32 be on the same network segment.

Step 1: Define the network address information and set the DHCP mode to the static address mode

1. /* network information */
2. wiz_NetInfo default_net_info = {
3.     .mac  = {0x00, 0x08, 0xdc, 0x12, 0x22, 0x12},
4.     .ip   = {192, 168, 1, 30},
5.     .gw   = {192, 168, 1, 1},
6.     .sn   = {255, 255, 255, 0},
7.     .dns  = {8, 8, 8, 8},
8.     .dhcp = NETINFO_STATIC
9. };

Step 2: Initialize the hardware

1.     /* hardware initialization */
2.     rcc_clk_config();
3.     delay_init();
4.  
5.     console_usart_init(115200);
6.  
7.     tim3_init();

Step 3: Initialize the TOE engine and detect the PHY status

1.     /* wiztoe init */
2.     wiz_toe_init();
3.  
4.     wiz_phy_link_check();  

The wiz_phy_link_check function mainly detects the PHY connection status by reading the PHY registers. The function content is as follows:

 1. /**
 2.  * @brief Ethernet Link Detection
 3.  */
 4. void wiz_phy_link_check(void)
 5. {
 6.     uint8_t phy_link_status;
 7.     do
 8.     {
 9.         delay_ms(1000);
10.         ctlwizchip(CW_GET_PHYLINK, (void *)&phy_link_status);
11.         if (phy_link_status == PHY_LINK_ON)
12.         {
13.             printf("PHY link\r\n");
14.             wiz_print_phy_info();
15.         }
16.         else
17.         {
18.             printf("PHY no link\r\n");
19.         }
20.     } while (phy_link_status == PHY_LINK_OFF);
21. }

Step 4: Set network address information

1.     network_init(ethernet_buf, &default_net_info);

The function of network_init is to set the network address information defined in step 1 into the TOE engine.

If the DHCP mode is NETINFO_DHCP, then execute the DHCP process to update the network address information to the network address information obtained from DHCP. If it is the NETINFO_STATIC mode, then directly set the static network address information and print the set network address information.

The function is defined as follows:

 1. void network_init(uint8_t *ethernet_buff, wiz_NetInfo *conf_info)
 2. {
 3.     int ret;
 4.     wizchip_setnetinfo(conf_info); // Configuring Network Information
 5.     if (conf_info->dhcp == NETINFO_DHCP)
 6.     {
 7.         ret = wiz_dhcp_process(0, ethernet_buff);
 8.         if (ret == 0)
 9.         {
10.             conf_info->dhcp = NETINFO_STATIC;
11.             wizchip_setnetinfo(conf_info);
12.         }
13.     }
14.     print_network_information();
15. }

Step 5: Read back the IP address and print the PING prompt message

1.     wizchip_getnetinfo(&net_info);
2.  
3.     printf("please try ping %d.%d.%d.%d\r\n", net_info.ip[0], net_info.ip[1], net_info.ip[2], net_info.ip[3]);

4 Run results

After the burning routine is executed, the first thing you will notice is that the PHY link detection has been carried out. Then, the set network address information and the PING prompt information are printed.

By using the PC to ping the IP address (192.168.1.30) of W55MH32, it can be successfully pinged.

If you cannot ping, you can follow the steps below to troubleshoot.

1. Check if the set address can communicate with the PC address. It is generally recommended to set the address in the same network segment.

2. Confirm that the PC is correctly connected to the W55MH32 network cable. If it is connected to a switch or router, you can change it to a direct connection from the PC to W55MH32.

3. Read back the IP, subnet mask, default gateway, and the values of these registers to see if they are consistent with the settings.

4. Close the firewall on the PC.

5 Summary

This article introduces the performance of the W55MH32 chip, elaborates on the composition and function of network address information, and demonstrates the network initialization process of this chip through practical examples, including steps such as defining address information, initializing hardware and TOE, setting addresses, and reading IP. The burning routine can complete related detection and information printing, and the PC can PING the device. If it fails, there are troubleshooting methods.

The next article will provide a detailed explanation of the DHCP protocol, analyzing the core principles of the DHCP protocol and its application in obtaining IP information. At the same time, through practical example routines, it will explain the specific implementation steps and key points of achieving DHCP to obtain network information on the W55MH32 chip. Please stay tuned!

 

 

WIZnet is a non-fabrication semiconductor company founded in 1998. Its products include the Internet processor iMCU™, which adopts TOE (TCP/IP Offloading Engine) technology and is based on a unique patented fully hardwired TCP/IP. iMCU™ is designed for embedded Internet devices in various applications.

WIZnet has over 70 distributors worldwide, with offices in Hong Kong, South Korea, and the United States, providing technical support and product marketing.

The region managed by the Hong Kong office includes: Australia, India, Turkey, and Asia (excluding South Korea and Japan).

Documents
Comments Write