Design of Embedded Devices and Ethernet Interconnect Systems
2026-04-06 05:51:54··#1
Abstract: Addressing the current need for widespread internet access for embedded devices in industrial control, intelligent instruments, and smart home appliances, this paper proposes a solution based on the IP2022 single-chip, enabling the connection between embedded devices with RS-485 serial ports and Ethernet. The paper mainly introduces the overall hardware structure, system interface circuits, and software design based on the IP2022 chip. It features small size, low power consumption, and short development cycle, making it highly practical. Keywords: Embedded devices; IP2022; RS-485; Ethernet access 1 Introduction With the increasing popularity of Internet technology, the degree of information sharing is constantly improving. Network experts predict that approximately 70% of the information transmitted on the Internet in the future will originate from small embedded devices, and Internet applications are shifting towards embedded device-centric approaches. Since many embedded devices used in industrial measurement and control systems, intelligent instruments, and smart home appliances still rely on the user-friendly and reliable serial port for external communication, connecting these widely used industrial embedded devices with serial ports to the network has become an important and urgent issue. This paper designs and implements an embedded device interconnection system with RS-485 serial port and Ethernet, based on the IP2022 network processor, under the background of this application status. The system implements the functions of Universal Asynchronous Receiver and Transceiver (UART), Ethernet driver peripheral and TCP/IP network protocol stack, providing a hardware and software platform for embedded devices to access Ethernet. 2 Hardware Design of the System 2.1 Introduction to IP2022 [1][2] IP2022 is a powerful network communication processor launched by Ubicom in the United States. Driven by a 4.8MHz crystal oscillator, the CPU can operate at a frequency of 120MHz using its internal phase-locked loop (PLL) circuit, and most instructions are executed in a single cycle. Its throughput can meet the requirements of various new network connectivity applications. The internal structure of IP2022 is shown in Figure 1. [align=center]Figure 1 Internal Structure Diagram of IP2022[/align] The IP2022 contains a full-duplex serializer/deserializer (Ser/Des), which can directly connect to various common network interfaces and implement on-chip 10Base-T Ethernet (MAC and PHY), UART, and various other fast serial protocols. The IP2022 implements peripheral communication and control functions in the form of software modules (ip Modules), offering greater system design flexibility than traditional hardware. The IP2022 also provides a TCP/IP network protocol stack and a series of additional software necessary for a complete end-to-end connectivity solution. Because it contains two Ser/Des components, the IP2022 can easily convert between different formats, thus also functioning as a protocol converter. 2.2 Overall System Hardware Structure The system hardware mainly consists of the IP2022 network processor, RS-485 interface circuit, Ethernet interface circuit, and power supply circuit. The IP2022 network processor is the core of the entire system, mainly responsible for data conversion and system control. The Ethernet interface circuit enables connection to 10Base-T Ethernet. The RS-485 interface circuit enables connection to embedded devices with RS-485 interfaces. The power supply circuit provides the +5V, +3.3V, and +2.5V power required by the system. The hardware structure of the system is shown in Figure 2. [align=center] Figure 2 System hardware structure diagram[/align] 2.3 RS-485 interface circuit of the system [3][4] Due to its good anti-noise interference, long transmission distance and multi-station transmission capability, the RS-485 standard has become the preferred standard for data transmission in distributed systems. However, if it is used improperly in actual use, data transmission will result in bit errors. In order to suppress bit errors, in this design, we used two SN75LBC184 chips with transient voltage suppression function to separate the input and output lines so that the input and output signals do not interfere with each other. The SN75LBC184 has a built-in high-energy transient noise protection device, which improves the reliability of resisting transient noise on the data synchronization transmission cable. This chip transmits information differentially, has strong common-mode interference immunity, and allows one transmitter to drive multiple load devices over a single twisted pair, with a maximum permissible communication distance of 1200 meters. Figure 3 shows the schematic diagram of the RS-485 interface circuit of the system. Through repeated experiments, a 3.3K bias resistor and a 1K series resistor were added to the input terminal to optimize the input signal waveform; an 18K bias resistor was added to the output terminal. [align=center]Figure 3 Schematic diagram of RS-485 interface circuit[/align] The SN75LBC184 operates at +5V, while the IP2022's I/O terminal operates at +3.3V. Therefore, when receiving external signals, the IP2022's I/O ports may be damaged due to excessive voltage. Thus, a voltage conversion chip 74LVX4245 was added between the SN75LBC184 and IP2022 during the design process. The chip uses +5V on one end and +3.3V on the other end. The signal flow is controlled by the enable terminal, which effectively maintains the working stability and security of IP2022. 2.4 Ethernet interface circuit of the system [5] The IP2022 chip contains a full-duplex serializer/deserializer (SER/DES) and can realize on-chip 10Base-T Ethernet (MAC and PHY). When designing the external interface circuit, there is no need to use a dedicated Ethernet interface chip. Just connect the input and output signal lines of IP2022 directly to the network transformer. Figure 4 shows the schematic diagram of the Ethernet interface circuit of the system. [align=center] Figure 4 Schematic diagram of Ethernet interface circuit[/align] IP2022 uses 6 I/O pins, which are connected to serializer/deserializer 1. The four pins used for transmission are each connected to a resistor, and the four resistors together provide an impedance of 100Ω. TX+/TX- are differential transmit pairs, and RX+/RX- are differential receive pairs, using differential balanced transmission with a transmission speed of up to 10Mbps. The FB2022 is a network transformer with an internal low-pass filter, responsible for amplifying the differential voltage output from the IP2022 before transmitting it to the RJ45, and compressing the input differential voltage before transmitting it to the IP2022, protecting the IP2022 chip from damage. A 100Ω coupling resistor is connected between RX+ and RX- to improve the stability of the communication line. The RJ45 is a standard twisted-pair Ethernet interface socket. 3. System Software Design The IP2022 provides comprehensive software development tools, mainly including the Ubicom integrated IDE and the Ubicom configuration tool. The Ubicom integrated IDE provides an intuitive user interface, including an editor, project manager, and tools for device programming and debugging, facilitating project management and final implementation for software engineering. The Ubicom configuration tool allows for easy addition of software packages, setting the IP2022 hardware resources used by the packages, determining the relationships between packages, and automatically linking to the target code. The system primarily handles data conversion and transmission between RS-485 serial ports and Ethernet. After providing both RS-485 and Ethernet RJ45 interfaces on the hardware side, the software side requires loading four modules—ipOS, ipStack, ipEthernet, and ipUART—using the IP2022 configuration tool. The ipOS operating system module is a configurable embedded real-time operating system designed by Ubicom, optimized for network applications. The ipStack protocol stack module is an industry-standard TCP/IP network connection protocol stack that provides direct Internet addressing, allowing designers to design embedded network devices without external physical interface chips or PC gateways. The ipUART serial port module provides asynchronous serial communication functionality. After loading the ipUART software module, the chip acquires asynchronous transmit/receive (UART) capabilities, supporting serial communication. The ipEthernet Ethernet module fully implements the 10Base-T Ethernet physical layer interface (including MAC and PHY functions), enabling embedded devices to access Ethernet using only an IP2022 and a small amount of external circuitry. Figure 5 shows the flowchart of the system's main program. [align=center]Figure 5 System Main Program Flowchart[/align] Because the operating system of our configured IP2022 chip runs in single-task mode, each physical interface and some operating system functions need to be polled. Therefore, the polling must return as soon as possible to prevent hindering the execution of other system programs. The IP2022 runs very fast, reaching 120 MIPS in RAM and 30 MIPS in Flash, so the polling speed can meet the actual requirements. Initialization mainly initializes the operating system and the protocol stack. In the operating system, it mainly initializes the main registers, system debugging support code, and system timers; in the protocol stack, it mainly initializes the IP2022's netbuf/netpage storage mechanism and TCP protocol. Using the IP2022 configuration tool, the ipEthernet software module is added, the IP2022 hardware port resources used by the Ethernet interface are set, and the function ip2k_eth_instance_alloc() in the ipEthernet software package is called to create a virtual peripheral Ethernet driver. The `eth_ip_arp_instance_alloc()` function in the `ipStack` software package is used to create an Ethernet link layer to IP layer instance, and the `dhcp_client_instance_alloc()` function is used to create a DHCP instance. The `ipUART` software module is added using the IP2022 configuration tool, setting the IP2022 hardware resources used, serial port baud rate, and other parameters. The `uart_vp_instance_alloc()` function in the `ipUART` software package is used to create a virtual peripheral UART, and the `uart_listen()` function is used to listen on the serial port. As shown in Figure 5, after entering the main loop, the Ethernet port is polled first, and then the serial port is polled, ensuring that commands from the Ethernet port are processed first and in a timely manner. If data is sent or received on the port, the data undergoes protocol conversion and transmission, as shown in Figure 6. [align=center] Figure 6 Data Protocol Conversion Flowchart[/align] 4 Conclusion This interconnection system realizes the connection between embedded devices with RS-485 serial ports and Ethernet, and can then access the Internet through Ethernet, thereby realizing the monitoring of embedded devices from the Internet. It can be widely used in industrial control, intelligent instruments, information appliances and other fields, and has high practical value. References: [1] Ubicom Corporation. IP2022 DataSheet. 2002. [2] Li Danmei. Principle and application of network processor IP2022 [J]. Foreign Electronic Components, 2002, 5: 31-34. [3] SN75LBC184 differential transceiver with transient voltage suppression function [Z]. www.icbase.com. [4] 74LVX4245 DataSheet [Z]. www.fairchildsemi.com. [5] FB2022 DataSheet [Z]. www.bothhand.com. [6] Ubicom Corporation. IP2022 Programmer's Reference Manual, 2002. [7] Chen Jing. A new type of network processor—IP2022[J]. Modern Electronics Technology, 2003, 2: 29-33. [8] Wu Zhengang, Chen Hu. PLC human-machine interface and programming[J]. Microcomputer Information, 2005, 8-1: 21-23.