VHDL Design of Interface between Single Chip Microcomputer and Ethernet Controller RTL8029

Publisher:电竞狂人Latest update time:2012-02-29 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Ethernet controller

The Ethernet controller of Taiwan Realtek is a controller that complies with the IEEE802.3 Ethernet standard. There are RTL8019, RTL8029 and RTL8139 series. Among them, RTL8019 is ISA bus, which is easier to interface with 8-bit MCU. RTL8029 and RTL8139 are PCI bus, which cannot directly interface with 8-bit MCU, and need a PCI interface for conversion. Considering that RTL8029 is easier to buy in the market, the RTL8029 Ethernet controller is used as the network interface.

RTL8029 already contains the entire network interface layer protocol (PHY layer and MAC layer protocol), so it is relatively simple to use. Users do not need to consider link control issues, but only need to consider how the microcontroller reads TCP/IP protocol data from RTL8029.

PCI bus signals have 3.3V standard and 5V standard, and there are many signal lines, but not all PCI devices use all PCI interface signals. In fact, only the ones they need are used. The RTL8029AS Ethernet controller follows the 5V standard and only uses the following parts of the PCI bus signals:

AD[31:0]——Data signal multiplexing bus.
FRAME——Frame cycle signal, driven by the current master device, indicating the start and duration of an access.
IRDY——Master device ready signal.
TRDY——Slave device ready signal.
C/BE——Bus command and byte enable multiplexing signal. The address period is the bus command, and the data period is the byte enable.
IDSEL——Initialization device selection signal. Used as chip select during parameter configuration read and write transmission. For the case where there is only one PCI device, it can always be connected to a high level.
RST——Reset signal.
CLK——System clock signal, frequency range DC~33MHz. The above signals are all valid on the rising edge of CLK.
INTA——Interrupt request signal, which can be used to send an interrupt to the main controller after the RTL8029 data is ready.
DEVSEL——Device selection signal, indicating that the device driving it has become the currently accessed device. Since in the single-chip microcomputer system, RTL8029 is a single PCI device, this signal can be ignored.

2 PCI interface design

Among the interface signals of the Ethernet controller, except for the address data bus which is bidirectional, the TRDY signal is generated by the Ethernet controller and its direction is from the Ethernet controller to the PCI interface; the remaining signals are generated by the interface part and their direction is from the PCI interface to the Ethernet controller.

The idea of ​​interface design is: the PCI interface can be regarded as the external memory of the microcontroller. The microcontroller reads and writes the PCI interface with the timing of reading and writing the external memory, and then the PCI interface converts the read and write operation timing into PCI timing to operate the Ethernet controller.

The signals used by the microcontroller when performing external memory operations include PO port, P2 port, ALE, RD and WR signals. Among them, P0 port is address (low 8 bits)/data multiplexing, P2 port is high 8-bit address signal; ALE is address latch signal, when high level, the value of P0 port is latched to the low 8-bit data line; RD and WR are read and write valid signals, low level is valid. Therefore, the PCI interface actually plays a role in converting the read and write timing of 8-bit microcontroller to 32-bit PCI read and write timing. The principle block diagram is shown in Figure 1, and the access timing is shown in Figure 2.
[page]
In Figure 2, configuration access and I/O read and write access to the PCI device can be completed. As long as these two accesses are available, the microcontroller can fully implement the operation of the RTL8029. The IDSEL signal only works in configuration access and is not used in I/O access.

The first clock edge after FRAME is valid is the beginning of the address period. At this time, the address is transmitted on the AD bus and the command is transmitted on the C/BE bus. After IRDY is valid, it is the data period. At this time, data is transmitted on the AD bus and byte enable is transmitted on the C/BE bus. However, data transmission is carried out on the clock edge when IRDY and TRDY are both valid. Byte enable indicates which data byte is valid in the data on the 32-bit data line at this time.

The process of reading configuration: first send the address, send the command (the command value is 1010B) and byte enable, and then read the content in the configuration space. The process of writing configuration: first
send the address, send the command (the command value is 1011B) and byte enable, and then send the configuration data.
The process of reading I/O: first send the address, send the command (the command value is 0010B) and byte enable, and then read the content in the I/O space.
The process of writing I/O: first send the address, send the command (the command value is 0011B) and byte enable, and then send the data.
In I/O access, the two bits AD[1:O] have special requirements and need to be coordinated with C/BE[3:0].
When C/BEO is valid, AD[1:0] must be 00, and when C/BE3 is valid, AD[1:0] must be 11. In a specific access, every time a device address is decoded and selected, it is necessary to check whether the byte enable signal is consistent with AD[1:0]. If the two are inconsistent, the entire access will not be completed. Therefore, when writing microcontroller software, it is necessary to refer to the content of this part in the PCI bus protocol in order to correctly operate the Ethernet controller.

Within one clock cycle after the address of the bus command/byte enable (C/BE) register is valid, the FRAME signal should be valid, indicating the start of the address period. The C/BE[3:0] bus is the bus command. The address period can last only one cycle and then immediately enter the data period. In the single-chip microcomputer system, it is not necessary to consider supporting complex PCI data bursts. After entering the data period, the FRAME signal should be immediately pulled back to a high level. At this time, the C/BE[3:0] bus is byte enable. Therefore, the FRAME signal can be generated using the address signal of the bus command/byte enable register.

The IRDY signal is valid only during the data period, so IRDY can also be generated by the address signal of the bus command/byte enable register or by the FRAME signal.

