Design and implementation of network interface based on ARM-LPC2368

Publisher:breakthrough3Latest update time:2011-07-04 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction

With the rapid development of Internet technology, people's requirements for information sharing are also increasing. At present, embedded systems have penetrated into every corner of our lives. Its perfect combination with the network provides great convenience for us to share information. PHILIPS's LPC2368 is an excellent microprocessor. If the embedded system based on it does not have an Ethernet interface, its application value will be greatly reduced. Therefore, for the entire system, the Ethernet interface circuit should be indispensable, but it is also relatively complex.

The Ethernet interface circuit is mainly composed of two parts: the MAC controller and the physical layer interface (PHY). LPC2368 has an embedded Ethernet controller that supports the Reduced Media Independent Interface (RMII) and the Buffered DMA Interface (BDI), and can provide 10M/100Mbps Ethernet access in half-duplex and full-duplex modes. Therefore, the LPC2368 actually contains Ethernet MAC control, but does not provide a physical layer interface, so an external physical layer chip is required to provide an Ethernet access channel. Here, National Semiconductor's DP83848C is selected as the Ethernet physical layer interface chip, which provides MII/RMII/SNI interfaces and can be easily connected to the LPC2368.

2 Introduction of LPC2368 and DP83848C

2.1 Microprocessor LPC2368

The LPC2368 is a 32-bit microcontroller based on the ARM7TDMI-S core. It can operate at frequencies up to 72MHz. It is powerful and cost-effective, supporting 10/100 Ethernet, full-speed (12Mbps) USB 2.0 and CAN 2.0B. It has up to 512KB of on-chip Flash, 58KB of SRAM, 10-bit A/D and D/A converters and an IRC oscillator. It also has an optional SD memory card interface and a 100-pin LQFP package (14×14×1.4mm). It is widely used in industrial control, POS systems, protocol conversion, encryption systems and other fields [1] .

2.2 Physical layer chip DP83848C

The DP83848C is a 10/100Mb/s single-ended low-power physical layer device with several intelligent power-saving modes, including a 25MHz clock output that is easily accessible via an external transformer and twisted pair media interface; support for both IEEE 802.3u MII and RMII Rev 1.2 for easy design; integrated sublayer support for 10BASE-T and 100BASE-TX Ethernet protocols; low power consumption less than 270mW, 3.3V MAC interface; configurable SNI interface; 48-pin LQFP package (7x7mm). As an Ethernet physical layer transceiver, the DP83848C is widely used in high-end peripherals, industrial control and factory automation operations, and general embedded applications [2] .

3. Hardware design

3.1 Circuit diagram

The connection between LPC2368 and DP83848C is relatively simple, and can be directly connected through the RMII interface. After the connection is completed, DP83848C is connected to the transmission media through the network isolation transformer and RJ45 interface. The circuit block diagram is shown in Figure 1.

Figure 1 Block diagram of Ethernet interface circuit between microcontroller LPC2368 and PHY chip DP83848C

3.2 Ethernet interface actual circuit schematic design

DP83848C supports several MAC interface modes: (1) MII; (2) RMII (Reduced MII); (3) 10 Mb Serial Network Interface (SNI). Here we use the RMII interface mode, which is determined by setting pins pin39 and pin6, as shown in Table 1.

Table 1 : MII mode selection

MII_MODE (pin39)

SNI_MODE (pin6)

MAC Interface Mode

0

0 or 1

MII Mode

1

0

RMII Mode

1

1

10Mb SNI Mode

As can be seen from Table 1, pin39 should be connected to a high level and pin6 should be connected to a low level. At the same time, because pin6 is pulled down inside the chip and defaults to 0, it is sufficient to set pin39 to a high level, so that the microprocessor LPC2368 can be connected to the PHY chip DP83848C through the RMII interface. They are connected through the RMII interface, and the number of pins used to connect the chip and the controller will be relatively small, and the data transmission rate is 2 bits each time, that is, the frequency is 50MHz, so a 50MHz crystal oscillator needs to be connected to pin34 X1.

