Design and Implementation of Network Appliance Interface Based on AVR

Publisher:asa1670Latest update time:2015-04-15 Source: eechinaKeywords:AVR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction

Home network refers to a home information platform that integrates control network and multimedia information network. It is a system that realizes the interconnection and management of various electronic devices within the home. A typical home network structure is shown in Figure 1. It is generally composed of a home gateway (home gateway or resident gateway) and several network appliances (network apphanees). The networking method can be wired or wireless, and can adopt TCP/IP, Ethernet solution, xlO power line solution, Zigbee, Ultra Wide Band (Ultra Wide Band, referred to as uwB) communication, Near Field Communication (Near Field Communication, NFC), Bluetooth and other methods.

1.jpg 
Figure 1 Home network structure diagram

The home gateway is the management and control core of the network. It is responsible for interconnecting the isolated and scattered subnet systems or network appliance terminal devices in the home to realize information interaction and sharing. At the same time, it serves as the hub for connecting the home intranet and the extranet to meet the information interaction between the intranet and the extranet. Network appliances, also known as network home appliances and information home appliances, are divided into fat network appliances (fat IPA) and thin network appliances (Thin IPA) according to their functions in the IETF draft. Fat network appliances with more complex functions are defined as: IPA =
[network interface][application control][I/O control]. That is, devices with network interfaces and I/O ports for controlling local systems, and embedded applications. Home appliances such as refrigerators and air conditioners need to realize complex control functions, generally requiring network interfaces and I/O port control functions, and at the same time needing to develop m control applications, which become fat network appliances; home appliances such as lights and doors realize simple control functions. As long as they have network interfaces and I/O port control functions, they are thin network appliances.

It can be seen that network appliances actually refer to consumer devices that contain a network processor and have specific functions. Adding a network interface to traditional household appliances makes them information appliances with functions such as remote control, information access, acquisition, storage, and networking. In this way, we can not only control the appliances locally, but also remotely control them through the Internet. The appliances can also report their status information to the home gateway. It can be simply considered that ordinary home electronic devices can become network appliances by adding a network interface. Therefore, the network interface of network appliances is a key component of the networking of home electronic devices.

This paper proposes a network interface scheme for network appliances. In this scheme, the networking method is based on Ethernet TCP/IP, and the hardware uses ATMEL's AVR microcontroller and RTL8019 Ethernet chip. This scheme is low-cost, easy to network, and easy to implement.

2 Hardware Design of Network Appliance Interface

2.1 System Structure

The hardware structure of the network appliance interface is shown in Figure 2. It can be seen that the network appliance communicates with the AVR microcontroller through port 10. The microcontroller has an embedded TCP/IP protocol stack. The session layer and transport layer are implemented in the microcontroller. RTL8019AS implements the data link layer and physical functions.

2.gif 
Figure 2 Network appliance interface hardware structure diagram

When the home gateway controls the network appliance, the data enters the buffer of RTL8019AS through the RJ45 interface with an isolation transformer. After being processed by RTL8019AS, it is read into the RAM of the microcontroller for temporary storage. The temporarily stored data is transmitted to the network appliance through the IO port or RS-232 serial port. When sending data to the home gateway, the network appliance sends data packets to the data buffer of the microcontroller through the IO port or RS-232 serial port, packages the data, and then writes the framed data to the internal SRAM of RTL8019AS through remote DMA operation, and then sends it to the home gateway through the RJ45 interface. In this way, two-way communication between the home gateway and home appliances is realized, and home appliances are connected to the Internet.

2.2 Hardware circuit design

The hardware connection diagram is as follows: 

3.gif 
Figure 3 MCU and RTL8019AS hardware connection diagram

The control chip used here is AVR microcontroller. The microcontroller ATMEGA32L used in this project is a high-performance, low-power AVR8-bit microcontroller. This chip has 32K FLASH, which is enough to burn the TCP/IP protocol stack.

