Rabbit 4000 Microprocessor
User's Manual
PREV INDEX NEXT


20. 10Base-T Ethernet

20.1 Overview

Network Port A implements all of the required digital elements of the 10Base-T standard, and is normally used with two channels of the DMA controller. The receiver provides 32 bytes of buffering, and the transmitter has 16 bytes of buffering. Network Port A connects externally through six dedicated pins. The network port can operate in either half-duplex or full-duplex mode, selected via auto-negotiation.

The network port requires an accurate 20 MHz clock to generate the 10 Mbits/s serial rate of 10Base-T. This clock can come from the main system clock or a dedicated 20 MHz input under program control. The clock for the network port may also be disabled to conserve power. The network port contains synchronization circuitry to allow operation from the 20 MHz reference clock while the main system clock runs independently.

The network port transmitter precedes the transmit data automatically with a preamble and start-frame-delimiter, and appends CRC and the end-frame-delimiter after the last byte. Frame transmission starts automatically once the transmit FIFO is full and any interframe gap time or back-off time has expired. Transmission is aborted if a collision is detected, and is retried up to 16 times using the standard random back-off time algorithm. Detection of a collision causes the transmitter to send a 32-bit "jam" pattern of all ones to guarantee that all receivers in the network recognize the collision. The transmitter uses the 10 most-significant bits of the CRC checker, starting with bit 22 and increasing, to generate the initial seed for the back-off algorithm. Collisions that occur later than one slot time (512 bit times) are reported as late collisions, but are otherwise treated identically to "normal" collisions. If a transmission is not successful after 16 attempts, the transmitter halts and reports the failure via an interrupt. The transmitter guarantees the 9.6 µs inter-frame gap and implements the fair-access algorithm within the inter-frame gap. The transmitter automatically sends link test pulses, even while otherwise disabled, every 16.0 ms. The transmitter contains a jabber timer, which automatically disables the transmitter after 26.2 ms of continuous transmission. This error condition generates an interrupt and must be answered by resetting the network port. The corresponding DMA channel is automatically halted by this error condition and must be restarted after the network port has been reset.

The Rabbit 4000 does not implement the 10Base-T physical layer on-chip, but provides differential transmit data to simplify the external circuitry required to drive the 10Base-T cabling with the required waveform.

The network port receiver uses the received preamble to synchronize to the phase of the incoming frame, and then waits for the start-frame-delimiter. Character assembly begins at this point and each byte is transferred to the receive FIFO. However, no interrupt or DMA request will occur until after the first six bytes of the frame have been received and checked for an address match. The receiver can receive frames independent of the address (promiscuous mode), or it can receive frames with a physical address match, a broadcast address match, or a multicast address match.

Normal DMA transfers of data begin once an address match occurs, and continue until the end-frame-delimiter is recognized or the line goes idle because of a collision. The network receiver calculates the CRC across the entire frame in parallel with character assembly and reports the result when the end-frame-delimiter is recognized. Normally frames with bad CRC are discarded. The receiver also reports misaligned end-frame-delimiters (those that do not occur on byte boundaries).

To help with handling high-level protocols such as TCP/IP, the network port receiver accumulates a 16-bit checksum across the entire received frame except for the first 14 bytes. The first 14 bytes are the destination address field (six bytes), source address field (six bytes), and the frame length field (two bytes), which are not part of the TCP/IP payload. This checksum is initialized to all zeros during the address compare time, and then each pair of bytes is added to the checksum, with the carry from the previous add carried to the following add. The first-received byte adds to the lower byte of the checksum and the second-received byte adds to the upper byte of the checksum. In the case of a frame with an odd length, the second-received byte value is filled with zeros for the 16-bit add. The checksum at the end of the frame is transferred a holding register so that it can be read by software.

The network port implements the NLP receive link integrity test state machine, which requires link integrity pulses to be detected at certain intervals in the absence of other network activity. For this state machine, the link_test_min value is 4.2 ms, and the link_test_max value is 52.5 ms. The link_loss time constant is 78.7 ms. If the network receiver enters the NLP Link Test Fail state because of missing link-test pulses, this state machine requires seven successive properly timed link test pulses (or an equal number of FLP bursts) before reporting that the link is again active. The reset state of this state machine is link-inactive. Note that this is a subtle difference relative to the normal 10Base-T receive link-integrity state machine, which requires either link test pulses or carrier sense to make the link active.