In RMII mode, the main pins used are: 1 Serial management: MDC (pin31), MDIO (pin30); 2 MAC data: TX_EN (pin2), TXD[1:0] (pin4 pin3), RX_ER (pin41), CRS_DV (pin40), RXD[1:0] (pin44 pin43); 3 Clock: X1 (pin34, RMII reference clock is 50MHz), X2 (pin33).

Pin27 is set high to make DP83848C work at a rate of 100Mbps, and the LED displays the working status of DP83848C. 16ST8515 is a network isolation transformer, which mainly plays the role of signal transmission, impedance matching, waveform repair, clutter suppression and high voltage isolation to protect the safety of the system. The circuit schematic diagram drawn by protel 99 SE is shown in Figure 2.



Figure 2: Schematic diagram of the actual circuit of the Ethernet interface


4 Software Implementation Process

The software implementation mainly consists of three parts: system initialization, data sending and receiving.

The initialization part completes the initialization work of the Ethernet interface before use, mainly including setting related registers, allocating and initializing the send and receive buffers, etc.

4.1 How Ethernet works

The corresponding data packet at the network interface layer is in the complete Ethernet frame format. Therefore, to realize data transmission and reception, it must be carried out according to the Ethernet IEEE802.3 protocol. The frame structure defined by this protocol is shown in Table 2.

Table 2 : Standard Ethernet frame format

Sync bit

Separator

Destination Address

Source Address

Frame Type

Data segment

filling

Check digit

56Bit

8Bit

48Bit

48Bit

16Bit

<1500Byte

Optional

32Bit

Each network card has a global fixed physical address (MAC address) when it leaves the factory. When a node on the bus sends a data frame, other network nodes on the bus copy the data frame, and each node checks the destination physical address of the data frame. If it matches its own physical address, the network card of the node accepts the data frame and passes it to the upper layer protocol for processing. Otherwise, if it does not match, the node discards the data frame.

4.2 Sending and Receiving Data Frames

Use interrupt mode to send and receive data.

Sending data frames: Encapsulate the data to be sent into an Ethernet frame and write it into the sending buffer; detect whether there is data being transmitted in the network, that is, whether the previous frame has been sent. If there is still data being transmitted in the network, the frame cannot be sent temporarily. If there is no data in the network, the frame can be sent immediately; when sending the frame, the next data frame can be encapsulated at the same time and written into the second sending buffer; when the interrupt service program detects that the first data frame has been sent, the next data frame can be sent. Repeat the above process until all data frames have been sent. The flowchart of sending data frames is shown in Figure 3.

Receive data frames: Wait until a data frame arrives, save the data frame into the FIFO buffer, and then check the destination address of the data frame. If it is the MAC address or broadcast address of the NIC, and there is no error after verification, the data is transferred to the receive buffer, and an interrupt is raised to the processor to continuously read the received data frames from the NIC local cache into the system memory.

5 Conclusion

This article describes the design of Ethernet interface using microprocessor LPC2368 and PHY chip DP83848C. Due to the excellent performance of microcontroller LPC2368 and physical layer chip DP83848C, the interface circuit has many advantages such as simple structure, small size, low power consumption, etc. It is a good choice for realizing the connection between embedded system and network.

The author's innovation is to use the powerful microprocessor LPC2368 to connect to the physical layer chip through a streamlined media independent interface, which makes wiring simpler while ensuring the same functions, and can greatly reduce the error rate during design.

References

[1]. LPC2364/6/8/78 User manual.

[2]. DP83848C User manual.

[3]. ARM Microcontroller Basics and Practice[M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005.

[4]. Fu Chong, Chen Ying, Ma Ximin, Zhang Yongyuan. Design and implementation of a universal embedded system Ethernet interface [J]. Journal of Shandong University, 2005.6, 35(3): 93-97.

[5]. Lv Changtai, Luo Yonggang. Research and design of embedded Ethernet interface[J]. Microcomputer Information. 2006, 22(8-2): 68-70.

[6]. Ge Yongming, Lin Jibao. Design of Ethernet interface for embedded system[J]. Application of Electronic Technology. 2002, 3: 25-27.

[7]. Microcomputer Information - Embedded and SOC (mid-month)

Reference address:Design and implementation of network interface based on ARM-LPC2368

Previous article:Design and implementation of network card interface based on ARM and DM9000
Next article:Design and implementation of LCD based on ARM7

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号