RTL8019AS is a 10M Ethernet chip from REALTEAK, with 16KB SRAM embedded inside. It is used to implement the physical layer protocol of the network, mainly to realize the physical connection between the network card and the network cable. Media access control (MAC), data frame opening and disassembly, data frame sending and receiving, error checking, data signal encoding, decoding and data serial/parallel conversion. [page]

RTL8019AS has 16K SRAM inside the chip, address 0X40000-0X7FFF, this 16K RAM is initialized into 2 parts: ① Ethernet data buffer for receiving ② Ethernet data buffer for sending, the specific 2 buffer sizes can be set programmably.

The circuit connection is shown in Figure 3, and the RTL8019AS power supply uses DC 5V. Its SDOSD7 data bus is connected to the microcontroller through a 74HC573 latch, and the microcontroller uses LE to enable the control latch. RTL$019AS uses an 8-bit bus, and the SA address bus only uses SA0-SA4 to connect to the microcontroller, and the other SA5-SA19 are grounded. Here the base address is 0. INTO is one of the 8 interrupts of RTL8019AS, which is connected to the external interrupt of the microcontroller and is used when receiving data. RSTDRV is the reset line, which is valid at a high level and requires a reset time longer than 800ms. IOR/10W is the read-write control line. AEN is the address enable, which is valid at a low level.

The chip is connected to the network cable interface RJ45 through TPIN+, TPIN-, TPOUT+, and TPOUT-. TPIN+/TPIN- is the twisted pair receiving pin, and TPOUT+ and TPOUT- are the twisted pair sending pins. However, it cannot be directly connected and must be isolated through a network isolation transformer. This design uses 20F-Ol. It has two main functions. One is to transmit data. The differential signal sent by PHY is coupled and filtered with a differential mode coupling coil to enhance the signal, and coupled to the other end of the network cable with different levels through the conversion of electromagnetic fields. The second is to isolate the different levels between different network devices connected by the network cable to prevent different voltages from damaging the equipment through the transmission of the network cable.

3 The RTL8019 driver

RLS019AS contains a large number of on-chip register units. During the working process, it is necessary to realize the reception and transmission of data packets, and the relevant registers must be set correctly. The driver for RTLSOl9AS mainly includes three parts: RTL80l 9AS initialization part, data packet reception part, and data packet transmission part.

3.1 Initialization

Initialization is mainly the initialization of registers, mainly including initializing the reset register, initializing the configuration registers of RTLS019AS: CONFIG0-CONFIG3, initializing the receiving and sending buffers, initializing the interrupt of RTL9019AS, initializing the receiving configuration, sending configuration, etc., setting the Ethernet physical address, etc.

3.2 Data Reception

Data can be received in a query mode, where the chip continuously queries the network for information to reach this node; or in an interrupt mode, where the interrupt mode is selected. The INTO of RTL8019AS is connected to the INT0 of ATMEGA32. When an interrupt occurs. AVR enters the interrupt service, first reads the ISR to determine the interrupt type to see if it is received correctly. According to the address of the network card receiving buffer defined in the previous project, the CURR pointer is used to read the received data into the memory. When the CURR pointer is the same as the BURY pointer address, it means that the data reception is over. Therefore, it is necessary to determine whether the reception is over first, and then call the packet retrieval function WY_GETPACK().

The packet retrieval function mainly includes stopping the work of 8019, resetting the interrupt, determining whether the boundary register is out of bounds, starting the DMA operation, reading the DMA, calculating the length of the data packet, moving the receiving address, and then reading. The receiving flow chart is shown in Figure 4.

4.gif 
Figure 4 Data receiving flow chart

3.3 Data transmission

The transmission process is divided into 3 steps: encapsulate data packets; send data to the transmission buffer; send data. The transmission buffer space is 3k, which can save 2 complete data frames. The buffer can be divided into two parts, one for sending and the other for encapsulating data packets to improve efficiency. If the data to be sent is less than 60 bytes, fill the data to 60 bytes before sending. If the data is greater than 1514 bytes, the data must be divided into less than 1514 bytes before sending. Therefore, the number of data bytes in a data packet must be controlled between 60 and 1514 bytes. This is stipulated by the Ethernet 8023 protocol. If the transmission fails, resend. The transmission process is shown in Figure 5 below.