The network port implements the auto-negotiation algorithm to determine half-duplex or full-duplex operation. In addition to its normal automatic operation, this feature can be disabled or commanded to execute under software control.

The clock for the network port is initially disabled to conserve power, but may be sourced from either a port pin, the system clock (actually the internal peripheral clock), or the system clock divided by two. Since the network port requires a 20.000 MHz clock, the clock should normally be supplied from the port pin. Using the system clock or a derivative to drive the network port precludes the use of the clock modulator.

The network port receiver uses two pins with various options for the behavior. The network port transmitter uses four pins to provide differential signals with wave-shaping capability. See Section 20.4 for more details.

20.1.1 Block Diagram

20.1.2 Registers

Register Name

Mnemonic

I/O Address

R/W

Reset

Network Port A Data Register
NADR
0x0200
R/W
xxxxxxxx
Network Port A Last Data Register
NALDR
0x0201
W
xxxxxxxx
Network Port A Transmit Status Register
NATSR
0x0202
R
00000000
Network Port A Receive Status Register
NARSR
0x0203
R
00000000
Network Port A Control/Status Register
NACSR
0x0204
R/W
00000000
Network Port A Status Register
NASR
0x0205
R
00000000
Network Port A Reset Register
NARR
0x0206
W
00000000
Network Port A Control Register
NACR
0x0207
R/W
00000000
Network Port A Pin Control Register
NAPCR
0x0208
R/W
000000xx
Network Port A Transmit Control Register
NATCR
0x020A
R/W
00000000
Network Port A Receive Control Register
NARCR
0x020B
R/W
00000000
Network Port A Phys. Addr. [7:0] Register
NAPA0R
0x0210
W
xxxxxxxx
Network Port A Phys. Addr. [15:8] Register
NAPA1R
0x0211
W
xxxxxxxx
Network Port A Phys. Addr. [23:16] Register
NAPA2R
0x0212
W
xxxxxxxx
Network Port A Phys. Addr. [31:24] Register
NAPA3R
0x0213
W
xxxxxxxx
Network Port A Phys. Addr. [39:32] Register
NAPA4R
0x0214
W
xxxxxxxx
Network Port A Phys. Addr. [47:40] Register
NAPA5R
0x0215
W
xxxxxxxx
Network Port A Multi. Filter [7:0] Register
NAMF0R
0x0218
R/W
xxxxxxxx
Network Port A Multi. Filter [15:8] Register
NAMF1R
0x0219
R/W
xxxxxxxx
Network Port A Multi. Filter [23:16] Register
NAMF2R
0x021A
R/W
xxxxxxxx
Network Port A Multi. Filter [31:24] Register
NAMF3R
0x021B
R/W
xxxxxxxx
Network Port A Multi. Filter [39:32] Register
NAMF4R
0x021C
R/W
xxxxxxxx
Network Port A Multi. Filter [47:40] Register
NAMF5R
0x021D
R/W
xxxxxxxx
Network Port A Multi. Filter [55:48] Register
NAMF6R
0x021E
R/W
xxxxxxxx
Network Port A Multi. Filter [63:56] Register
NAMF7R
0x021F
R/W
xxxxxxxx
Network Port A Multicast Hash Register
NAMHR
0x0220
R
00000000
Network Port A Collision Detect Register
NACDR
0x0221
R
00000000
Network Port A Alignment Error Register
NAAER
0x0222
R
00000000
Network Port A CRC Error Register
NACER
0x0223
R
00000000
Network Port A Checksum 0 Register
NAC0R
0x0224
R
00000000
Network Port A Checksum 1 Register
NAC1R
0x0225
R
00000000
Network Port A Missed Frame Register
NAMFR
0x0226
R
00000000


20.2 Dependencies

20.2.1 I/O Pins

The network port has six dedicated pins: two input pins (RxD+ and RxD-) and four output pins (TxD+, TxD-, TxDD+, TxDD-). These pins can be used as general-purpose inputs and outputs if the network port is not being used via NAPCR.

The 20 MHz clock will typically be input from PE6.

