ECONET LAYERING The International Standards Organisation (ISO) have defined a seven layered model of network communication in an attempt to set an international standard: LOCAL STATION REMOTE STATION 7 Application Application | | 6 Presentation Presentation | | 5 Session Session | | 4 Transport Transport | | 3 Network Network | | 2 Data link Data link | | 1 ------------- Physical------------------ Since in an ECONET system Acorn Computers Ltd are responsible for all bar the Application level, it was appropriate to combine ISO layers in the ECONET design, such that it is a three-layered network with each layer system-independent of the others: Layer Responsibility ECONET name 7 User Application 6 - 4 Acorn Client 3 - 2 Acorn Data link 1 Acorn Physical This handout considers in detail the physical and data link layers. It ignores the client layer, which, in summary, is responsible for such functions as session organisation, interfacing with the application program, initiating transmissions and handling error conditions due to bad packet transfers. The data link layer forms the interface between the client and physical layers. Here communications protocols are defined enabling messages to be passed error-free between client and physical layers. Errors at the physical layer during transmission are detected and reported to the client layer in a predetermined manner. The physical layer describes the electrical characteristics and bit stream requirements of the communications channel, including byte formatting, timing requirements and voltage waveforms. It detects two types of error - cyclic redundancy check failures and collisions. FUTURE ENHANCEMENTS ECONET is a Local Area Network (LAN) system requiring a single, continuous cable. Provision has been made in its development for future enhancements to cater for variable topologies and increase the number of stations which can be contacted from any one station. A bridge will enable ECONET networks to be linked together locally giving their stations the ability to communicate over a wider area than via a single continuous cable. A bridge is a dedicated packet repeater in which the identities of the two networks served have been set. ADVANCED DATA LINK CONTROLLER (ADLC) The MC68B54 Advanced Data Link Controller is the chip in an ECONET interface which transmits and receives data packets over a synchronous communications channel between two or more stations using a bit orientated protocol. It converts data between bit parallel and bit serial format and constructs packets for the network. Its functions include: - automatic generation of flags - cyclic redundancy check calculation / checking - zero insertion / deletion. Opening and closing flags mark the beginning and end of each frame, and are always 01111110. Such characters are always detected as flags and not data since the ADLC automatically inserts a zero bit after every group of five consecutive 1 bits in the rest of the package, whether data, control information or cyclic redundancy check bytes. The cyclic redundancy check (CRC) is a 16 bit error checking sequence resulting from a calculation carried out on all the bits in the frame excluding flags and inserted zeros. It enables the ADLC to check whether a packet has been transmitted correctly or otherwise across the network. The CRC is placed in the packet immediately before the closing flag. The ADLC has four control registers and two status registers. The transmit and receive data buffers use a first in first out approach. The function of each register bit is as follows: Control register 1 bit 0 Switch controlling access to CR3 or CR4 bit 1 Set to enable RX interrupts bit 2 Set to enable TX interrupts bits 3-5 Not used bit 6 Resets all RX status and FIFO registers bit 7 Resets all TX status and FIFO registers Control register 2 bit 0 Status bits prioritised bit 1 Should be set. Causes ADLC to work in two byte mode so that Receive Data Available and Transmit Data Register Available are asserted when two data bytes are ready and two transmit registers available bit 2 Determines whether flag fill or mark idle is to be used between packet transfers bit 3 Select frame complete or TX data register ready bit 4 Transmit last byte. (Initially set to 0; used to indicate when CRC and closing flag should be transmitted.) bit 5 When set RX status bits are cleared bit 6 When set TX status bits are cleared bit 7 Request to send. Controls the RTS output used to enable the output transmit driver. Control register 3 bit 0 Indicates that no logical control byte is included in a packet bit 1 Indicates control field is 8 bits long bit 2 No auto address extend; ADLC assumes 8 bit address. (Although ECONET uses 15 bit addresses, the ADLC's auto address extend facility is not used since the high order bit has special significance.) bit 3 Idle set to be all ones bits 4-7 Not used Control register 4 bit 0 Indicates closing flag of one packet is also opening flag of next. (Irrelevant in ECONET systems since reception always follows transmission.) bits 1-2 Set TX word length to 8 bits bits 3-4 Set RX word length to 8 bits bits 5-7 Not used Status register 1 bit 0 Receive data available - set to confirm that two bytes are available in the receive FIFO data buffer bits 1-3 Not used bit 4 Clear to send. This bit reflects the condition of the CTS input. If enabled, a switch of CTS from low to high causes an interrupt. bit 5 Not used bit 6 TX data register available. This should be read before sending a byte. When CTS is high, TDRA is deasserted to indicate that transmission should end. bit 7 IRQ. Interrupts are enabled as appropriate to indicate transmit, receive and error conditions. Status register 2 bit 0 Address present. Set to indicate that the first byte of a packet is available for reading. bit 1 Frame valid. Indicates packet received and CRC correct. bit 2 Receive idle. Set to cause an IRQ after 15 one bits have been received. bits 3-4 Not used bit 5 Data carrier detect. Reflects the DCD input, showing the state of the clock signal. If enabled, an interrupt is generated if the clock fails. bit 6 Not used bit 7 Receive data available. Used after a receive interrupt to confirm that data is actually ready. Other causes of an interrupt indicate an error condition. PACKET FORMAT Data transfer across the network normally involves a four-way handshake ----------> scout <---------- ACK ----------> data <---------- ACK as described in the next section. Each of these four packets contain some of the following fields, the selection depending on the packet type: - Flag: a single byte with bit pattern 01111110. - Destination address: the identifier of the destination station (1 to 254, with 0 and 255 reserved for broadcasting). - Destination network: A value 0 to 127 identifies the network (0 this LAN); a value of 128 upwards (ie high order bit set) indicates a user-defined special operation - Source address: identifies sending station (1 to 254) - Source network: identifies source network (0 to 127) OR user-defined operation - Control byte: determines type or operation - Port byte: associates a meaning to a packet - Data: data! - CRC: two-byte frame check sequence The maximum size of a data field is determined at the client level. Level 1 File Server software imposes a maximum of 12K bytes. With Level 2 software, the limit is the number of bytes that can be transmitted before a TIMEOUT condition can occur at another station. This occurs if a station finds the line busy for 10 seconds. As a rule of thumb guide, take the maximum number of bytes as the clock frequency of the network - for example, a clock frequency of 100 KHz will support a maximum data block size of 100K bytes. The format of each type of packet is as follows: Scout packet Data packet Acknowledge packet Flag Flag Flag Destination address Destination address Destination address Destination network Destination network Destination network Source address Source address Source address Source network Source network Source network Control byte Data CRC Port byte CRC Flag CRC Flag Flag TRANSMIT AND RECEIVE Schematically, the four-way handshake looks like this: __________ __ __ __ __________ Clear | | | | | | to send |_______| |_________________| |_____| ______ _______ _________________ ________ _____ ______ | IDLE | | SCOUT | | FLAG FILL ACK | | DATA | | ACK | | IDLE | |______| |_______| |_________________| |________| |_____| |______| 5s <50s <50s <50s 15 cycles 15 or more consecutive one bits cause the Idle Flag bit in the ADLC to be set. When the client layer initiates a transfer, the idle flag is checked. If the line is available, a scout packet is sent to alert the destination station of an imminent data transfer. The receiving station compares this scout against the list of messages it has been instructed to accept. While this search is taking place, it jams the data line by sending a continuous stream of flags to prevent another station claiming the line. This 'Flag Filling' is needed since the search may take more than 15 cycles - and the line is required permanently busy during the whole of the four-way handshake. On finding a match, the receiving station transmits an acknowledge packet. The source station can now send the data packet and, if the transfer is successful, the receiving station replies with the message acknowledge packet. Note that if the source station does not receive this final acknowledge packet, it assumes the data packet did not reach its destination and therefore retransmits. This can lead to duplicate data being accepted. It is the responsibility of the client layer to take appropriate action. For example, a control number can be placed in the control byte of the scout packet. If two consecutive packets are received with this same control number, the client layer can ignore the second, though it must still be acknowledged to prevent further retries. IMMEDIATE OPERATIONS Transmit and receive operations require the cooperation of both source and destination stations; immediate operations, on the other hand, do not: PEEK - copies a block of memory from a distant machine into the source station using a two-way handshake protocol. POKE - transfers a block of memory into a remote machine using the four- way handshake protocol. REMOTE JUMP SUBROUTINE CALL - Using the four-way handshake, arguments are passed in the data block from the local to the remote station, and an event is generated to cause a jump to a subroutine. NB - this operation hould be used with caution ... the remote station can be made to jump to any position in memory ... USER PROCEDURE CALL - similar to the remote subroutine call. However, the event is handled by the remote station which can therefore ensure that the procedure call is sensible! HIGH LEVEL PROCEDURE CALL - same as the user procedure call except that the ECONET software handles the event. HALT - forces the remote station to stop processing CONTINUE - restarts the remote machine. MACHINE TYPE PEEK - enables the local station to determine the machine type and NFS version of the remote station. DETECTING AND HANDLING COLLISIONS With networks like ECONET, two or more stations may start transmitting 'at the same time'. ECONET's design makes this a very rare event. Transmission only occurs if a test of the line shows it free. The first bit of the scout packet (the leading 0 in the flag) immediately initiates a line busy state. A collision can only occur if a second station checks for line idle in the time between the first station checking and claiming the line. This period of contention lasts a mere 5 microseconds! When the line switches to idle mode, the collision detection circuitry is activated. A collision is identified and hence detected by a differential voltage between the lines of less than 1 volt. The maximum detection time is 40 cycles (since, in the worst case, the first 39 bits of scouts from two sending stations are identical). An interrupt is generated on collision detection requesting termination of transmission, and the stations 'back off'. The error is reported by the data link layer. Collision arbitration software reschedules transmission. further collisions are avoided by ensuring each station waits for a different amount of time, namely, (255 - station number) x 5 microseconds before flagging the error to the client level software. This gives priority to stations in descending order of station number. Schematically, the contention period, back off, and retry occur thus: Clear _______________ __________________________ to send | | | | ________| |_________| |________ _______ ____________________ ______________________ | ACK | | IDLE | COLLISION | | IDLE | CLAIM | SCOUT | |_______| |______|_____________| |______|_______|_______| 15 5s 15 5s cycles cycles End of message; Backoff Successful retry stations queue for access N.B. Since ECONET will retry after failure, and stations backoff for different times, collision detect in hardware is not strictly necessary. It is not included as part of the BBC B+, and Master ECONET upgrade. CLOCK GENERATION Since ECONET is a synchronous system, the network requires a single system clock. The one used is an MC14411 clock generator driven by a 1.8432 MHz crystal giving 14 potential frequencies ranging from 614 KHz to 4.8 KHz. The required frequency for a network depends on that network's topology and various limiting factors: - the ECONET hardware imposes a minimum speed of 70K - the maximum clock rate is 300K for BBC machines (200K for the ATOM) - no stations should be more than half a clock cycle out of phase. Recommended maximum clock rates based on the distance between the clock and the furthest station are: Maximum distance to clock (metres) Maximum clock rate (Hz) 100 307K 150 230K 240 153K 330 115K - 76K More accurate values can be calculated from the formula: maximum clock frequency = V / (4 . L + 2 . D . V) where: D is station propagation delay (420 ns for Acorn devices) L is length between clock and furthest station V is propagation velocity of the signal. Note: The above formula and figures assume Acorn recommended equipment (eg ADLCs, specified twisted pair cables) are used. Later clock boxes use different hardware, and have a programmable mark space ratio. This means that different stations can be more than half a cycle out or phase, and the network can still work correctly. NETWORK TERMINATION Correct termination is needed to minimise the signal reflections which occur at the ends of lines. The amount of potential reflection depends on the network topology and speed. It appears as overshoot and ringing on the signal. The following diagram shows typical voltage waveforms on ECONET: differential waveforms +2.1v ____ __ ......................./....\....../..\............................. / \____/ \_/ / / _________0v________/________________________________________________ / / / _______________/ -2.1v 50ns 150ns rise time settling time In general, long fast networks with several branches are more prone to termination errors than others. Termination also provides the +0.6 volt bias required to hold the lines at logic one when undriven. Consequently the terminator needs either its own power supply or to take its power from the clock line. Both the data and clock lines are driven by a tristate differential line driver, the SN75259N. The differential drive voltages are typically 0.25 and 3 volts, driving into 50 ohms. The above diagram shows typical rise and settling times for a 400 metre network running at 100KHz. CABLES The ECONET network requires a four-core cable with earth screen. The four cores should be arranged as two twisted pairs since this reduces the likelihood of external interference and crosstalk. These cables have a characteristic impedance of 100 ohms, hence terminating impedance should also be 100 ohms. Low end-to-end resistance is important since signals become attenuated as they travel down a line, but must never become so attenuated that the line is taken to be undriven. The maximum end-to-end resistance of the cable itself should be less than 15 ohms with 5 ohms for connection (solder joint) resistance, ie a total maximum end-to-end resistance of 20 ohms. The cable must have ground wire connected to earth at one point in the network only. Current loops may exist via earthed stations but the effect is minimised by the differential arrangement. In summary, cable specification: - maximum end to end resistance for 500m 15 ohms - minimum propagation velocity 0.5c - characteristic impedance 100 +/- 10 ohms - cable type twisted pair with screen Suitable cable types: BICC CS7227 0.9mm two pairs with screen (for networks up to 500m) RS 367-921 0.643mm two pairs with screen (for networks up to 300m) APPENDICES 1. ECONET System Diagram ÚÄÄÄÄÄÄÄÄÄÄÄ¿ ³ CLOCK ³ ³ GENERATOR ³ ÀÄÄÄÄÄÂÄÄÄÄÄÙ ÚÄÄÄÄÄÄÄÄÄÄ¿ ³ ÚÄÄÄÄÄÄÄÄÄÄ¿ ³TERMINATORÃÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄ<ÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄ>ÄÄÄÄÄÄÄÄ´TERMINATOR³ ³ ÃÂÄijÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄijÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄ´ ³ ÀÄÄÄÄÄÄÄÄÄÄÙv v v ^ v v v ³ ÀÄÄÄÄÄÄÄÄÄÄÙ ÚÁÄÄÁ¿ ÚÄÁÄÄ¿ ÚÄÁÄÄ¿ ÚÁÄÄÁ¿ ÚÄÁÄÄ¿ ÚÄÁÄÄ¿ ³ DD ÃÄÄÂ>Ä´ CD ³ Ú>´ LD ³ ³ DD ÃÄÄÂ>Ä´ CD ³ Ú>´ LD ³ ÀÂÄÄÂÙ ³ ÀÄÂÄÄÙ ³ ÀÄÂÄÄÙ ÀÂÄÄÂÙ ³ ÀÄÂÄÄÙ ³ ÀÄÂÄÄÙ v v v v ³ ^ v v v v ³ ^ ÚÄÄÁÄÄÁÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÁÄÄ¿ ÚÄÄÁÄÄÁÄÄÄÁÄÄÄÄÁÄÄÄÄÁÄÄÄÁÄÄ¿ ³ CLK RX DCD CTS RTS TX ³ ³ CLK RX DCD CTS RTS TX ³ ³ ³ ³ ³ ³ MC6854 ADLC ADDR DATA ³ ³ MC6854 ADLC ADDR DATA ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÙ ³ ³ ³ ³ ÚÄÄÁÄÄÄÄÄÄÁÄÄ¿ ÚÄÄÁÄÄÄÄÄÄÁÄÄ¿ ³ HOST ³ ³ HOST ³ ³ COMPUTER ³ ³ COMPUTER ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÙ Key: CD - Collision Detect Circuitry DD - Differential Detector LD - Line Drive 2. The MONITOR Utility The network monitor utility (called NETMON in Level 1, NETMONITOR in Level 2 / 3) displays the content of each frame sent across the network. It is particularly useful in showing why a transmission has failed. For every transfer it lists: - one four-way handshake per line - control fields except for flags and CRC which are omitted - the first part only of the data block The status of each frame is given by the codes: i idle line v valid frame (CRC OK) e CRC failed through noise on the network or electrical interference b handshake aborted d data carrier detect input has changed (probably no clock signal) o overrun - the network is running too fast for the monitor! Here are some examples of the monitor's output: (a) Valid four-way handshake - Station 189 issues *DELETE for a file. This results in two four-way handshakes, the first from station 189 to the fileserver (254) requesting deletion, the second from 254 to 189 confirming that the file has now been deleted: FE00BD0080v99 BD00FEv00 FE00BD00900001020444454C455445v0D BD00FEv00 i scout ack data ack BD00FE0080v90 FE00BDv00 BD00FE0000v00 FE00BDv00 i scout ack data ack (b) Handshake aborted during transfer of data packet 0100BD0080v99 BD0001v00 0100BD00AABBCCb i scout ack data In this case station 189 is attempting to send to station 1 a larger block of data than station 1 has been told to accept. (c) Scout frame send; no acknowledgement returned FE00BD0080v99 i scout This will result in error code &42 at station 189.