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)
Previous article:Design and implementation of network card interface based on ARM and DM9000
Next article:Design and implementation of LCD based on ARM7
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- What does the EAS test of the chip mean and what is its function? Please give me some advice
- gcc linaro cross-compilation tool download address
- Help: RSL10 RAM can only use 24KB, why can't the remaining 6x8KB be used? - Problem Solved
- Synopsys IP Resources: A look at the complete Ethernet PHY IP for high-performance computing SoCs
- What is Common Mode Rejection Ratio (CMRR)
- High Definition Smith Chart Black and White_the_Smith_Chart.
- Is there any difference between these two circuits?
- Help~How can I make the PCB package of this component according to the picture?
- Using R329 for offline face detection
- Please explain the cause of the error