Pin PE7 can be enabled as a /LNK signal that will be active low whenever the device has an active link, and inactive high at all other times.

Pin PE5 can be enabled as a /ACT signal that will be active low for 0.1 seconds following each packet transmission, and inactive high at all other times.

20.2.2 Clocks

The network port requires a 20 MHz clock input for proper 10Base-T operation. It is expected that this clock is input from pin PE6, but it is also possible to source this clock from the processor clock or the processor clock divided by two, assuming a 20 MHz or a 40 MHz clock is installed.

If the processor clock is used, the clock doubler and dither should be disabled.

NOTE Unlike the other clock inputs on the Rabbit 4000, the PE6 network clock input does not have a Schmitt trigger inside the device. It is strongly recommended that you place an external Schmitt trigger on the input to PE6 if PE6 is to be used as the network clock input.

20.2.3 Other Registers

Register

Function

PEFR, PEAHR
Selection of /LNK and /ACT signals.


20.2.4 Interrupts

The network interrupt can be generated by an Ethernet frame received correctly, a frame received with error, a frame transmitted correctly, a frame transmitted with error, error counter overflow, jabber detection, or link status change. The events that generate an interrupt can be selected in NACSR.

The network port interrupt vector is in the IIR at offset 0x1E0. It can be set as Priority 1, 2, or 3 by writing to NACSR.

20.3 Operation

High-level support for TCP/IP and other protocols is beyond the scope of this manual, but this section will describe the low-level operation of the 10Base-T Ethernet peripheral.

20.3.1 Setup

The following steps explain how to set up the network port.

  1. Write the interrupt vector for the interrupt service routine to the external interrupt table.

  2. Select the desired interrupts and interrupt priority by writing to NACSR.

  3. Select the desired network port pin configuration by writing to NAPCR.

  4. Write the device's physical MAC address to the physical address registers (NAPAxR).

  5. Write to the multicast filter registers (NAMFxR) to generate a multicast filter.

  6. Enable the network port transmitter by writing to NATCR.

  7. Enable the network port receiver by writing to NARCR.

20.3.2 Transmit

The following steps explain how to transmit an Ethernet packet.

  1. Set up a DMA buffer descriptor that will read the packet data from memory and write it to NADR. Write the buffer descriptor's address to the DMA's initial address registers (see Chapter 19 for more information).

  2. Enable the DMA transfer by auto-loading the buffer.

  3. The packet transmission will proceed automatically. If any interrupts were enabled for any transmitted packet events, they will occur upon completion (or error).

Note that network interrupts will occur when the data appears in the network peripheral, but DMA interrupts will occur when the DMA transfer is complete.

20.3.3 Receive

The following steps explain how to receive an Ethernet packet.

  1. Set up a DMA buffer descriptor that will read the packet data from NADR and write it to memory. Write the buffer descriptor's address to the DMA's initial address registers (see Chapter 19 for more information).

  2. Enable the DMA transfer by auto-loading the buffer.

  3. The packet transmission will proceed automatically when data comes in. If any interrupts were enabled for any received packet events, they will occur upon completion (or error).

Note that network interrupts will occur when the data appear in the Ethernet peripheral, but DMA interrupts will occur when the DMA transfer is complete.

20.3.4 Handling Interrupts

The network port interrupt is automatically cleared by reading NACSR.

A sample interrupt handler is shown below.

20.3.5 Multicast Addressing

A physical address match requires that the received frame address is a physical address that matches every bit of the programmed receive address. A broadcast address match requires that all 48 bits of the received frame address be "ones." A multicast address match requires the received frame address to be a multicast address (LSB of the address is one) and a match in the multicast address filter. The multicast address filter uses the six most significant bits of the CRC calculated on the receive address as an index into a 64-by-1 bit table written under program control. A one in the corresponding table entry constitutes a multicast address match as far as the network port is concerned. A table of one set of unique multicast addresses corresponding to each filter bit is shown below. The table shows the least significant byte of the multicast address; the remaining five bytes of the address are all zeros for this set of multicast addresses.

Register

Bit 7

Bit 6

Bit 5

Bit 4

Bit 3

Bit 2

Bit 1

Bit 0

