One kind is simplified reliable low-cost embedded Ethernet interface design
Summary: This text has introduced the software and hardware design method of interface of Communication of Ethernet based on new independent control chip CP2200. Keyword: CP2200; Ethernet; C8051F040; TCP/IP
The foreword is at present, the embedded designer is offering Ethernet for remote control or monitoring aid to connect fashionably, Ethernet controllers used are all specially for system design of the personal computer, for instance RTL8019, DM9008, CS8900A,etc.. These devices not only complicatedness of the interface circuit, volume are relatively large, but also more expensive. CP2200 is an independent Ethernet controller that Silabs is introduced, it accords with IEEE 802.3 agreement, support 10M Ethernet to insert, and only need little outside circuit to be wired the designing requirement of the embedded Ethernet interface of satisfiable overwhelming majority, make the design of interface of immersible type Ethernet simplified greatly, take the space of board to reduce greatly, the systematic development cost is reduced greatly. In addition, this Ethernet controller has 8 bit parallel main machine interfaces, can offer the Communication function of Ethernet for most microcontrollers or host processor. 8 the intersection of bit parallel and bus interface support Intel and the intersection of Motorola and the intersection of bus line and way, can use, multiplex non disjunction multiplex way addressing. These functions add TCP/IP protocol stack of the relevant processor, make the Ethernet interface of the embedded application system realized and extremely simple and easy.
The hardware circuit of the circuit design system of the hardware is shown in Fig. 1. The peripheral circuit of CP2200 is simpler.
The running side by side in the main machine interface of hardware circuit I/O parallel interface CP2200 of Fig. 1, support Motorola and Intel two kinds of bus line ways, and support the address data to multiplex and not multiplex in the way. Can realize the disposition to the host computer interface bus way by earthing or drawing the high level MUXEN and MOTEN pin. Ethernet voltage transformer should realize interface of Ethernet, Ethernet voltage transformer is vital. Receive the pin (RX + / RX-) in the differentiating Have, 1:1 pulse voltage transformer needing one to be used particularly in 10BASE-T operation. Distribute and send the pin (TX + / TX-) in difference Unless have, it need it connect on every one with center tap 1:2. 5 pulse voltage transformer. The voltage transformer should have the voltage above 2kV to isolate the characteristic, in order to prevent electrostatic interference. The sending end needs two 8W (precision is 1%)s Resistance and the electric capacities of one piece 560pF link with particular end, be needed linking with particular end one of 100W resistances receiving end. At the request of CP2200, what I adopted is the Model PRJ-010 voltage transformer of series PRJ. This voltage transformer integrated RJ-45 is connected, the transmissive reliability of high frequency signal of improvement while saving manily and is wired. Other circuit LINK and ACT pin outgoing levels come to drive LED, the active state of connected sum used for pointing out the network. All pins of the power must link with same outside 3.3V power. Similar, all reference should be connected to the identical touch-down point the outside. Each VDD should connect the ceramic bypass capacitor of one 0.1mF, this electric capacity, close to the pin as much as possible with VSS pin. Need to especially prove, it needs relatively high electric current to drive the line interface of twisted-pairs, so the data link of receiving and dispatching of Ethernet should be as short as possible, and the thread diameter is strengthened appropriately in order to reduce the resistance losses (in order to guarantee machine format reliable transmission, my PCB circuit board has been chosen the thread diameter of 20mil) .
The software design TCP/IP agreement is various in style, cross correlation is complicated each other, can not realize all agreements on the one-chip computer, so must cut out the protocol stack. Combined the concrete Communication requirement for the system, my system only kept TCP, UDP, IP, ICMP, ARP agreement module finally. At the intersection of protocol stack and global design of procedure, consider single task of one-chip computer execution modes very difficult to give play to the intersection of TCP/ IP and characteristic of agreement, we have adopted the implement method based on that the incident drive TCP/IP protocol stack of the mechanism. The leading-in of this mechanism, make the system while guaranteeing to have an efficient assembler language to take the place of code efficiency, the real-time responsibility has got the improvement by a wide margin too. Will explain specifically the incident drives the characteristic of the mechanism and realization based on TCP/IP protocol stack of this mechanism as follows. After the incident drives mechanism's system initiation to finish, enter the incident loop body, inquiring whether there are incidents in event queues of C8051F040 constantly. Once event queue non-null, read the event flag word, judge incident type, and then the call corresponds to the incident and deals with the subroutine. After dealing with the subroutine and finishing, still return to the incident loop body. The event flag word is cut off and drives directly or indirectly, after a certain incident happens, only need it in the interrupt service routine the location of corresponding position of the status word. Cutting off and adding the incident in the event queue constantly, C8051F040 handler reads the event flag word from the event queue ceaselessly, handle the incident. The characteristic that the incident drives the mechanism is: *Because of in interrupt handler, carry out change the intersection of event flag and the intersection of word and such simple routine statement only, add the incident to event queue of C8051F040, return immediately. So close interrupted time very short systematically. Have strengthened the real-time nature of interrupt processing of system pair. *C8051F040 deals with or adds and further deals with the required incident in the event queue the corresponding incident according to the incident read at present. This has actually dealt with all tasks step by step, while carrying out this task of a step, also can carry out other task of a step. Like this. On condition that influence the main flow of program, have improved the systematic real-time nature. Brief procedure that the incident circulates
Legend: 1 =EVENT_ETH_ARRIVED; 2 =EVENT_TCP_RETRAN; 3 =EVENT_TCP_INACTIVITY; 4 =EVENT_ARP_RETRAN; 5 =EVENT_AGE_ARP_CACHE; 6 =EVENT_COME_NEWDATA; The brief procedure of the incident circulation process incident loop body of Fig. 2 is shown as in Fig. 2, among them meaning of every incident is: EVENT_ETH_ARRIVED: Ether network frame incident remained to deal with. Measure this incident, C8051F040 knows the call and reads CP2200 and accepts the buffer procedure, then deal with the bale breaking to the frame; EVENT_TCP_RETRAN: TCP retransmission incident. When TCP timer is exceeded, touch off this incident; EVENT_TCP_INACTIVITY: Do not shut off the link joint incident. As some connection has not received and dispatched the data for over 0.5 seconds, touch off this incident; EVENT_ARP_RETRAN: ARP asks for the retransmission incident of data packet. It is not corresponding to ask after sending out 0.5 seconds in a certain ARP, touch off this incident. Did not respond through retransmission two times, abandoned the data packet taking this IP as destination address; EVENT_AGE_ARP_CACHE: Upgrade ARP and buffer the incident. Touch off this incident once every 60 seconds; EVENT_COME_NEWDATA: There are new data incidents. When it is waited to send that there are new data, touch off this incident;
Many kinds of integrated function such as the intersection of CRC and check-up to conclude the speech CP2200, data filtering,etc. lighten the load of the one-chip computer effectively, it is flexible and convenient that the interface cell operation of receiving and dispatching within it stands up, have offered valid buffer for data packet of Ethernet. The chip has stable in-service behavior and interference-free antidetonation characteristic, I utilize CP2200, C8051F040 one-chip computer and TCP/IP protocol stack develop the interface plate card of Communication of Ethernet used for locomotive. This plate card has already run in testing the locomotive, in-service behavior is good, can carry on stable data transfer.
Bibliographical reference: 1. Silicon Laboratories Inc. CP2200 datasheet. http://www.silabs.com/2. Silicon Semiconductor Inc. c8051f040 datasheet. http://www.silabs.com/3. Special Edition Using TCP/IP, Ramadas Shanmugam, R.Padmini, S.Nivedita great the intersection of Joan and Li Jian Yin translate Electronic Industry Press 4. " TCP/IP is auspicious to solve Vol. 2 to realize " W.Richard Stevens http://www.china.pub.com/











