Home network control system based on E5122


With the rapid development and widespread popularity of information technology and computer network technology, more and more families obtain information and information through the Internet or Intranet. As a modern intelligent residential area, providing broadband multimedia comprehensive information and information services to the residents in the community is an important manifestation of intelligent housing and an objective requirement for the development of the information society. The Housing Industry Office of the Ministry of Construction put forward the concept of China ’s residential intelligence, that is, the residential community intelligence is the use of 4C (computer, communication, network, automatic control, IC card) technology to truly realize the intelligent control of remote homes. Through an effective transmission network, the Remote information service and management, property management and security, and residential intelligent system integration provide high-tech intelligent means for the service and management of residential communities, in order to achieve fast and efficient value-added service management and provide a safe and comfortable home environment.

1 System Introduction

The development of home intelligent control system is based on short message technology, automatic control technology, computer technology, digital communication technology and encryption technology. The system utilizes the relevant network, computer system and controller, and uses wireless network and wired network as the basic control instruction and data information transmission method to realize wireless remote control and data transmission of mobile phones. Through a dedicated SMS control center and service center, it provides a full range of digital services for family and community management. The home intelligent control system has the functions of mobile phone remote control, automatic alarm, calling community service, property management, etc., and can also be unlimitedly extended to the life networking service and intelligent office according to the needs of the user group.

The device is connected to the Internet / Intranet network, in principle, as long as the TCP / IP network protocol is implemented. TCP / IP protocol and its application is a complex system engineering. The establishment of the protocol has gone through a rigorous design process, and the implementation of the full set of protocols is relatively complicated. In embedded systems, there are certain difficulties in implementing this protocol. In actual applications, if the protocol is to be fully implemented, a more reasonable solution is to directly use the integrated TCP / IP protocol chip to separate the system central control unit and the TCP / IP protocol processing unit.

On the other hand, in the implementation of several other solutions, the original TCP / IP can be streamlined, and some protocols required by the actual application system can be retained, so that the core chip can not only realize network data transmission, but also complete monitoring tasks. The streamlining of the original TCP / IP protocol can greatly reduce the difficulty of system implementation and improve the efficiency and reliability of the system.

figure 1

2 System working principle

The functional block diagram of this system is shown in Figure 1.

The three-meter degree in the family is used as the acquisition signal, which is processed by the sample-and-hold circuit and sent to the single-chip microcomputer for processing. The single-chip microcomputer sends the data to the E5122 network protocol processor through the serial port for packaging, and packs the data into a TCP / IP protocol package. The data packet is sent to the Ethernet through the RTL8019AS Ethernet controller. Using CPLD chip EPM7128S as decoding and driving circuit. In this application, the data exchange rate requirements of home user terminals are not high, below 1MB / s. So you can use a general high-speed single-chip microcomputer, write TCP / IP protocol, so that not only can meet the requirements, but also allow users to accept the price.

3 Chip introduction

(1) Network interface controller RTL8019AS

RTL8019AS is Realtek's highly integrated dedicated Ethernet interface chip, supports EtherneTII, IEEE802.3, 10Base5, 10Base2, 10BaseT, supports UTP, AUI & BNC, PnP automatic detection mode, and embedded 16KB SRAM for sending and receiving buffer, reducing the The speed requirements of the main processor. Support 8-bit and 16-bit data bus mode; support jumper and no jumper mode; there is a full-duplex communication interface, you can send and receive data simultaneously on the twisted pair through the switch to increase the bandwidth from 10M to 20M Ideal chip for Ethernet communication.

RTL8019AS has 3 working methods:

â‘  Jumper mode, the I / O and interrupt of the network card are determined by the jumper;

â‘¡ Plug and play, the software automatically configures plug and play;

â‘¢ Jumper-free mode, the I / O and interrupt of the network card are determined by the content in the external 93C46.