NAMF7R
0x17
0x0B
0x05
0x19
0x85
0x99
0x97
0x8B
NAMF6R
0xD9
0xC5
0xCB
0xD7
0x4B
0x57
0x59
0x45
NAMF5R
0xCF
0xD3
0xDD
0xC1
0x5D
0x41
0x4F
0x53
NAMF4R
0x01
0x1D
0x13
0x0F
0x93
0x8F
0x81
0x9D
NAMF3R
0x5F
0x43
0x4D
0x51
0xCD
0xD1
0xDF
0xC3
NAMF2R
0x91
0x8D
0x83
0x9F
0x03
0x1F
0x11
0x0D
NAMF1R
0x87
0x9B
0x95
0x89
0x15
0x09
0x07
0x1B
NAMF0R
0x49
0x55
0x5B
0x47
0xDB
0xC7
0xC9
0xD5


20.4 Ethernet Interface Circuit

This is the recommended circuit for the Rabbit 4000 10Base-T Ethernet interface.


The transmit data output pins consist of two pins for each side of the differential signal. The two pins on each side should be connected through a resistor network as shown to provide proper wave shaping of the outgoing signal.

The receive data input for the network port uses two pins, with the exact definition of the two pins under program control (via NAPCR) according to the table below.

NAPCR[7:5]

RXD+

RXD-

Comment

000
RXD+
RXD-
Normal differential input
010
RXD+
RXVAL
True input with valid-data qualifier
100
RXD+
unused
Single-ended true input data
110
RXD-
unused
Single-ended negative input data
xx1
RXD+
RXVAL
True input with valid-data qualifier;
RXD+ is XORd with NAPCR[7] and RXD- is XORd with NAPCR[6] to provide level inversion


20.5 Register Descriptions

Network Port A Data Register (NADR) (Address = 0x0200)

Bit(s)

Value

Description

7:0
Read
Returns the contents of the receive buffer. This register is not normally accessed by the processor, but is accessed by the DMA channels.
Write
Loads the transmit buffer with a data byte for transmission.


Network Port A Last Data Register (NALDR) (Address = 0x0201)

Bit(s)

Value

Description

7:0
Read
Returns the contents of the receive buffer. This register is not normally accessed by the processor, but is accessed by the DMA.
Write
Loads the transmit buffer with the last data byte of a frame to enable the subsequent transmission of the CRC. The DMA automatically writes the last byte of the frame to this address.


Network Port A Transmit Status Register (NATSR) (Address = 0x0202)

Bit(s)

Value

Description

7:4
0000
Transmitter is disabled or has not yet sent a frame after being enabled.
0xx1
Frame transmission aborted because of a FIFO underrun.
0x1x
Frame transmission aborted because of excessive collisions (16).
01xx
Transmitter is deferring frame transmission.
1000
Frame transmitted without error.
other
All other bit combinations not listed are illegal and will never occur.
3:2
00
These bits are reserved and will always return zeros.
1
0
Frame transmission encountered no collisions.
1
Frame transmission encountered at least one collision.
0
0
Frame transmission encountered no late collisions (later than one slot time).
1
Frame transmission encountered a late collision (later than one slot time).


Network Port A Receive Status Register (NARSR) (Address = 0x0203)

Bit(s)

Value

Description

7:4
0000
Receiver is disabled or has not yet received a frame after being enabled.
0xx1
Frame discarded because of FIFO overrun during reception. The missed-frame counter is incremented by each frame discarded because of a FIFO overrun.
0x1x
Frame discarded because of alignment error. The alignment-error counter is incremented by each frame discarded because of an alignment error.
01xx
Frame discarded because of CRC error. The CRC error counter is incremented by each frame discarded because of a CRC error.
1000
Frame received without error. If the receiver is in monitor mode the missed-frame counter is incremented with each frame received without error.
other
All other bit combinations not listed are illegal and will never occur.
3:2
00
These bits are reserved and will always return zeros.
1:0
00
Received frame had a physical address match.
01
Received frame did not have an address match (promiscuous mode).
10
Received frame had a multicast address match.
11
Received frame had a broadcast address match


Network Port A Control/Status Register (NACSR) (Address = 0x0204)

Bit(s)

Value

Description