The IDSEL signal is only related to configuration access, so it can be generated by the command word of the bus command. During I/O access, the highest bit 3 of the command word is 0; during configuration access, the highest bit 3 of the command word is 1. Therefore, this bit can be used to generate the IDSEL signal. [page]

In addition, as mentioned above, the PCI interface can be accessed as an external memory, so the 8-bit data must be converted into 32-bit data. The following registers need to be designed in the PCI interface:

Register 0, corresponding to AD[7:0] of the 32-bit data/address bus, is used for writing;
register 1, corresponding to AD[15:8] of the 32-bit data/address bus, is used for writing;
register 2, corresponding to AD[23:16] of the 32-bit data/address bus, is used for writing;
register 3, corresponding to AD[31:24] of the 32-bit data/address bus, is used for writing;
register 4, corresponding to AD[7:0] of the 32-bit data/address bus, is used for reading;
register 5, corresponding to AD[15:8] of the 32-bit data/address bus, is used for reading;
register 6, corresponding to AD[23:16] of the 32-bit data/address bus, is used for reading;
register 7, corresponding to AD[31:24] of the 32-bit data/address bus, is used for reading;
bus command/byte enable register, corresponding to C/BE[3:0];
reset register, used for hardware reset operation of RTL8029AS.

Based on the above analysis, the PCI interface principle block diagram is obtained, as shown in Figure 3.
3 VHDL Implementation of Interface
The VHDL code of the PCI interface can be found on our website: www.dpj.com.cn.
The above code is compiled and synthesized under Qaartus II, occupying 149 macrocell resources, and can be completed using the CPLD device MAx7l60.

4 Conclusion
The design method described in this paper has been successfully applied to the remote control of the radio monitoring system. Through the 5l single-chip microcomputer system connected to Ethernet, unmanned monitoring of remote equipment in the computer room can be realized on the network.
Keywords:MCU Reference address:VHDL Design of Interface between Single Chip Microcomputer and Ethernet Controller RTL8029

Previous article:Design of Ultrasonic Distance Meter Using AT89C2051
Next article:Serial interface between C8051F00x and HCMS2964 intelligent dot matrix display

Recommended ReadingLatest update time:2024-11-16 15:41

High-performance microcontroller soft-core design based on 51 framework
1 Introduction In today's fast embedded system design, the more popular solution is to integrate application software or soft IP platform in FPGA to simplify the process and accelerate the product launch schedule. To this end, many companies have launched their own development platforms and related CPU IP cores. There
[Microcontroller]
High-performance microcontroller soft-core design based on 51 framework
51 MCU Self-study Notes (II) - Basic Knowledge of C Language
Base conversion (binary, decimal, hexadecimal) Binary: Binary is a number system commonly used in computers/single-chip microcomputers. Binary uses two digits, 0 and 1, to represent numbers. The rule of carry is to add one whenever there are two, and to borrow one as two. Decimal system: The decimal system is common
[Microcontroller]
51 MCU Self-study Notes (II) - Basic Knowledge of C Language
Implementation of USB firmware design for single chip microcomputer
  The USB firmware is divided into a general enumeration configuration part and a class protocol part. Taking the use of the CH375 host-side protocol to communicate with a large-capacity storage device (such as a USB flash drive, etc.) as an example, the important functions in firmware programming and their implementa
[Microcontroller]
Introduction to the intelligent development platform solution based on single chip microcomputer
1. The significance of MCU application development platform The single-chip microcomputer is a branch of the original large-scale computer, mainly used in: industrial automation control, intelligent instruments, meters, navigation, aerospace, smart home appliances and other fields. As a mainstream control
[Microcontroller]
Introduction to the intelligent development platform solution based on single chip microcomputer
AVR MCU three-way PWM program + simulation circuit
  #include mega8.h #include delay.h #define key1 PINC.0 #define key2 PINC.1 #define key3 PINC.2 #define key4 PINC.3 #define key5 PINC.4 #define key6 PINC.5 void main(void) { unsigned char a=0; unsigned char b=0; unsigned char c=0; PORTB=0x00; DDRB=0xFF; PORTC=0xff; DDRC=0x00; PORTD=0x00; DDRD=0x00; TCC
[Microcontroller]
AVR MCU three-way PWM program + simulation circuit
14 classic questions about MCS-51 microcontroller
1. What are the main functional components inside the MCS-51 microcontroller? What are their functions? 2. What are the functions of the EA, ALE and PSEN terminals of the MCS-51 microcontroller? Answer: ALE - ALE is the address latch enable signal. When accessing external memory, ALE is used to latch the low 8-bit
[Microcontroller]
14 classic questions about MCS-51 microcontroller
MCU serial communication program
Use serial interrupt to receive data and display it ;===========Predefined=====================  LED0 EQU 40H ;Predefined digital tube  LED1 EQU 41H ;Predefined digital tube  LED2 EQU 42H ;Predefined digital tube  LED3 EQU 43H ;Predefined digital tube LED4 EQU 44H ;Predefine digital tube  LED5 EQU 45H ;Predefine digit
[Microcontroller]
Design of hardware circuit of thyristor trigger using single chip microcomputer
1 Introduction Thyristor, also known as silicon controlled rectifier, is the most widely used high-power conversion device in industrial applications. Thyristor mainly adopts phase-shift trigger control in rectifier occasions such as sintering furnaces and arc furnaces, that is, the output is controlled by adju
[Microcontroller]
Design of hardware circuit of thyristor trigger using single chip microcomputer
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号