Which way to use the network card is determined by the 65th pin JP of RTL8019AS. When the 65-pin JP is high (connected to VCC or pulled up through a 10kΩ resistor), the jumper method is used; when the RTL8019AS pin is floating, the input state is low (the same is true for other pins, the floating input pin level It is low level, there is a 100kΩ pull-down resistor). 64-pin AUI, this pin determines whether to use AUI or BNC interface. The interface of the network card we use is generally BNC, and AUI is rarely used. BNC interface mode supports 8-wire twisted pair or coaxial cable. Use the AUI interface when it is high, and use the BNC interface when it is low. The IOCS16B pin is pulled down to a low level with a resistor, and the 8-bit data bus mode is selected, and the BROM module is omitted, and only 8 data lines SD0 ~ SD7 are required. The base address selection pins IOS3, IOS2, IOS1, IOS0 are connected to low level. Because the pull-down resistors are connected inside the chip, the I / O base address is 300H at this time, so the address lines SA8 and SA9 are connected to a high level. Also, because the address offset of the register is 32 from 00H to 1FH, only the address lines SA0 to SA4 are used, and the remaining address lines can be grounded. The interrupt line of the chip is determined by IRQS2, IRQS1, IRQS0. The interrupt line is INT0 when all are connected empty, and 7 interrupt lines are connected by 8 interrupt lines. When the SMEMRB and SMEMWB pins determine the network interface type, 10BaseT, 10Base2, or 10Base5 are low when they are suspended. This is the automatic selection method. The AUI pin determines whether to use the AUI or BNC interface, and is low when left floating. Use BNC interface, support twisted pair or coaxial cable, the pins used are: TPIN +, TPIN-, TPOUT +, TPOUT-, access to the network card coupling isolation transformer, use RJ45 plug to achieve the connection with the network.

(2) TCP / IP protocol analysis chip E5122

E5122 is a Feihong series network protocol processor developed by Shanghai Exquisite Technology Company. External crystal oscillator 22.1184MHz, working voltage 5V. The TCP / IP protocol is implemented in hardware, and the API interface is provided, which greatly facilitates the use and integrates RAM from the outside. Communicate with the I2C protocol or RS-232 interface on the user side. The communication interface supports MPU with I2C interface and provides I2C driver for MPU without I2C interface. The interface between E5122 and the network is an Ethernet interface, which is connected to Ethernet through the Ethernet control chip RTL8019. The maximum serial rate is 115.2Kbps, which can achieve real-time transmission.

E5122 is a dedicated chip to complete the TCP / IP protocol, used to implement protocol conversion between Ethernet and serial ports. It can provide a complete network communication solution for serial devices, just connect an external MPU. The MPU model adopted by this system is: 89C52 single chip microcomputer. In the one-chip computer program, only need to call API function simply to realize. The structure of E5122 is shown in Figure 2. The device acts as a server, that is, when it connects to the network for the first time, the client actively requests to connect to the server as a passive monitor, and receives the connected LAN intranet to receive active query access from remote clients, and returns the device information to the client; Similarly, it can also be used as a client to actively communicate with a host in a local area network or the Internet. The E5122 chip uses 32KB RAM externally as an Ethernet data buffer, and uses 256 bytes (at least 256 bytes) of serial EEPROM (I2C bus interface) to store system parameters. The user communicates with the E5122 through the serial port. E5122 completes TCP / IP protocol and serial communication protocol. Support common serial port to interact with user equipment, and realize network connection through external RTL8019AS Ethernet control chip.

When the system runs for the first time, E5122 will initialize the RTL8019AS and set its working mode and interrupt source.

When the RTL8019AS receives data, it will trigger the E5122 interrupt. At this time, E5122 selects the register address and memory address of RTL8019AS through A8 ~ A13 and A15 to control and realize the reading of data. When data is sent to RTL8019AS through E5122, set the corresponding register of RTL8019AS through the address line to send data.

4 Hardware circuit design

In specific use, due to the limitations of the single chip microcomputer, a series of simplified designs have been carried out. Adopt jumper work mode, JP pin is connected to high level; E5122 and RTL8019AS interface are used to transmit network data.

When the system runs for the first time, E5122 will initialize the RTL8019AS, set the working mode of RTL8019AS and set the interrupt source. When the RTL8019AS receives data, it will trigger the E5122 interrupt. At this time, E5122 selects the register address and memory address of RTL8019AS through A8 ~ A13 and A15 to control and realize the reading of data.