7:2
0
The corresponding interrupt is disabled.
(Write-only)
1
The corresponding interrupt is enabled.
7:2
read
These bits, and the network port interrupt, are automatically cleared by a read of this register. The individual interrupt enables are not affected.
7
0
No frame received.
(Read-only)
1
Frame received error-free.
6
0
No error on received frame.
(Read-only)
1
Frame received with error (either CRC error, alignment error or FIFO overflow). Frames received with error are discarded and memory buffer space is reclaimed.
5
0
Frame transmission not complete.
(Read-only)
1
Frame transmitted without error.
4
0
No error on frame transmission.
(Read-only)
1
Frame transmission aborted because of error (either excessive collisions, FIFO underrun, or jabber condition). The memory buffer space is not reclaimed.
3
0
None of the error counters have overflowed.
(Read-only)
1
One or more of the error counters have overflowed. The overflow condition is flagged when one or more of the error counters reaches 080h.
2
0
No link failure or jabber condition.
(Read-only)
1
Either a link status change or jabber condition has been detected.
1:0
00
The Network Port interrupt is disabled.
01
The Network Port uses Interrupt Priority 1.
10
The Network Port uses Interrupt Priority 2.
11
The Network Port uses Interrupt Priority 3.


Network Port A Status Register (NASR) (Address = 0x0205)

Bit(s)

Value

Description

7
This bit is unused.
6
0
Link operating half-duplex.
1
Link operating full-duplex.
5
This bit is unused.
4
0
Auto-negotiation process not completed.
1
Auto-negotiation process completed.
3:2
These bits are unused.
1
0
Link is down.
1
Link is up.
0
0
No jabber condition detected.
1
Jabber condition detected. A jabber condition automatically halts the DMA channel sourcing the data for the transmitter and disables the transmit DMA request. The network port transmitter must be reset to clear this condition.


Network Port A Reset Register (NARR) (Address = 0x0206)

Bit(s)

Value

Description

7
0
No operation.
1
Reset the network port transmitter. This command clears the jabber condition and purges the transmit FIFO. It does not affect a transmit operation in progress and should only be written when the transmitter are disabled and in an idle state.
6
0
No operation.
1
Reset the network port receiver. This command clears all of the error counters and purges the receive FIFO. It does not affect a receive operation in progress and should only be written when the receiver is disabled and in an idle state.
5
0
No operation.
1
Purge the network port transmit FIFO.
4
0
No operation.
1
Purge the network port receive FIFO.
3:0
These bits are ignored and should always be written as zeros.


Network Port A Control Register (NACR) (Address = 0x0207)

Bit(s)

Value

Description

7:6
00
Disable the network port clock.
01
Network port clock from Parallel Port E6.
10
Network port clock from system clock.
11
Network port clock from system clock divided by 2.
5:4
These bits are unused and should be written with zero.
3
0
Normal operation.
1
Restart auto-negotiation process.
2
0
Disable auto-negotiation function.
1
Enable auto-negotiation function.
1
0
Force half-duplex operation. If auto-negotiation is enabled, only half-duplex operation will be advertised.
1
Enable full-duplex operation. If auto-negotiation is disabled, this forces full-duplex operation. If auto-negotiation is enabled, this allows advertising full-duplex capability.
0
This bit is unused and should be written with zero.

Network Port A Pin Control Register (NAPCR) (Address = 0x0208)

(network port clock enabled in NACR)

Bit(s)

Value

Description

7:5
000
RXD+ and RXD- normal operation (differential inputs).
010
RXD+ singled-ended true input. RXD- is the valid-signal qualifier (active high).
100
RXD+ single-ended true input. RXD- not used by receiver.
110
RXD+ single-ended negative input. RXD- not used by receiver.
xx1
RXD+ singled-ended true input. RXD- is the valid-signal qualifier;
RXD+ is XORd with NAPCR[7] and RXD- is XORd with NAPCR[6] to provide level inversion.
4:0
These bits are unused and should be written with zeros.


Network Port A Pin Control Register (NAPCR) (Address = 0x0208)

(network port clock disabled in NACR)

Bit(s)

Value

Description

