本文介绍了一个基于三星ARM9芯片S3C2440嵌入式系统的以太网接口电路设计方案,采用了工业级以太网控制器DM9000AEP成功实现了嵌入式系统网络数据交换。论文在重点阐述了网络接口电路基础之上,对Windows CE系统控制软件部分DM9000AEP的驱动程序和注册表项进行了具体分析。
随着微电子技术和计算机技术的发展,嵌入式技术得到广阔的发展,已成为现代工业控制、通信类和消费类产品发展的方向。以太网在实时操作、可靠传输、标准统一等方面的卓越性能及其便于安装、维护简单、不受通信距离限制等优点,已经被国内外很多监控、控制领域的研究人员广泛关注,并在实际应用中展露出显著的优势。本文提出了一种基于DM9000AE网络接口芯片和32位三星ARM9处理器S3C2440嵌入式系统的以太网接口的设计方案,并在Windows CE操作系统上开发移植了网络驱动程序实现网络的接入。
2. DM9000AE工作原理
2.1 DM9000的主要特性和总体结构
DM9000AE是DEVICOM(台湾联杰国际)研发的一款10/100M快速以太网控制芯片。DM9000AE实现以太网媒体介质访问层(MAC)和物理层( PHY)的功能,包括MAC数据帧的组装/拆分与收发、地址识别、CRC编码/校验、MLT-3编码器、接收噪声抑制、输出脉冲成形、超时重传、链路完整性测试、信号极性检测与纠正等。DM9000AE内部逻辑结构如图1所示。
DM9000AE具有以下主要性能:①48管脚的LQFP封装,管脚少体积小;②支持8/16位数据总线;③适用于10Base-T和100Base-T,10/100M自适应,适应不同的网络速度要求,④内置16KB的SRAM,用于收发缓冲,降低对主处理器的速度要求;⑤支持IP /TCP /UDP加速,减轻了CPU负担,提高网络速度;⑥支持Back pressure半双工流量控制,与IEEE802.3u兼容,支持IEEE802.3x全双工流量控制;⑦20ns响应时间,2.5V/3.3V低功耗。
Figure 1 DM9000AE internal logic structure
2.2 Working Principle
DM9000AE can be connected to the microprocessor in 8-bit or 16-bit bus mode, and can run in simplex or full-duplex mode as needed. When the system is powered on, the processor configures the internal network control register (NCR) and interrupt register (ISR) of DM9000AE through the bus to complete the initialization of DM9000AE. Then DM9000A enters the data transmission and reception waiting state.
When the processor wants to send a data frame to Ethernet, it first packages the data into UDP or IP data packets and sends them byte by byte to the data transmission buffer of DM9000A through the 8-bit or 16-bit bus, and then fills the data length and other information into the corresponding register of DM9000AE, and then sends the enable command. DM9000AE frames the cached data and data frame information into MAC and sends them out.
When DM9000AE receives Ethernet data from the external network, it first checks the legitimacy of the data frame. If the frame header flag is incorrect or there is a CRC check error, the frame data is discarded. Otherwise, the data frame is cached in the internal RAM and the processor is notified through the interrupt flag. After receiving the interrupt, the processor processes the data received by DM9000AE in the RAM.
DM9000AE automatically detects the network connection status and sets the internal data transmission and reception rate to 10Mb/s or 100 Mb/s according to the network speed. At the same time, DM9000AE can also change the direction of the data transmission and reception pins according to the RJ45 interface connection method, so whether the external network cable is in peer-to-peer or cross mode, the system can communicate normally.
3. Network interface hardware circuit design
Adding an Ethernet interface to an embedded system is usually implemented by the following two methods. The first method uses an embedded processor with an Ethernet interface. This method requires that the embedded processor has a universal network interface. Usually, this processor is designed for network applications and realizes the exchange of processor and network data through the internal bus method. The other method uses an embedded processor + network card chip structure. This method has no special requirements for the embedded processor. It only needs to connect the Ethernet chip to the bus of the embedded processor. This method is highly versatile and is not limited by the processor. However, the processor and the network exchange data through the external bus [3].
This design adopts the method of extending the Ethernet interface on the universal embedded microprocessor S3C2440, that is, the second method. The structure of the connection between the S3C2440A processor and the DM9000AE is shown in Figure 2. The DM9000AE is connected to the processor through the bus, and the interrupt is connected to the external interrupt of the processor.
Figure 2 Structure of the connection between S3C2440A processor and DM9000AE
The S3C2440A microprocessor is a low-power, highly integrated 16/32-bit RISC microprocessor designed by Samsung Semiconductor for handheld devices and various multi-purpose applications. It uses a five-stage pipeline and Harvard structure, and is packaged in a 289-pin FBGA package. The S3C2440 not only includes the ARM920T core, but also adds a wealth of peripheral resources, including 1 LCD controller; 3-channel UART; 4-channel DMA; 4 16-bit timers/counters with PWM function and 1 16-bit internal timer, supporting external clock source; 8-channel 10-bit ADC; touch screen, IIC bus, IIS bus, SD card and MMC card, camera interface; 130-bit general I/O port and 24-bit external interrupt source.
The connection of the DM9000AE Ethernet interface circuit is shown in Figure 3. The processor uses the chip select DM_CS and the address line BADDR to connect the CS pin and CMD pin of the DM9000AE chip respectively, and the data line BDATA[15:0] of the S3C2440 is connected to the data line SD[15:0] of the DM9000AE to realize data transmission between the DM9000 and the S3C2440; the DM_IOR pin of the S3C2440 is connected to the read pin IOR# of the DM9000AE, and the DM_IOW pin is connected to the write pin IOW# of the DM9000AE; at the same time, the DM9000AE occupies the interrupt pin EINT7 of the S3C2440, so that the S3C2440 can respond to the interrupt of the DM9000AE. The connection between the DM9000AE and the network is connected to the Ethernet crystal connector RJ_45 through the isolation transformer E-2023 via the receiving signal line RX+, RX- and the sending signal line TX+, TX-. The main function of the isolation transformer is to isolate the embedded system from the external circuit, prevent interference and burn out of components, and realize the live plug-in and pull-out function.
Figure 3 Ethernet interface circuit
4. Software design of network interface module
This system uses Windows CE operating system, which has powerful network support functions. Windows CE supports all Internet network protocols including TCP/IP. Windows CE network drivers all follow NDIS (Network Driver Interface Specification). NDIS provides two abstract layers to connect network drivers and protocol stacks. The schematic diagram of NDIS model is shown in Figure 4. [page]
Figure 4 Schematic diagram of the NDIS model
The driver of DM9000AE under Windows CE is written based on this model, compiled into a dynamic link library, and exists in the form of a DLL file in user mode. The entry function is DriverEntry(). The workflow of DM9000 driver is shown in Figure 5.
The function of NdisMInitializeWrapper() is to notify NDIS that a miniport network card is being initialized. This function is provided in ndis.dll. Then initialize the NDIS40_MINIPORT_CHARACTERISTICS structure variable, mainly setting some callback functions (MiniportInitialize(), MiniportReset(), MiniportInterruptHandler(), MiniportISRHandler(), MiniportQueryInformation(), MiniportSetInformation(), MiniportSend(). Then register with the NDIS system using the NDIS40_MINIPORT_CHARACTERISTICS structure through the NdisMRegisterMiniport() function. Next is MiniportInitialize(), which initializes the NIC_DRIVER_OBJECT class and calls the EDriverInitialize() function of the class. In this function, all initialization operations of dm9000 are fully launched
. All initialization operations are implemented in the dm9000.cpp file, mainly through the DeviceEntry() function. In the DeviceEntry() function, only one thing is done: a new instance of the C_DM9000 class is created and returned. Then the C_DM9000 instance performs a series of initialization operations on the DM9000AE through DeviceSetDefaultSettings(); DeviceSetEepromFormat(); DeviceRetriveConfigurations(hconfig); EDeviceValidateConfigurations(), etc. Then NIC_DRIVER_OBJECT points to DriverStart(). In DriverStart(), C_DM9000 only performs a very simple but most important operation, which is to start the interrupt in DeviceEnableInterrupt(). The next step is endless waiting, receiving, and sending, and DM9000 starts working.
Figure 5 DM9000 driver workflow
在完成了驱动程序之后,我们还需要在Platform.reg文件中对DM9000的注册表项进行相应的设置:
[HKEY_LOCAL_MACHINECommDM9000]
"DisplayName"="Crystal DM9000 ISA Ethernet Controller"
"Group"="NDIS"
"ImagePath"="DM9000.DLL"
[HKEY_LOCAL_MACHINECommDM9000Linkage]
"Route"=multi_sz:"DM90001"
[HKEY_LOCAL_MACHINECommDM90001Parms]
"BusNumber"=dword:0
"BusType"=dword:0
"InterruptNumber"=dword:3E
"IoBaseAddress"=dword:D3000000
"RxMode"="PIO"
"NetworkAddress"="00-01-33-33-33-33"
[HKEY_LOCAL_MACHINECommDM90001ParmsTcpIp]
"EnableDHCP"=dword:0
"DefaultGateway"="192.168.126.1"
"UseZeroBroadcast"=dword:0
"IpAddress"="192.168.126.100"
"Subnetmask"="255.255.255.0"
"DNS"="192.168.126.1"
[HKEY_LOCAL_MACHINECommTcpipLinkage]
"Bind"=multi_sz: "ppp", "DM90001"
将设计的模块与本地局域网连通,并分配MAC地址和IP地址,利用PC的ping程序,得到回应,说明ARP、IP、ICMP协议正常。利用自己编写的基于windows的应用程序,向模块发送连接请求,模块返回正确的应答信息,TCP协议正常。
5.结束语
本文详细介绍了基于三星公司ARM9芯片S3C2440嵌入式系统的网络接口设计方案,在实际应用中该系统运行稳定,能够十分方便地实现嵌入式系统的网络互连。由于采用了高性能的工业级以太网控制器DM9000AE,系统通讯快速可靠,具有很高的实时性。在以太网日益普及的今天,此方案能够给那些传统不具备网络通讯能力的嵌入式设备进行智能化改造,也适用于新型智能仪器仪表和工业自动化系统设备的开发,有着广泛的应用前景。
Previous article:TinyOS transplantation and driver analysis for STM32 and CC2520
Next article:STM32's strip fingerprint collection and splicing system
Recommended ReadingLatest update time:2024-11-16 16:37
- Popular Resources
- Popular amplifiers
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
- How to build a Keil project using the LPC8xx ROM?
- C2000 CLA FAQ: Architecture and Configuration
- Divide an assembly file into several assembly files. Compile prompt variable is not defined
- RF amplifier performance test
- What kind of feedback is introduced in the following circuit?
- Storage time of different surface treatment processes for circuit boards
- Upgraded AMG8833 PyGamer thermal imager
- LED Dress
- The relationship between pulse+, pulse- and U2B output is logical AND.
- Southern dumplings and northern dumplings, what do you eat during the Winter Solstice?