When data is sent to RTL8019AS through E5122, set the corresponding register of RTL8019AS through the address line to send data.

The interface circuit diagram is shown in Figure 3.

5 Several technical problems in application

In the actual application of the system, we should pay attention to the following problems.

(1) Transmission speed

In the system, the speed of data exchange between the upper PC and the lower measurement and control equipment depends on the transmission speed of the Ethernet interface module. The transmission speed of the Ethernet module depends on the speed of the Ethernet interface chip, the processing speed of the single-chip computer, and the way of exchanging data with the device.

In general measurement and control systems, only control commands and measurement data are transmitted, and the amount of data is not large. RS-232, RS-485, CAN and other serial connections are used between the module and the measurement and control equipment, and the communication rate is only a few tens of kb / s or hundreds of kb / s. At this time, the speed of the Ethernet interface chip (10Mb / s) and the speed of the microprocessor are much greater than the serial communication speed. Therefore, the transmission rate mainly depends on the communication rate of the serial port.

When the data rate to be transmitted is very high (such as an image), the serial port connection can no longer be used between it and the measurement and control equipment, but a parallel port connection must be used. At this time, the transmission rate depends on the processing speed of the microprocessor. At this time, we must choose some high-speed microcontrollers, such as P89C52RX series or SX series and other single-chip.

(2) IP address

In the Ethernet measurement and control system, if the measurement and control equipment enters the Ethernet through this module, you must determine your own IP address. There are two ways to obtain an IP address: there are dynamic IP address acquisition and fixed IP address allocation. Since the E5122 does not support the RARP reverse address resolution protocol, it cannot obtain a dynamic IP address and can only use a fixed IP address.

(3) Security control

Measurement and control in a small closed local area network has little security problems, but measurement and control on a wide area network or even the Internet, security control is crucial. To this end, the 48 ~ 128-bit user password is used to protect the safety of the measurement and control equipment. Legal users can modify and set their own passwords. Even if an illegal user on the network steals an IP address and does not have a user password, he cannot operate the device.

(4) Real-time problems

The measurement and control system must emphasize its real-time performance on many occasions, but Ethernet is not a real-time system. Due to its carrier sense collision detection (CSMA / CD) communication method, it is determined that the transmission of IP packets in Ethernet will be delayed or even lost. This is the biggest disadvantage of using Ethernet to form a distributed measurement and control system. However, now the speed of Ethernet is getting faster and faster, 100M network or even Gigabit network, or in some small closed LANs, the busyness of the network is greatly reduced, there is almost no collision of IP packets, transmission delay, packet loss Greatly reduced, will not affect the normal work of the measurement and control system. At the same time, above the network layer of the system, a response protocol can be added, and the problem of packet loss can be basically overcome.

(5) Connection method

The module has two sockets: one is an RJ-45 socket, which can be directly connected to Ethernet with twisted pair; the other is a 25-pin socket, which contains RS-232 or RS-485 bus interface.


With the advent of the 21st century, mankind has gradually entered the information age. With the advancement of technology and the continuous improvement of the quality of life requirements, people's choice and use of home appliances have shifted from only caring about the single function of home appliances to pursuing the convenience and quality of home appliances. The development of information technology and networking technology has provided the possibility of centralized control and remote control of home appliances in the home environment. The integration of information technology and home appliance control technology to achieve a greater degree of information and automation of family life, to meet people ’s comfortable and high-paced life needs, so that all consumer electronics products have the ability to connect to the network. The next development trend of consumer electronics products. The networking of home appliances will bring new demands to the already saturated home appliance consumer market. Further research in this area has caused tremendous changes in people's lifestyles, working methods, and ways of thinking; at the same time, it has stimulated the growing demand for various data sources and network services, injecting new vitality into the information society And vitality, have important theoretical, practical and commercial value.

Portable Speakers

Portable Speakers,Architectural Speakers,Wireless Outdoor Speakers,Embedding Monitoring Loudspeaker

The ASI Audio Technology Co., Ltd , https://www.asi-sound.com