7:6
These bits are unused and should be written with zero.
5
Read
Current state of TXDD+.
Write
Drive TXDD+ with value.
4
Read
Current state of TXD+.
Write
Drive TXD+ with value.
3
Read
Current state of TXDD-.
Write
Drive TXDD- with value.
2
Read
Current state of TXD-.
Write
Drive TXD- with value.
1
Read
Current state of RXD+.
Write
Ignored.
0
Read
Current state of RXD-.
Write
Ignored.


Network Port A Transmit Control Register (NATCR) (Address = 0x020A)

Bit(s)

Value

Description

7
0
Disable transmitter.
1
Enable transmitter.
6
0
DMA request when FIFO is half empty.
1
DMA request when FIFO is one-fourth empty.
5:0
These bits are reserved and should be written with zeros.


Network Port A Receive Control Register (NARCR) (Address = 0x020B)

Bit(s)

Value

Description

7
0
Disable receiver.
1
Enable receiver.
6
0
DMA request when FIFO is half full.
1
DMA request when FIFO is one-fourth full.
5
0
Normal receiver operation.
1
Place receiver in Monitor mode. Receiver operates normally, but does not buffer frames to memory.
4
0
Receive frames less than 64 bytes in length discarded.
1
Receive frames as short as 8 bytes accepted.
3
0
Receive frames with errors discarded. Reclaim buffer space.
1
Receive frames with errors accepted. Do not reclaim buffer space.
2
0
Receive frames with broadcast address ignored.
1
Receive frames with broadcast address accepted
1
0
Receive frames with multicast addresses ignored.
1
Receive frames with multicast addresses accepted if passing hashing filter.
0
0
Receive frames with mismatched physical addresses are ignored.
1
Receive frames with any physical address accepted. Promiscuous mode.


Network Port A Physical Address x Register (NAPA0R) (Address = 0x0210)
(NAPA1R) (Address = 0x0211)
(NAPA2R) (Address = 0x0212)
(NAPA3R) (Address = 0x0213)
(NAPA4R) (Address = 0x0214)
(NAPA5R) (Address = 0x0215)

Bit(s)

Value

Description

7:0
Write
Byte of physical address for receive address filtering.


Network Port A Multicast Filter x Register (NAMF0R) (Address = 0x0218)
(NAMF1R) (Address = 0x0219)
(NAMF2R) (Address = 0x021A)
(NAMF3R) (Address = 0x021B)
(NAMF4R) (Address = 0x021C)
(NAMF5R) (Address = 0x021D)
(NAMF6R) (Address = 0x021E)
(NAMF7R) (Address = 0x021F)

Bit(s)

Value

Description

7:0
Write
Eight bits of the multicast filter. At the end of a received multicast address, the upper six bits of CRC are used as an index into this 64-bit table. If the corresponding bit is zero, the frame is discarded. If the corresponding bit is one, the frame is accepted.


Network Port A Multicast Hash Register (NAMHR) (Address = 0x0220)

Bit(s)

Value

Description

7:2
read
The latest hash value (the upper six bits of the CRC calculation latched at the end of the destination address field) is returned.
1:0
These bits are unused and will always read as zero.


Network Port A Collision Detect Register (NACDR) (Address = 0x0221)

Bit(s)

Value

Description

7:0
read
The current value of the collision-detect counter is returned. This counter is cleared by a read of this register.


Network Port A Alignment Error Register (NAAER) (Address = 0x0222)

Bit(s)

Value

Description

7:0
read
The current value of the alignment-error counter is returned. This counter is cleared by a read of this register.


Network Port A CRC Error Register (NACER) (Address = 0x0223)

Bit(s)

Value

Description

7:0
read
The current value of the CRC error counter is returned. This counter is cleared by a read of this register.


Network Port A Checksum 0 Register (NAC0R) (Address = 0x0224)

Bit(s)

Value

Description

7:0
read
The LSB of the checksum for the completed frame is returned in this register.


Network Port A Checksum 1 Register (NAC1R) (Address = 0x0225)

Bit(s)

Value

Description

7:0
read
The MSB of the checksum for the completed frame is returned in this register.


Network Port A Missed Frame Register (NAMFR) (Address = 0x0226)

Bit(s)

Value

Description

7:0
read
The current value of the missed-frame counter is returned. This counter is cleared by a read of this register.



Rabbit Semiconductor
www.rabbit.com
PREV INDEX NEXT