5.gif 
Figure 5 Data transmission flow chart

4 Conclusion

Network appliances are network appliances and information appliances, which are the main development direction of future home appliances. In the future home. Multiple network appliances work in coordination and form an interactive network environment to facilitate user use. This network environment is called a digital home network, or home network for short. Home network is an inevitable trend in the development and innovation of information technology. The

innovation of this article is that it designs a network appliance interface solution based on AVR, which is simple and easy to use, low cost, meets the requirements of information appliances, and can be applied to remote industrial control, remote meter reading and other fields. The development board currently developed uses a single-chip microcomputer to communicate with a PC directly through the RTLSOl9AS chip using a network cable, and works normally.
Keywords:AVR Reference address:Design and Implementation of Network Appliance Interface Based on AVR

Previous article:Laptop Battery Tester Based on AVR
Next article:Using AVR microcontroller to configure FPGA

Recommended ReadingLatest update time:2024-11-16 17:57

AVR Notes 6: Excellent C programming style
       How can a beginner have a good programming style? I would like to quote a story about a beginner asking a programming master for advice and let the readers understand it for themselves.        There was a programming master who wrote unstructured programs. A beginner deliberately imitated him and also wrote uns
[Microcontroller]
Solution for AVR mkii not being able to be used in AVRDUDESS after being upgraded by atmel studio
Reason: Driver version Download zading from this URL: https://zadig.akeo.ie/ option - list all devices Select mkii Change the driver to libusb-win32 (1.2.6.0), click Replace Driver, and you can use AVRDUDESS after the driver installation is complete.
[Microcontroller]
Lcd.h header file download - AVR microcontroller driver header file for character LCD
/*****************************************************************************       Unit: Physics Class 2007, School of Physics and Electronic Engineering, Guangxi University for Nationalities       File name: Lcd.h       File ID: _LCD_H_       Abstract: AVR microcontroller driver header file for character LCD    
[Microcontroller]
Design of real-time measurement and monitoring system using AVR microcontroller and GTJ4-10A solid-state relay
With the development of computer technology, especially single-chip microcomputer technology, temperature has a great impact on people's lives and work, so it is necessary to collect temperature in real time and analyze it. To this end, real-time and accurate measurement and monitoring are achieved. The serial port is
[Microcontroller]
Design of real-time measurement and monitoring system using AVR microcontroller and GTJ4-10A solid-state relay
The Communication Design between AVR Microcontroller and CPLD
In the project, CPLD is needed to complete part of the algorithm design. The parameters are given by AVR, so the communication between AVR and CPLD needs to be completed. Therefore, a test program is written. CPLD is hung on the data and address bus of AVR. AVR uses ATmega128. Several registers are set in CPLD. Commun
[Microcontroller]
The Communication Design between AVR Microcontroller and CPLD
Analysis of the main characteristics and application fields of AVR microcontrollers
AVR microcontroller is an enhanced RISC low-instruction set high-speed 8-bit microcontroller with built-in Flash developed by ATMEL. It draws on the advantages of 8051 and PIC microcontrollers, has the ability to execute one instruction in a single clock cycle, and has an operating speed of up to 1Mips/MHz. AVR microc
[Microcontroller]
Analysis of the main characteristics and application fields of AVR microcontrollers
AVR microcontroller T0 use
This article introduces the use of T0 of ATmega 16 microcontroller T0 in M16 is an 8-bit timer/counter The following content is extracted from ATmega 16 Datasheet Note that OC0 must be set to output before use, and the pull-up resistor Use CTC method to generate 38K square wave. void timer0_init(void) //CTC
[Microcontroller]
AVR microcontroller T0 use
AVR timer/counter application design
Timer/counter is the most basic peripheral interface in the microcontroller chip. It has a wide range of uses and is often used to measure time, speed, frequency, pulse width, provide timing pulse signals, etc. Compared with general 8-bit microcontrollers, AVR is not only equipped with more timer/counter interfaces, bu
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号