Használati útmutató Microchip PIC32MZ2048ECG064

Microchip nincs kategorizálva PIC32MZ2048ECG064

Olvassa el alább 📖 a magyar nyelvű használati útmutatót Microchip PIC32MZ2048ECG064 (96 oldal) a nincs kategorizálva kategóriában. Ezt az útmutatót 4 ember találta hasznosnak és 2 felhasználó értékelte átlagosan 4.5 csillagra

Oldal 1/96
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-1
Section 35. Ethernet Controller
This section of the manual contains the following major topics:
35.1 Introduction .............................................................................................................. 35-2
35.2 Ethernet Controller Overview .................................................................................. 35-3
35.3 Status and Control Registers................................................................................... 35-4
35.4 Operation...............................................................................................................35-43
35.5 Ethernet Interrupts................................................................................................. 35-82
35.6 Operation in Power-Saving and Debug Modes ..................................................... 35-87
35.7 Effects of Various Resets....................................................................................... 35-90
35.8 I/O Pin Control ....................................................................................................... 35-91
35.9 Related Application Notes ..................................................................................... 35-92
35.10 Revision History..................................................................................................... 35-93
PIC32 Family Reference Manual
DS60001155D-page 35-2 © 2009-2017 Microchip Technology Inc.
35.1 INTRODUCTION
The Ethernet Controller is a bus master module that interfaces with an off-chip PHY to implement
a complete Ethernet node in an embedded system.
The following are key features of the Ethernet Controller module:
Supports 10/100 Mbps data transfer rates (see the Caution note in 35.4 “Operation”)
Supports the full-duplex and half-duplex operation
Supports the Reduced Media Independent Interface (RMII) and Media Independent
Interface (MII) PHY interface
Supports the MII Management (MIIM) PHY Management interface
Supports manual and automatic Flow Control
Supports Auto-MDIX and enabled PHYs
RAM descriptor based Direct Memory Access (DMA) operation for receive and transmit
path
Fully configurable interrupts
Configurable receive packet filtering
- Cyclic Redundancy Check (CRC)
- 64-byte pattern match
- Broadcast, multicast, and unicast packets
- Magic Packet™
- 64-bit Hash table
- Runt packet
Supports Packet Payload Checksum calculation
Supports various hardware statistics counters
Note: This family reference manual section is meant to serve as a complement to device
data sheets. Depending on the device variant, this manual section may not apply to
all PIC32 devices.
Please consult the note at the beginning of the “Ethernet Controller” chapter in
the current device data sheet to check whether this document supports the device
you are using.
Device data sheets and family reference manual sections are available for
download from the Microchip Worldwide Web site at: http://www.microchip.com
Note: To avoid cache coherency problems on devices with L1 cache, it is recommended
to access the Ethernet buffers from the KSEG1 segment.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-3
Section 35. Ethernet Controller
35.2 ETHERNET CONTROLLER OVERVIEW
The Ethernet Controller provides the modules needed to implement a 10/100 Mbps Ethernet
node uses an external PHY chip. To offload the CPU from a moving packet data to and from the
module, the internal descriptor based DMA engines are included in the controller.
The Ethernet Controller consists of the following modules:
Media Access Control (MAC) block: This module implements the MAC functions of the
IEEE 802.3
Specification
Flow Control block: This module controls the transmission of PAUSE frames. Reception of
PAUSE frames is handled within the MAC
RX Filter (RXF) block: This module performs filtering on every receive packet to determ ine
whether each packet to be accepted or rejected
TX DMA/TX Buffer Management (BM) Engine: The TX DMA and TX BM engines perform
data transfers from the system memory (using descriptor tables) to the MAC transmit
interface
RX DMA/RX BM Engine: The RX DMA and RX BM engines transfer receive packets from
the MAC to the system memory (using descriptor tables)
Figure 35-1 illustrates the block d iagram of the Ethernet Controller.
Figure 35-1: Ethernet Controller Block Diagram
Note: Refer to the “Ethernet Theory of Operation” (DS01120) for more information on the
Ethernet operation and the IEEE 802.3 Specification (www.ieee.org).
TX Bus
Master
System BUS
RX Bus
Master
TX DMA
TX Flow Control
Host I/F
RX DMA
RX Filter
Checksum
MAC External
PHY
MII/RMII
I/F
MIIM
IF
MAC Control
and
Configuration
Registers
TX Function
RX Function
DMA
Control
Registers
Fast Peripheral Bus
Ethernet Controller
RX Flow
Control
Ethernet DMA
RX BM
TX BM
TX
FIFO
RX
FIFO
PIC32 Family Reference Manual
DS60001155D-page 35-4 © 2009-2017 Microchip Technology Inc.
35.3 STATUS AND CONTROL REGISTERS
The Ethernet Controller module consists of the following Special Function Registers (SFRs):
Controller and DMA Engine Configuration/Status Registers:
ETHCON1: Ethernet Controller Control 1 Register
ETHCON2: Ethernet Controller Control 2 Register
ETHTXST: Ethernet Controller TX Packet Descriptor Start Address Register
ETHRXST: Ethernet Controller RX Packet Descriptor Start Address Register
ETHIEN: Ethernet Controller Interrupt Enable Register
ETHIRQ: Ethernet Controller Interrupt Request Register
ETHSTAT: Ethernet Controller Status Register
RX Filtering Configuration Registers:
ETHRXFC: Ethernet Controller Receive Filter Configuration Register
ETHHT0: Ethernet Controller Hash Table 0 Register
ETHHT1: Ethernet Controller Hash Table 1 Register
ETHPMM0: Ethernet Controller Pattern Match Mask 0 Register
ETHPMM1: Ethernet Controller Pattern Match Mask 1 Register
ETHPMCS: Ethernet Controller Pattern Match Checksum Register
ETHPMO: Ethernet Controller Pattern Match Offset Register
Flow Control Configuring Register:
ETHRXWM: Ethernet Controller Receive Watermarks Register
Ethernet Statistics Registers:
ETHRXOVFLOW: Ethernet Controller Receive Overflow Statistics Register
ETHFRMTXOK: Ethernet Controller Frames Transmitted Okay Statistics Register
ETHSCOLFRM: Ethernet Controller Single Collision Frames Statistics Register
ETHMCOLFRM: Ethernet Controller Multiple Collision Frames Statistics Register
ETHFRMRXOK: Ethernet Controller Frames Received Okay Statistics Register
ETHFCSERR: Ethernet Controller Frame Check Sequence Error Statistics Register
ETHALGNERR: Ethernet Controller Alignment Errors Statistics Register
MAC Configuration Registers:
EMAC1CFG1: Ethernet Controller MAC Configuration 1 Register
EMAC1CFG2: Ethernet Controller MAC Configuration 2 Register
EMAC1IPGT: Ethernet Controller MAC Back-to-Back Interpacket Gap Register
EMAC1IPGR: Ethernet Controller MAC Non-Back-to-Back Interpacket Gap Register
EMAC1CLRT: Ethernet Controller MAC Collision Window/Retry Limit Register
EMAC1MAXF: Ethernet Controller MAC Maximum Frame Length Register
EMAC1SUPP: Ethernet Controller MAC PHY Support Register
EMAC1TEST: Ethernet Controller MAC Test Register
EMAC1SA0: Ethernet Controller MAC Address 0 Register
EMAC1SA1: Ethernet Controller MAC Address 1 Register
EMAC1SA2: Ethernet Controller MAC Address 2 Register
MII Management Registers:
EMAC1MCFG: Ethernet Controller MAC MII Management Configuration Register
EMAC1MCMD: Ethernet Controller MAC MII Management Command Register
EMAC1MADR: Ethernet Controller MAC MII Management Address Register
EMAC1MWTD: Ethernet Controller MAC MII Management Write Data Register
EMAC1MRDD: Ethernet Controller MAC MII Management Read Data Register
EMAC1MIND: Ethernet Controller MAC MII Management Indicators Register
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-5
Table 35-1 provides a summary of the Ethernet Controller registers. Corresponding registers appear
detailed description of each register.
Table 35-1: Ethernet Controller Register Summary
Register
Name
(1)
Bit
Range Bit 31/15 Bit 30/14 Bit 29/13 Bit 28/12 Bit 27/11 Bit 26/10 Bit 25/9 Bit 24/8 Bit 23/7 Bit 22/6 Bit 21/5 Bit Bit 20/4
ETHCON1 31:16 PTV<15:8> PTV<7:0>
15:0 ON SIDL TXRTS RXEN AUTOFC MANFC
ETHCON2 31:16 — — — — — — — —
15:0 — — — — RXBUFSZ<6:4> RXBUFSZ<3:0>
ETHTXST 31:16 TXSTADDR<31:24> TXSTADDR<23
15:0 TXSTADDR<15:8> TXSTADDR<7:2>
ETHRXST 31:16 RXSTADDR<31:24> RXSTADDR<23
15:0 RXSTADDR<15:8> RXSTADDR<7:2>
ETHHT0 31:16 HT<31:24> HT<23:16>
15:0 HT<15:8> HT<7:0>
ETHHT1 31:16 HT<63:56> HT<55:48>
15:0 HT<47:40> HT<39:32>
ETHPMM0 31:16 PMM<31: 24> PMM<23:16
15:0 PMM<15:8> PMM<7:0>
ETHPMM1 31:16 PMM<63:56> PMM<55:48
15:0 PMM<47:40> PMM<39:32
ETHPMCS 31:16 — — — — — — — —
15:0 PMCS<15:8> PMCS<7:0
ETHPMO 31:16 — — — — — — — —
15:0 PMO<15:8> PMO<7:0>
ETHRXFC
31:16 — — — — — — — —
15:0 HTEN MPEN NOTPM PMMODE<3:0> CRC
ERREN CRCOKEN RUNT
ERREN RUNTEN U
ETHRXWM 31:16 — — — — — — RXFWM<7:0
15:0 — — — — — — RXEWM<7:0
ETHIEN
31:16 — — — — — — — —
15:0 TXBUSEIE RXBUSEIE EW
MARKIE
FW
MARKIE
RX
DONEIE
PKT
PENDIE RXACTIE — DO
ETHIRQ
31:16 — — — — — — — —
15:0 TXBUSE RXBUSE EWMARK RXACTFWMARK RXDONE PKTPEND TXD
ETHSTAT 31:16 — — — — — — BUFCNT<7:
15:0 — — — — — — ETHBUSY TXBUSY RXBUSY
ETH
RXOVFLOW
31:16 — —
15:0 RXOVFLWCNT<15:8> RXOVFLWCNT<
Legend: — = unimplemented, read as ‘0’.
Note 1: With the exception of the ETHSTAT register, all registers have an associated Clear, Set, and Invert register at an offset of 0x4, 0x8, and 0xC bytes, respectively.
CLR, SET, or INV appended to the end of the register name (e.g., ETHCON1CLR). Writing a1’ to any bit position in these registers will clear, set, or invert valid
these registers should be ignored.
DS60001155D-page 35-6 © 2009-2017 Microchip Technology Inc.
ETH
FRMTXOK
31:16 — — — — — — — —
15:0 FRMTXOKCNT<15:0>
ETH
SCOLFRM
31:16 — — — — — — — —
15:0 SCOLFRMCNT<15:0>
ETH
MCOLFRM
31:16 — — — — — — — —
15:0 MCOLFRMCNT<15:0>
ETH
FRMRXOK
31:16 — — — — — — — —
15:0 FRMRXOKCNT<15:0>
ETH
FCSERR
31:16 — — — — — — — —
15:0 FCSERRCNT<15:0>
ETH
ALGNERR
31:16 — — — — — — — —
15:0 ALGNERRCNT<15:0>
EMAC1CFG1
31:16 — — — — — — — —
15:0 SOFT
RESET
SIM
RESET RESET
RMCS
RESET
RFUN
RESET
TMCS
RESET
TFUN LOOP
BACK TXP
EMAC1CFG2
31:16 — — — — — — — —
15:0 EXCESS
DFR
BPNO
BKOFF
NO
BKOFF LONGPRE PUREPRE AUTOPAD VLANPAD PAD
ENABLE
CRC
ENABLE
DE
C
EMAC1IPGT 31:16 — — — — — — — —
15:0 — — — — — B2BIPK
EMAC1IPGR 31:16 — — — — — — — —
15:0 NB2BIPKTGP1<6:0> NB2BIPK
EMAC1CLRT 31:16 — — — — — — — —
15:0 — CWINDOW<5:0>
EMAC1MAXF 31:16 — — — — — — — —
15:0 MACMAXF<15:0>
EMAC1SUPP
31:16 — — — — — — — —
15:0 — RESETRMII SPEED
RMII — —
EMAC1TEST
31:16 — — — — — — — —
15:0 — — — — — — — —
EMAC1MCFG
31:16 — — — — — — — —
15:0 RESET
MGMT — — — — — — CLKSEL<3:
EMAC1MCMD 31:16 — — — — — — — —
15:0 — — — — — — — —
EMAC1MADR 31:16 — — — — — — — —
15:0 — PHYADDR<4:0>
Table 35-1: Ethernet Controller Register Summary (Continued)
Register
Name
(1)
Bit
Range Bit 31/15 Bit 30/14 Bit 29/13 Bit 28/12 Bit 27/11 Bit 26/10 Bit 25/9 Bit 24/8 Bit 23/7 Bit 22/6 Bit 21/5 Bit 20/4 Bit
Legend: — = unimplemented, read as ‘0’.
Note 1: With the exception of the ETHSTAT register, all registers have an associated Clear, Set, and Invert register at an offset of 0x4, 0x8, and 0xC bytes, respectively.
CLR, SET, or INV appended to the end of the register name (e.g., ETHCON1CLR). Writing a ‘1’ to any bit position in these registers will clear, set, or invert valid
these registers should be ignored.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-7
EMAC1MWTD 31:16 — — — — —
15:0 MWTD<15:0>
EMAC1MRDD 31:16 — — — — —
15:0 MRDD<15:0>
EMAC1MIND 31:16 — — — — —
15:0 — — — — — LIN
EMAC1SA0 31:16 — — — — —
15:0 STNADDR6<7:0> STNADDR5<7
EMAC1SA1 31:16 — — — — —
15:0 STNADDR4<7:0> STNADDR3<7
EMAC1SA2 31:16 — — — — —
15:0 STNADDR2<7:0> STNADDR1<7
Table 35-1: Ethernet Controller Register Summary (Continued)
Register
Name
(1)
Bit
Range Bit 31/15 Bit 30/14 Bit 29/13 Bit 28/12 Bit 27/11 Bit 26/10 Bit 25/9 Bit 24/8 Bit 23/7 Bit 22/6 Bit 21/5 Bit 20/4 Bit
Legend: — = unimplemented, read as ‘0’.
Note 1: With the exception of the ETHSTAT register, all registers have an associated Clear, Set, and Invert register at an offset of 0x4, 0x8, and 0xC bytes, respectively.
CLR, SET, or INV appended to the end of the register name (e.g., ETHCON1CLR). Writing a ‘1 to any bit position in these registers will clear, set, or invert valid
these registers should be ignored.
PIC32 Family Reference Manual
DS60001155D-page 35-8 © 2009-2017 Microchip Technology Inc.
Register 35-1: ETHCON1: Ethernet Controller Control 1 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PTV<15:8>
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PTV<7:0>
15:8
R/W-0 U-0 R/W-0 U-0 U-0 U-0 R/W-0 R/W-0
ON SIDL TXRTS RXEN
(1)
7:0
R/W-0 U-0 U-0 R/W-0 U-0 U-0 U-0 R/W-0
AUTOFC MANFC — BUFCDEC
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 PTV<15:0>: PAUSE Timer Value bits
This register should be written only when the RXEN bit (ETHCON1<8>) is not set. These bits are only used
for Flow Control operations.
bit 15 ON: Ethernet ON bit
1 = Ethernet module is enabled
0 = Ethernet module is disabled
bit 14 Read as ‘Unimplemented: 0
bit 13 SIDL: Ethernet Stop in Idle Mode bit
1 = Ethernet module transfers are suspended during Idle mode
0 = Ethernet module transfers continue during Idle mode
bit 12-10 Read as ‘Unimplemented: 0
bit 9 TXRTS: Transmit Request to Send bit
1 = Activate the transmit logic and send the packets defined in the TX Ethernet Descriptor Table (EDT)
0 = Stop transmit (when cleared by software) or transmit done (when cleared by hardware)
After the bit is written with a 1 0’, it will clear to whenever the transmit logic has finished transmitting the
requested packets in the EDT. If 0 is written by the CPU, the transmit logic finishes the current packet’s
transmission, and then stops any further transmission.
This bit only affects TX operations.
bit 8 RXEN: Receive Enable bit
(1)
1 = Enable RX logic, packets are received and stored in the RX buffer as controlled by the filter configuration
0 = Disable RX logic, no packets are received in the RX buffer
This bit only affects RX operations.
bit 7 AUTOFC: Automatic Flow Control bit
1 = Automatic Flow Control is enabled
0 = Automatic Flow Control is disabled
Setting this bit will enable the automatic Flow Control. If set, the full and empty watermarks are used to
automatically enable and disable the Flow Control. When the number of received buffers BUFCNT<7:0> bits
(ETHSTAT<23:16>) rises to the full watermark, Flow Control is automatically enabled. When the BUFCNT
falls to the empty watermark, Flow Control is automatically disabled.
This bit is only used for Flow Control operations, and affects both TX and RX operations.
bit 6-5 Unimplemented: Read as ‘0
Note 1: It is not recommended to clear the RXEN bit, and then make changes to any RX related field/register. The
Ethernet Controller must be reinitialized (ON cleared to0’), and then the RX changes applied.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-9
Section 35. Ethernet Controller
bit 4 MANFC: Manual Flow Control bit
1 = Manual Flow Control is enabled
0 = Manual Flow Control is disabled
Setting this bit will enable the manual Flow Control. If set, the Flow Control logic will send a PAUSE frame
using the PTV<15:0> bits (ETHCON1<31:16>). It will then resend a PAUSE frame every 128 * PTV<15:0>/2
TX clock cycles until the bit is cleared.
For 10 Mbps operation, the TX clock runs at 2.5 MHz. For 100 Mbps operation, the TX clock runs at
25 MHz.
When this bit is cleared, the Flow Control logic will automatically send a PAUSE frame with a 0x0000 PAUSE
timer value to disable Flow Control.
This bit is only used for Flow Control operations, and affects both TX and RX operations.
bit 3-1 Unimplemented: Read as ‘0
bit 0 BUFCDEC: Descriptor Buffer Count Decrement bit
The BUFCDEC bit is a write-1 bit that reads out 0’. When written with 1’, the Descriptor Buffer Counter,
BUFCNT, will decrement by one. If the BUFCNT counter is incremented by the RX logic at the same time
that this bit is written, the BUFCNT value will remain unchanged. Writing ‘0 will have no effect.
This bit is only used for RX operations.
Register 35-1: ETHCON1: Ethernet Controller Control 1 Register (Continued)
Note 1: It is not recommended to clear the RXEN bit, and then make changes to any RX related field/register. The
Ethernet Controller must be reinitialized (ON cleared to ‘0’), and then the RX changes applied.
PIC32 Family Reference Manual
DS60001155D-page 35-10 © 2009-2017 Microchip Technology Inc.
Register 35-2: ETHCON2: Ethernet Controller Control 2 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
15:8
U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-0 R/W-0
— — RXBUFSZ<6:4>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 U-0 U-0 U-0 U-0
RXBUFSZ<3:0> — —
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-11 Read as ‘Unimplemented: 0
bit 10-4 RXBUFSZ<6:0>: RX Data Buffer Size for all RX Descriptors (in 16-byte increments) bits
0x7F = RX data Buffer size for descriptors is 2032 bytes
0x60 = RX data Buffer size for descriptors is 1536 bytes
0x03 = RX data Buffer size for descriptors is 48 bytes
0x02 = RX data Buffer size for descriptors is 32 bytes
0x01 = RX data Buffer size for descriptors is 16 bytes
0x00 = Reserved
bit 3-0 Read as ‘Unimplemented: 0
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-11
Section 35. Ethernet Controller
Register 35-3: ETHTXST: Ethernet Controller TX Packet Descriptor Start Address Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
TXSTADDR<31:24>
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
TXSTADDR<23:16>
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
TXSTADDR<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 U-0
TXSTADDR<7:2> — —
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-2 TXSTADDR<31:2>: Starting Address of First Transmit Descriptor bits
This register should not be written while any transmit, receive or DMA operations are in progress.
This address must be 4-byte aligned (i.e., bits 1-0 must be00’).
bit 1-0 Unimplemented: Read as ‘0
Note 1: This register is only used for TX operations.
2: This register will be updated by hardware with the last descriptor used by the last successfully transmitted
packet.
Register 35-4: ETHRXST: Ethernet Controller RX Packet Descriptor Start Address Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
RXSTADDR<31:24>
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
RXSTADDR<23:16>
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
RXSTADDR<15:8>
7:0
R/W-0 R/W-0 U-0 U-0R/W-0 R/W-0 R/W-0 R/W-0
RXSTADDR<7:2> — —
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-2 RXSTADDR<31:2>: Starting Address of First Receive Descriptor bits
This register should not be written while any transmit, receive or DMA operations are in progress.
This address must be 4-byte aligned (i.e., bits 1-0 must be00’).
bit 1-0 Unimplemented: Read as ‘0
Note 1: This register is only used for RX operations.
2: This register will be updated by hardware with the last descriptor used by the last successfully transmitted
packet.
PIC32 Family Reference Manual
DS60001155D-page 35-12 © 2009-2017 Microchip Technology Inc.
Register 35-5: ETHHT0: Ethernet Controller Hash Table 0 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
HT<31:24>
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
HT<23:16>
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
HT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
HT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-0 HT<31:0>: Hash Table Bytes 0-3 bits
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0, or the HTEN bit
(ETHRXFC<15>) = 0.
Register 35-6: ETHHT1: Ethernet Controller Hash Table 1 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0 R/W-0 R/W-0
HT<63:56>
23:16
R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0 R/W-0 R/W-0
HT<55:48>
15:8
R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0 R/W-0 R/W-0
HT<47:40>
7:0
R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0 R/W-0 R/W-0
HT<39:32>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1 = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-0 HT<63:32>: Hash Table Bytes 4-7 bits
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0, or the HTEN bit
(ETHRXFC<15>) .= 0
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-13
Section 35. Ethernet Controller
Register 35-7: ETHPMM0: Ethernet Controller Pattern Match Mask 0 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PMM<31:24>
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PMM<23:16>
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PMM<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PMM<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-24 Pattern Match Mask 3 bitsPMM<31:24>:
bit 23-16 Pattern Match Mask 2 bitsPMM<23:16>:
bit 15-8 PMM<15:8>: Pattern Match Mask 1 bits
bit 7-0 PMM<7:0>: Pattern Match Mask 0 bits
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0, or the PMMODE
<3:0>bits (ETHRXFC<11:8>) = 0.
Register 35-8: ETHPMM1: Ethernet Controller Pattern Match Mask 1 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
PMM<63:56>
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
PMM<55:48>
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
PMM<47:40>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
PMM<39:32>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-24 Pattern Match Mask 7 bitsPMM<63:56>:
bit 23-16 Pattern Match Mask 6 bitsPMM<55:48>:
bit 15-8 Pattern Match Mask 5 bitsPMM<47:40>:
bit 7-0 Pattern Match Mask 4 bitsPMM<39:32>:
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0, or the
PMMODE<3:0> bits (ETHRXFC<11:8>) = 0.
PIC32 Family Reference Manual
DS60001155D-page 35-14 © 2009-2017 Microchip Technology Inc.
Register 35-9: ETHPMCS: Ethernet Controller Pattern Match Checksum Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PMCS<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PMCS<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Read as ‘Unimplemented: 0
bit 15-8 PMCS<15:8>: Pattern Match Checksum 1 bits
bit 7-0 PMCS<7:0>: Pattern Match Checksum 0 bits
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0, or the PMMODE
<3:0>bits (ETHRXFC<11:8>) = 0.
Register 35-10: ETHPMO: Ethernet Controller Pattern Match Offset Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
PMO<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
PMO<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Read as ‘Unimplemented: 0
bit 15-0 PMO<15:0>: Pattern Match Offset 1 bits
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0, or the PMMODE
<3:0>bits (ETHRXFC<11:8>) = 0.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-15
Section 35. Ethernet Controller
Register 35-11: ETHRXFC: Ethernet Controller Receive Filter Configuration Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
15:8
R/W-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
HTEN MPEN NOTPM PMMODE<3:0>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CRCERREN CRCOKEN RUNTERREN RUNTEN UCEN NOTMEEN MCEN BCEN
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1 = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15 HTEN: Enable Hash Table Filtering bit
1 = Enable Hash table filtering
0 = Disable Hash table filtering
bit 14 MPEN: Magic Packet™ Enable bit
1 = Enable Magic Packet filtering
0 = Disable Magic Packet filtering
bit 13 Unimplemented: Read as ‘0
bit 12 NOTPM: Pattern Match Inversion bit
1 = The pattern match checksum must not match for a successful pattern match to occur
0 = The pattern match checksum must match for a successful pattern match to occur
This bit determines whether Pattern Match Checksum must match for a successful pattern match to occur.
bit 11-8 PMMODE<3:0>: Pattern Match Mode bits
1001 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Packet = Magic Packet)
(1,3)
1000 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Hash Table Filter match)
(1,2)
0111 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Destination Address = Broadcast Address)
(1)
0110 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Destination Address = Broadcast Address)
(1)
0101 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Destination Address = Unicast Address)
(1)
0100 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Destination Address = Unicast Address)
(1)
0011 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Destination Address = Station Address)
(1)
0010 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches) AND
(Destination Address = Station Address)
(1)
0001 = Pattern match is successful if (NOTPM = 1 XOR Pattern Match Checksum matches)
(3)
0000 = Pattern Match is disabled; pattern match is always unsuccessful
Note 1: XOR = True when either one or the other conditions are true, but not both.
2: This Hash Table Filter match is active regardless of the value of the HTEN bit.
3: This Magic Packet Filter match is active regardless of the value of the MPEN bit.
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0.
PIC32 Family Reference Manual
DS60001155D-page 35-16 © 2009-2017 Microchip Technology Inc.
bit 7 CRCERREN: CRC Error Collection Enable bit
1 = The received packet CRC must be invalid for the packet to be accepted
0 = Disable CRC Error Collection filtering
This bit allows the user to collect all packets that have an invalid CRC.
bit 6 CRCOKEN: CRC Okay Enable bit
1 = The received packet CRC must be valid for the packet to be accepted
0 = Disable CRC filtering
This bit allows the user to reject all packets that have an invalid CRC.
bit 5 RUNTERREN: Runt Error Collection Enable bit
1 = The received packet must be a runt packet for the packet to be accepted
0 = Disable Runt Error Collection filtering
This bit allows the user to collect all packets that are runt packets. For this filter, a runt packet is defined as
any packet with a size of less than 64 bytes (when CRCOKEN = 0) or any packet with a size of less than
64 bytes that has a valid CRC (when CRCOKEN = 1).
bit 4 RUNTEN: Runt Enable bit
1 = The received packet must not be a runt packet for the packet to be accepted
0 = Disable runt filtering
This bit allows the user to reject all runt packets. For this filter, a runt packet is defined as any packet with a
size of less than 64 bytes.
bit 3 UCEN: Unicast Enable bit
1 = Enable unicast filtering
0 = Disable unicast filtering
This bit allows the user to accept all unicast packets whose Destination Address matches the Station
Address.
bit 2 NOTMEEN: Not Me Unicast Enable bit
1 = Enable not-me unicast filtering
0 = Disable not-me unicast filtering
This bit allows the user to accept all unicast packets whose Destination Address does not match the
Station Address.
bit 1 MCEN: Multicast Enable bit
1 = Enable multicast filtering
0 = Disable multicast filtering
This bit allows the user to accept all Multicast Address packets.
bit 0 BCEN: Broadcast Enable bit
1 = Enable broadcast filtering
0 = Disable broadcast filtering
This bit allows the user to accept all Broadcast Address packets.
Register 35-11: ETHRXFC: Ethernet Controller Receive Filter Configuration Register
(Continued)
Note 1: XOR = True when either one or the other conditions are true, but not both.
2: This Hash Table Filter match is active regardless of the value of the HTEN bit.
3: This Magic Packet Filter match is active regardless of the value of the MPEN bit.
Note 1: This register is only used for RX operations.
2: The bits in this register may be changed only when the RXEN bit (ETHCON1<8>) = 0.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-17
Section 35. Ethernet Controller
Register 35-12: ETHRXWM: Ethernet Controller Receive Watermarks Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
RXFWM<7:0>
15:8
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
RXEWM<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-24 Unimplemented: Read as 0
bit 23-16 RXFWM<7:0>: Receive Full Watermark bits
The software controlled RX Buffer Full Watermark Pointer is compared against the RX BUFCNT to deter-
mine the full watermark condition for the FWMARK interrupt and for enabling Flow Control when automatic
Flow Control is enabled. The Full Watermark Pointer should be greater than the Empty Watermark Pointer.
bit 15-8 Unimplemented: Read as 0
bit 7-0 RXEWM<7:0>: Receive Empty Watermark bits
The software controlled RX Buffer Empty Watermark Pointer is compared against the RX BUFCNT to
determine the empty watermark condition for the EWMARK interrupt and for disabling Flow Control when
automatic Flow Control is enabled. The Empty Watermark Pointer should be less than the Full Watermark
Pointer.
Note: This register is only used for RX operations .
PIC32 Family Reference Manual
DS60001155D-page 35-18 © 2009-2017 Microchip Technology Inc.
Register 35-13: ETHIEN: Ethernet Controller Interrupt Enable Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — —
15:8
U-0 R/W-0 R/W-0 U-0 U-0 U-0 R/W-0 R/W-0
— TXBUSEIE
(1)
RXBUSEIE
(2)
— EWMARKIE
(2)
FWMARKIE
(2)
7:0
R/W-0 R/W-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0
RXDONEIE
(2)
PKTPENDIE
(2)
RXACTIE — TXDONEIE
(1)
TXABORTIE
(1)
RXBUFNAIE
(2)
RXOVFLWIE
(2)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR 1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-15 Unimplemented: Read as 0
bit 14 TXBUSEIE: Transmit BVCI Bus Error Interrupt Enable bit
(1)
1 = Enable TXBUS error interrupt
0 = Disable TXBUS error interrupt
bit 13 RXBUSEIE: Receive BVCI Bus Error Interrupt Enable bit
(2)
1 = Enable RXBUS error interrupt
0 = Disable RXBUS error interrupt
bit 12-10 Unimplemented: Read as 0
bit 9 EWMARKIE: Empty Watermark Interrupt Enable bit
(2)
1 = Enable EWMARK interrupt
0 = Disable EWMARK interrupt
bit 8 FWMARKIE: Full Watermark Interrupt Enable bit
(2)
1 = Enable FWMARK interrupt
0 = Disable FWMARK interrupt
bit 7 Receiver Done Interrupt Enable bitRXDONEIE:
(2)
1 = Enable RXDONE interrupt
0 = Disable RXDONE interrupt
bit 6 PKTPENDIE: Packet Pending Interrupt Enable bit
(2)
1 = Enable PKTPEND interrupt
0 = Disable PKTPEND interrupt
bit 5 RXACTIE: RX Activity Interrupt Enable bit
1 = Enable RXACT interrupt
0 = Disable RXACT interrupt
bit 4 Unimplemented: Read as 0
bit 3 TXDONEIE: Transmitter Done Interrupt Enable bit
(1)
1 = Enable TXDONE interrupt
0 = Disable TXDONE interrupt
bit 2 TXABORTIE: Transmitter Abort Interrupt Enable bit
(1)
1 = Enable TXABORT interrupt
0 = Disable TXABORT interrupt
bit 1 RXBUFNAIE: Receive Buffer Not Available Interrupt Enable bit
(2)
1 = Enable RXBUFNA interrupt
0 = Disable RXBUFNA interrupt
bit 0 RXOVFLWIE: Receive FIFO Overflow Interrupt Enable bit
(2)
1 = Enable RXOVFLW interrupt
0 = Disable RXOVFLW interrupt
Note 1: This bit is only used for TX operations.
2: This bit is only used for RX operations.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-19
Section 35. Ethernet Controller
Register 35-14: ETHIRQ: Ethernet Controller Interrupt Request Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
15:8
U-0 R/W-0 R/W-0 U-0 U-0 U-0 R/W-0 R/W-0
— TXBUSE
(1)
RXBUSE
(2)
— EWMARK
(2)
FWMARK
(2)
7:0
R/W-0 R/W-0 R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0
RXDONE
(2)
PKTPEND
(2)
RXACT
(2)
— TXDONE
(1)
TXABORT
(1)
RXBUFNA
(2)
RXOVFLW
(2)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-15 Unimplemented: Read as ‘0
bit 14 TXBUSE: Transmit BVCI Bus Error Interrupt bit
(1)
1 = BVCI bus error occurred
0 = No BVCI error occurred
This bit is set when the TX DMA encounters a BVCI bus error during a system memory access. It is cleared
by either a Reset or CPU write of a ‘1 to the CLR register.
bit 13 RXBUSE: Receive BVCI Bus Error Interrupt bit
(2)
1 = BVCI bus error occurred
0 = No BVC error occurred
This bit is set when the RX DMA encounters a BVCI bus error during a system memory access. It is cleared
by either a Reset or CPU write of a ‘1 to the CLR register.
bit 12-10 Unimplemented: Read as ‘0
bit 9 EWMARK: Empty Watermark Interrupt bit
(2)
1 = Empty Watermark pointer reached
0 = No interrupt pending
This bit is set when the RX Descriptor Buffer Count is less than or equal to the value in the RXEWM
<7:0>bits (ETHRXWM<7:0>). It is cleared by the BUFCNT<7:0> bits (ETHSTAT<23:16>) being
incremented by hardware. Writing a ‘0 or a ‘1 has no effect.
bit 8 FWMARK: Full Watermark Interrupt bit
(2)
1 = Full Watermark pointer reached
0 = No interrupt pending
This bit is set when the RX Descriptor Buffer Count is greater than or equal to the value in the
RXFWM<7:0> bits (ETHRXWM<23:16>). It is cleared by writing the BUFCDEC bit (ETHCON1<0>) to dec-
rement the BUFCNT counter. Writing a ‘0 or a ‘1 has no effect.
bit 7 RXDONE: Receive Done Interrupt bit
(2)
1 = RX packet was successfully received
0 = No interrupt pending
This bit is set whenever a RX packet is successfully received. It is cleared by either a Reset or CPU write of
a ‘1 to the CLR register.
Note 1: This bit is only used for TX operations.
2: This bit is only used for RX operations.
Note: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should be done only for debug/test purposes.
PIC32 Family Reference Manual
DS60001155D-page 35-20 © 2009-2017 Microchip Technology Inc.
bit 6 PKTPEND: Packet Pending Interrupt bit
(2)
1 = Received packet pending in memory
0 = No receive packet is pending in memory
This bit is set when the BUFCNT counter has a value other than ‘0’. It is cleared by either a Reset or by
writing the BUFCDEC bit (ETHCON1<0>) to decrement the BUFCNT counter. Writing a ‘0’ or a ‘1 has no
effect.
bit 5 RXACT: Receive Activity Interrupt bit
(2)
1 = RX packet data was successfully received
0 = No interrupt pending
This bit is set whenever RX packet data is stored in the RX BM FIFO. It is cleared by either a Reset or CPU
write of a1 to the CLR register.
bit 4 Unimplemented: Read as ‘0
bit 3 TXDONE: Transmit Done Interrupt bit
(1)
1 = TX packet successfully sent
0 = No interrupt pending
This bit is set when the currently transmitted TX packet completes transmission, and the Transmit Status
Vector is loaded into the first descriptor used for the packet. It is cleared by either a Reset or CPU write of a
1 to the CLR register.
bit 2 TXABORT: Transmit Abort Condition Interrupt bit
(1)
1 = TX abort condition occurred on the last TX packet
0 = No interrupt pending
This bit is set when the MAC aborts the transmission of a TX packet for one of the following reasons:
Jumbo TX packet abort
Underrun abort
Excessive defer abort
Late collision abort
Excessive collisions abort
This bit is cleared by a Reset or a CPU write of a ‘1 to the CLR register.
bit 1 RXBUFNA: Receive Buffer Not Available Interrupt bit
(2)
1 = RX Buffer Descriptor Not Available condition occurred
0 = No interrupt pending
This bit is set by a RX Buffer Descriptor Overrun condition. It is cleared by a Reset or a CPU write of a ‘1 to
the CLR register.
bit 0 RXOVFLW: Receive FIFO Over Flow Error bit
(2)
1 = RX FIFO Overflow Error condition occurred
0 = No interrupt pending
RXOVFLW is set by the RX BM Logic for an RX FIFO Overflow condition. It is cleared by a Reset or a CPU
write of a1 to the CLR register.
Register 35-14: ETHIRQ: Ethernet Controller Interrupt Request Register
(Continued)
Note 1: This bit is only used for TX operations.
2: This bit is only used for RX operations.
Note: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should be done only for debug/test purposes.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-21
Section 35. Ethernet Controller
Register 35-15: ETHSTAT: Ethernet Controller Status Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
23:16
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
BUFCNT<7:0>
(1)
15:8
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
7:0
R/W-0 R/W-0 R/W-0 U-0 U-0 U-0 U-0 U-0
ETHBUSY
(4)
TXBUSY
(2,5)
RXBUSY
(3,5)
— — — —
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-24 Unimplemented: Read as ‘0
bit 23-16 BUFCNT<7:0>: Packet Buffer Count bits
(1)
Number of packet buffers received in memory. Once a packet has been successfully received, this register
is incremented by hardware based on the number of descriptors used by the packet. Software decrements
the counter (by writing to the BUFCDEC bit (ETHCON1<0>) for each descriptor used) after a packet has
been read out of the buffer. The register does not roll over (0xFF to 0x00) when hardware tries to increment
the register and the register is already at 0xFF. Conversely, the register does not roll under (0x00 to 0xFF)
when software tries to decrement the register and the register is already at 0x0000. When software attempts
to decrement the counter at the same time that the hardware attempts to increment the counter, the counter
value will remain unchanged.
When this register value reaches 0xFF, the RX logic will halt (only if automatic Flow Control is enabled)
awaiting software to write the BUFCDEC bit to decrement the register below 0xFF.
If Auto Flow Control is disabled, the RXDMA will continue processing and the BUFCNT will saturate at a
value of 0xFF.
When this register is non-zero, the PKTPEND status bit will be set and an interrupt may be generated,
depending on the value of the PKTPENDIE bit (ETHIEN<6>).
When the ETHRXST register is written, the BUFCNT counter is automatically cleared to 0x00.
Note: BUFCNT will NOT be cleared when ON is set to ‘0’. This enables software to continue to utilize
and decrement this count.
bit 15-8 Unimplemented: Read as ‘0
bit 7 ETHBUSY: Ethernet Module busy bit
(4)
1 = Ethernet logic has been turned on (ON (ETHCON1<15>) = 1) or is completing a transaction
0 = Ethernet logic is idle
This bit indicates that the Ethernet module has been turned on or is completing a transaction after being
turned off.
Note 1: These bits are only used for RX operations.
2: This bit is only affected by TX operations.
3: This bit is only affected by RX operations.
4: This bit will be set when the ON bit (ETHCON1<15>) = 1.
5: This bit will be cleared when the ON bit (ETHCON1<15>) = 0.
PIC32 Family Reference Manual
DS60001155D-page 35-22 © 2009-2017 Microchip Technology Inc.
bit 6 TXBUSY: Transmit Busy bit
(2, 5)
1 = TX logic is receiving data
0 = TX logic is idle
This bit indicates that a packet is currently being transmitted. A change in this status bit is not necessarily
reflected by the TXDONE interrupt, as TX packets may be aborted or rejected by the MAC.
bit 5 RXBUSY: Receive Busy bit
(3, 5)
1 = RX logic is receiving data
0 = RX logic is idle
This bit indicates that a packet is currently being received. A change in this status bit is not necessarily
reflected by the RXDONE interrupt, as RX packets may be aborted or rejected by the RX filter.
bit 4-0 Unimplemented: Read as 0
Register 35-15: ETHSTAT: Ethernet Controller Status Register (Continued)
Note 1: These bits are only used for RX operations.
2: This bit is only affected by TX operations.
3: This bit is only affected by RX operations.
4: This bit will be set when the ON bit (ETHCON1<15>) = 1.
5: This bit will be cleared when the ON bit (ETHCON1<15>) = 0.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-23
Section 35. Ethernet Controller
Register 35-16: ETHRXOVFLOW: Ethernet Controller Receive Overflow Statistics Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
RXOVFLWCNT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
RXOVFLWCNT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as 0
bit 15-0 RXOVFLWCNT<15:0>: Dropped Receive Frames Count bits
Increment counter for frames accepted by the RX filter and subsequently dropped due to internal receive
error (RXFIFO overrun). This event also sets the RXOVFLW bit (ETHIRQ<0>) interrupt flag.
Note 1: This register is only used for RX operations.
2: This register is automatically cleared by hardware after a read operation, unless the byte enables for
bytes 0/1 are0’.
3: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should only be done for debug/test purposes.
Register 35-17: ETHFRMTXOK: Ethernet Controller Frames Transmitted Okay Statistics Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
FRMTXOKCNT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
FRMTXOKCNT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as 0
bit 15-0 FRMTXOKCNT<15:0>: Frame Transmitted Okay Count bits
Increment counter for frames successfully transmitted.
Note 1: This register is only used for TX operations.
2: This register is automatically cleared by hardware after a read operation, unless the byte enables for
bytes 0/1 are0’.
3: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should only be done for debug/test purposes.
PIC32 Family Reference Manual
DS60001155D-page 35-24 © 2009-2017 Microchip Technology Inc.
Register 35-18: ETHSCOLFRM: Ethernet Controller Single Collision Frames Statistics Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
SCOLFRMCNT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
SCOLFRMCNT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Read as ‘Unimplemented: 0
bit 15-0 SCOLFRMCNT<15:0>: Single Collision Frame Count bits
Increment count for frames that were successfully transmitted on the second try.
Note 1: This register is only used for TX operations.
2: This register is automatically cleared by hardware after a read operation, unless the byte enables for
bytes 0/1 are ‘0’.
3: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should only be done for debug/test purposes.
Register 35-19: ETHMCOLFRM: Ethernet Controller Multiple Collision Frames Statistics Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0
MCOLFRMCNT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0
MCOLFRMCNT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1 = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-0 MCOLFRMCNT<15:0>: Multiple Collision Frame Count bits
Increment count for frames that were successfully transmitted after there was more than one collision.
Note 1: This register is only used for TX operations.
2: This register is automatically cleared by hardware after a read operation, unless the byte enables for
bytes 0/1 are ‘0’.
3: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should only be done for debug/test purposes.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-25
Section 35. Ethernet Controller
Register 35-20: ETHFRMRXOK: Ethernet Controller Frames Received Okay Statistics Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
FRMRXOKCNT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
FRMRXOKCNT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-0 FRMRXOKCNT<15:0>: Frames Received Okay Count bits
Increment count for frames received successfully by the RX Filter. This count will not be incremented if
there is a Frame Check Sequence (FCS) or Alignment error.
Note 1: This register is only used for RX operations.
2: This register is automatically cleared by hardware after a read operation, unless the byte enables for
bytes 0/1 are0’.
3: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should only be done for debug/test purposes.
Register 35-21: ETHFCSERR: Ethernet Controller Frame Check Sequence Error Statistics Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
FCSERRCNT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
FCSERRCNT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-0 FCSERRCNT<15:0>: FCS Error Count bits
Increment count for frames received with FCS error and the frame length in bits is an integral multiple of
eight bits.
Note 1: This register is only used for RX operations.
2: This register is automatically cleared by hardware after a read operation, unless the byte enables for
bytes 0/1 are ‘0’.
3: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should only be done for debug/test purposes.
PIC32 Family Reference Manual
DS60001155D-page 35-26 © 2009-2017 Microchip Technology Inc.
Register 35-22: ETHALGNERR: Ethernet Controller Alignment Errors Statistics Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
ALGNERRCNT<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
ALGNERRCNT<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-0 Alignment Error Count bitsALGNERRCNT<15:0>:
Increment count for frames with alignment errors. Note that an alignment error is a frame that has an FCS
error and the frame length in bits is not an integral multiple of eight bits (also known as, dribble nibble).
Note 1: This register is only used for RX operations.
2: This register is automatically cleared by hardware after a read operation, unless the byte enables for
bytes 0/1 are ‘0’.
3: It is recommended to use the SET, CLR, or INV registers to set or clear any bit in this register. Setting or
clearing any bits in this register should only be done for debug/test purposes.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-27
Section 35. Ethernet Controller
Register 35-23: EMAC1CFG1: Ethernet Controller MAC Configuration 1 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
15:8
R/W-1 R/W-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0
SOFTRESET SIMRESET RESETRMCS RESETRFUN RESETTMCS RESETTFUN
7:0
U-0 U-0 U-0 R/W-0 R/W-1 R/W-1 R/W-0 R/W-1
LOOPBACK TXPAUSE RXPAUSE PASSALL RXENABLE
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0 = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15 SOFTRESET: Soft Reset bit
Setting this bit will put the MACMII in Reset. Its default value is ‘1’.
bit 14 SIMRESET: Simulation Reset bit
Setting this bit will cause a Reset to the random number generator within the Transmit Function.
bit 13-12 Unimplemented: Read as ‘0
bit 11 RESETRMCS: Reset MCS/RX bit
Setting this bit will put the MAC Control Sub-layer/Receive domain logic in Reset.
bit 10 RESETRFUN: Reset RX Function bit
Setting this bit will put the MAC Receive function logic in Reset.
bit 9 RESETTMCS: Reset MCS/TX bit
Setting this bit will put the MAC Control Sub-layer/TX domain logic in Reset.
bit 8 RESETTFUN: Reset TX Function bit
Setting this bit will put the MAC Transmit function logic in Reset.
bit 7-5 Unimplemented: Read as ‘0
bit 4 LOOPBACK: MAC Loopback mode bit
1 = MAC Transmit interface is loop backed to the MAC Receive interface
0 = MAC normal operation
bit 3 TXPAUSE: MAC TX Flow Control bit
1 = PAUSE Flow Control frames are allowed to be transmitted
0 = PAUSE Flow Control frames are blocked
bit 2 RXPAUSE: MAC RX Flow Control bit
1 = The MAC acts upon received PAUSE Flow Control frames
0 = Received PAUSE Flow Control frames are ignored
bit 1 PASSALL: MAC Pass all Receive Frames bit
1 = The MAC will accept all frames regardless of type (Normal vs. Control)
0 = The received Control frames are ignored
bit 0 RXENABLE: MAC Receive Enable bit
1 = Enable the MAC receiving of frames
0 = Disable the MAC receiving of frames
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
PIC32 Family Reference Manual
DS60001155D-page 35-28 © 2009-2017 Microchip Technology Inc.
Register 35-24: EMAC1CFG2: Ethernet Controller MAC Configuration 2 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
25/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
15:8
U-0 R/W-1 R/W-0 R/W-0 U-0 U-0 R/W-0 R/W-0
EXCESSDFR BPNOBKOFF NOBKOFF LONGPRE PUREPRE
7:0
R/W-1 R/W-0 R/W-1 R/W-1 R/W-0 R/W-0 R/W-1 R/W-0
AUTOPAD
(1,2)
VLANPAD
(1,2)
PADENABLE
(1,3)
CRCENABLE DELAYCRC HUGEFRM LENGTHCK FULLDPLX
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-15 Unimplemented: Read as ‘0
bit 14 EXCESSDFR: Excess Defer bit
1 = The MAC will defer to carrier indefinitely as per the IEEE 802.3 Specification standard
0 = The MAC will abort when the excessive deferral limit is reached
bit 13 BPNOBKOFF: Back-pressure/No Back-off bit
1 = The MAC after incidentally causing a collision during back-pressure will immediately retransmit without
back-off reducing the chance of further collisions and ensuring transmit packets get sent
0 = The MAC will not remove the back-off
bit 12 NOBKOFF: No Back-off bit
1 = Following a collision, the MAC will immediately retransmit rather than using the Binary Exponential
Back-off algorithm as specified in the IEEE 802.3 Specification standard
0 = Following a collision, the MAC will use the Binary Exponential Back-off algorithm
bit 11-10 Unimplemented: Read as ‘0
bit 9 LONGPRE: Long Preamble Enforcement bit
1 = The MAC only allows receive packets that contain preamble fields less than 12 bytes in length
0 = The MAC allows any length preamble as per the IEEE 802.3 Specification standard
bit 8 PUREPRE: Pure Preamble Enforcement bit
1 = The MAC will verify the content of the preamble to ensure it contains 0x55 and is error-free. A packet with
errors in its preamble is discarded
0 = The MAC does not perform any preamble checking
bit 7 AUTOPAD: Auto Detect Pad Enable bit
(1,2)
1 = The MAC will automatically detect the type of frame, either tagged or untagged, by comparing the two
bytes following the source address with 0x8100 (VLAN Protocol ID) and pad accordingly
0 = The MAC does not perform auto detection
bit 6 VLANPAD: VLAN Pad Enable bit
(1,2)
1 = The MAC will pad all short frames to 64 bytes and append a valid CRC
0 = The MAC does not perform padding of short frames
Note 1: This bit is ignored, if the PADENABLE bit is cleared.
2: This bit is used in conjunction with the AUTOPAD and VLANPAD bits.
3: Table 35-2 provides a description of the pad function based on the configuration of this register.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-29
Section 35. Ethernet Controller
Table 35-2: Pad Operation
bit 5 PADENABLE: Pad/CRC Enable bit
(1,3)
1 = The MAC will pad all short frames
0 = The frames presented to the MAC have a valid length
bit 4 CRCENABLE: CRC Enable1 bit
1 = The MAC will append a CRC to every frame whether padding was required or not. Must be set if the
PADENABLE bit is set
0 = The frames presented to the MAC have a valid CRC
bit 3 DELAYCRC: Delayed CRC bit
This bit determines the number of bytes, if any, of proprietary header information that exist on the front of the
IEEE 802.3 frames.
1 = Four bytes of header (ignored by the CRC function)
0 = No proprietary header
bit 2 HUGEFRM: Huge Frame enable bit
1 = Frames of any length are transmitted and received
0 = Huge frames are not allowed for receive or transmit
bit 1 LENGTHCK: Frame Length checking bit
1 = Both transmit and receive frame lengths are compared to the Length/Type field. If the Length/Type field
represents a length then the check is performed. Mismatches are reported on the Transmit/Receive
Statistics Vector
0 = Length/Type field check is not performed
bit 0 FULLDPLX: Full-Duplex Operation bit
1 = The MAC operates in Full-Duplex mode
0 = The MAC operates in Half-Duplex mode
Type AUTOPAD VLANPAD PADENABLE Action
Any x x 0 No pad, check CRC
Any 0 0 1 Pad to 60 Bytes, append CRC
Any x 1 1 Pad to 64 Bytes, append CRC
Any 1 0 1 If untagged: Pad to 60 Bytes, append CRC
If VLAN tagged: Pad to 64 Bytes, append CRC
Register 35-24: EMAC1CFG2: Ethernet Controller MAC Configuration 2 Register
(Continued)
Note 1: This bit is ignored, if the PADENABLE bit is cleared.
2: This bit is used in conjunction with the AUTOPAD and VLANPAD bits.
3: Table 35-2 provides a description of the pad function based on the configuration of this register.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
PIC32 Family Reference Manual
DS60001155D-page 35-30 © 2009-2017 Microchip Technology Inc.
Register 35-25: EMAC1IPGT: Ethernet Controller MAC Back-to-Back Interpacket Gap Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
7:0
U-0 R/W-0 R/W-0 R/W-1 R/W-0 R/W-0 R/W-1 R/W-0
— B2BIPKTGP<6:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-7 Unimplemented: Read as 0
bit 6-0 B2BIPKTGP<6:0>: Back-to-Back Interpacket Gap bits
This is a programmable field representing the nibble time offset of the minimum possible period between
the end of any transmitted packet to the beginning of the next.
In Full-Duplex mode, the register value should be the desired period in nibble times minus 3.
In Half-Duplex mode, the register value should be the desired period in nibble times minus 6.
In Full-Duplex mode, the recommended setting is 0x15 (21d), which represents the minimum IPG of
0.96 µs (in 100 Mbps) or 9.6 µs (in 10 Mbps).
In Half-Duplex mode, the recommended setting is 0x12 (18d), which represents the minimum IPG of 0.96
µs (in 100 Mbps) or 9.6 µs (in 10 Mbps).
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-31
Section 35. Ethernet Controller
Register 35-26: EMAC1IPGR: Ethernet Controller MAC Non-Back-to-Back Interpacket Gap Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
U-0 R/W-0 R/W-0 R/W-0 R/W-1 R/W-1 R/W-0 R/W-0
— NB2BIPKTGP1<6:0>
7:0
U-0 R/W-0 R/W-0 R/W-1 R/W-0 R/W-0 R/W-1 R/W-0
— NB2BIPKTGP2<6:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-15 Unimplemented: Read as0
bit 14-8 NB2BIPKTGP1<6:0>: Non-Back-to-Back Interpacket Gap Part 1 bits
This is a programmable field representing the optional Carrier Sense window referenced in
Section 4.2.3.2.1 “Deference of the IEEE 802.3 Specification.
If Carrier is detected during the timing of IPGR1, the MAC defers to Carrier. If, however, Carrier becomes
after IPGR1, the MAC continues timing IPGR2 and transmits, knowingly causing a collision, thus ensuring
fair access to medium. Its range of values is 0x0 to IPGR2. Its recommend value is 0xC (12d).
bit 7 Unimplemented: Read as0
bit 6-0 NB2BIPKTGP2<6:0>: Non-Back-to-Back Interpacket Gap Part 2 bits
This is a programmable field representing the non-back-to-back Inter-Packet-Gap. Its recommended value
is 0x12 (18d), which represents the minimum IPG of 0.96 µs (in 100 Mbps) or 9.6 µs (in 10 Mbps).
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
PIC32 Family Reference Manual
DS60001155D-page 35-32 © 2009-2017 Microchip Technology Inc.
Register 35-27: EMAC1CLRT: Ethernet Controller MAC Collision Window/Retry Limit Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
U-0 U-0 R/W-1 R/W-1 R/W-0 R/W-1 R/W-1 R/W-1
— — CWINDOW<5:0>
7:0
U-0 U-0 U-0 U-0 R/W-1 R/W-1 R/W-1 R/W-1
— — — RETX<3:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-14 Unimplemented: Read as ‘0
bit 13-8 CWINDOW<5:0>: Collision Window bits
This is a programmable field representing the slot time or collision window during which collisions occur in
properly configured networks. Since the collision window starts at the beginning of transmission, the
preamble and SFD is included. Its default of 0x37 (55d) corresponds to the count of frame bytes at the end
of the window.
bit 7-4 Unimplemented: Read as ‘0
bit 3-0 RETX<3:0>: Retransmission Maximum bits
This is a programmable field specifying the number of retransmission attempts following a collision before
aborting the packet due to excessive collisions. The IEEE 802.3 Specification standard specifies the
maximum number of attempts (attemptLimit) to be 0xF (15d). Its default is ‘0xF’.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-33
Section 35. Ethernet Controller
Register 35-28: EMAC1MAXF: Ethernet Controller MAC Maximum Frame Length Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-1 R/W-0 R/W-1
MACMAXF<15:8>
7:0
R/W-1 R/W-1 R/W-1 R/W-0 R/W-1 R/W-1 R/W-1 R/W-0
MACMAXF<7:0>
(1)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-0 MACMAXF<15:0>: Maximum Frame Length bits
(1)
This field resets to 0x05EE, which represents a maximum receive frame of 1518 bytes. An untagged
maximum size Ethernet frame is 1518 bytes. A tagged frame adds four bytes for a total of 1522 bytes. If a
shorter/longer maximum length restriction is desired, program this 16-bit field.
Note 1: If a proprietary header is allowed, this field should be adjusted accordingly. For example, if 4-byte headers
are prepended to frames, MACMAXF could be set to 1527 bytes. This would allow the maximum VLAN
tagged frame plus the 4-byte header.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
PIC32 Family Reference Manual
DS60001155D-page 35-34 © 2009-2017 Microchip Technology Inc.
Register 35-29: EMAC1SUPP: Ethernet Controller MAC PHY Support Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
U-0 U-0 U-0 U-0 R/W-0 U-0 U-0 R/W-0
RESETRMII — SPEEDRMII
7:0
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1 = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-12 Read as ‘Unimplemented: 0
bit 11 RESETRMII: Reset RMII Logic bit
1 = Reset the MAC RMII module
0 = Normal Operation.
bit 10-9 Read as ‘Unimplemented: 0
bit 8 SPEEDRMII: RMII Speed bit
This bit configures the Reduced MII logic for the current operating speed.
1 = RMII running in 100 Mbps
0 = RMII running in 10 Mbps
bit 7-0 Read as ‘Unimplemented: 0
Note 1: Both 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed.
8-bit accesses are not allowed and are ignored by hardware.
2: The bits in this register are only used for the RMII module.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-35
Section 35. Ethernet Controller
Register 35-30: EMAC1TEST: Ethernet Controller MAC Test Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
7:0
U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-0 R/W-0
— — — — TESTBP TESTPAUSE SHRTQNTA
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-3 Unimplemented: Read as ‘0
bit 2 TESTBP: Test Back-pressure bit
1 = The MAC will assert back-pressure on the link. Back-pressure causes preamble to be transmitted, raising
Carrier Sense. A transmit packet from the system will be sent during back-pressure.
0 = Normal Operation
bit 1 TESTPAUSE: Test PAUSE bit
1 = The MAC Control sub-layer will inhibit transmissions, just as if a PAUSE Receive Control frame with a
non-zero pause time parameter was received
0 = Normal Operation
bit 0 SHRTQNTA: Shortcut PAUSE Quanta bit
1 = The MAC reduces the effective PAUSE Quanta from 64 byte-times to 1 byte-time
0 = Normal Operation
Note 1: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
2: The bits in this register are only used for testing.
PIC32 Family Reference Manual
DS60001155D-page 35-36 © 2009-2017 Microchip Technology Inc.
Table 35-3: MIIM Clock Selection
Register 35-31: EMAC1MCFG: Ethernet Controller MAC MII Management Configuration Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
15:8
R/W-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
RESETMGMT —
7:0
U-0 U-0 R/W-1 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CLKSEL<3:0> NOPRE SCANINC
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as 0
bit 15 RESETMGMT: Test Reset MII Management bit
1 = Reset the MII Management module
0 = Normal Operation
bit 14-6 Unimplemented: Read as ‘0
bit 5-2 CLKSEL<3:0>: MII Management Clock Select 1 bits
(2)
This field is used by the clock divide logic in creating the MII Management Clock (MDC), which the
IEEE 802.3 Specification defines to be no faster than 2.5 MHz. Some PHYs support clock rates up to
12.5 MHz.
bit 1 NOPRE: Suppress Preamble bit
1 = The MII Management will perform read/write cycles without the 32-bit preamble field. Some PHYs
support suppressed preamble
0 = Normal read/write cycles are performed
bit 0 SCANINC: Scan Increment bit
1 = The MII Management module will perform read cycles across a range of PHYs. The read cycles will start
from address 1 through the value set in EMAC1MADR<PHYADDR>
0 = Continuous reads of the same PHY
Note 1: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
2: Table 35-3 provides a description of the clock divider encoding.
MIIM Clock Select EMAC1MCFG<5:2>
SYSCLK divided by 4 000x
SYSCLK divided by 6 0010
SYSCLK divided by 8 0011
SYSCLK divided by 10 0100
SYSCLK divided by 14 0101
SYSCLK divided by 20 0110
SYSCLK divided by 28 0111
SYSCLK divided by 40 1000
Undefined Any other combination
Note: SYSCLK is the CPU clock.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-37
Section 35. Ethernet Controller
Register 35-32: EMAC1MCMD: Ethernet Controller MAC MII Management Command Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
15:8
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
7:0
U-0 U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-0
— — — — — — SCAN READ
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-2 Unimplemented: Read as ‘0
bit 1 SCAN: MII Management Scan Mode bit
1 = The MII Management module will perform read cycles continuously (for example, useful for monitoring
the Link Fail)
0 = Normal Operation
bit 0 READ: MII Management Read Command bit
1 = The MII Management module will perform a single read cycle. The read data is returned in the
EMAC1MRDD register
0 = The MII Management module will perform a write cycle. The write data is taken from the EMAC1MWTD
register
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
PIC32 Family Reference Manual
DS60001155D-page 35-38 © 2009-2017 Microchip Technology Inc.
Register 35-33: EMAC1MADR: Ethernet Controller MAC MII Management Address Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — —
15:8
U-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-1
— — PHYADDR<4:0>
7:0
U-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
— — REGADDR<4:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-13 Unimplemented: Read as ‘0
bit 12-8 PHYADDR<4:0>: MII Management PHY Address bits
This field represents the 5-bit PHY Address field of Management cycles. Up to 31 PHYs can be addressed
(0 is reserved).
bit 7-5 Unimplemented: Read as ‘0
bit 4-0 REGADDR<4:0>: MII Management Register Address bits
This field represents the 5-bit Register Address field of Management cycles. Up to 32 registers can be
accessed.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-39
Section 35. Ethernet Controller
Register 35-34: EMAC1MWTD: Ethernet Controller MAC MII Management Write Data Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
MWTD<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
MWTD<7:0>
Legend:
R = Readable bit W = Writable bit P = Programmable bit r = Reserved bit
U = Unimplemented bit -n = Bit Value at POR: (‘0’, ‘1’, x = Unknown)
bit 31-16 Unimplemented: Read as’0
bit 15-0 MWTD<15:0>: MII Management Write Data bits
When written, a MII Management write cycle is performed using the 16-bit data and the preconfigured
PHY and Register addresses from the EMAC1MADR register.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
Register 35-35: EMAC1MRDD: Ethernet Controller MAC MII Management Read Data Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
MRDD<15:8>
7:0
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0R/W-0 R/W-0
MRDD<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-0 MRDD<15:0>: MII Management Read Data bits
Following a MII Management Read Cycle, the 16-bit data can be read from this location.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
PIC32 Family Reference Manual
DS60001155D-page 35-40 © 2009-2017 Microchip Technology Inc.
Register 35-36: EMAC1MIND: Ethernet Controller MAC MII Management Indicators Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
15:8
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— — — — —
7:0
U-0 U-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0
LINKFAIL NOTVALID SCAN MIIMBUSY
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1 = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-4 Unimplemented: Read as ‘0
bit 3 LINKFAIL: Link Fail bit
When ‘1 is returned - indicates link fail has occurred. This bit reflects the value last read from the PHY
status register.
bit 2 NOTVALID: MII Management Read Data Not Valid bit
When ‘1 is returned - indicates an MII management read cycle has not completed and the Read Data is not
yet valid.
bit 1 SCAN: MII Management Scanning bit
When ‘1 is returned - indicates a scan operation (continuous MII Management Read cycles) is in progress.
bit 0 MIIMBUSY: MII Management Busy bit
When ‘1 is returned - indicates MII Management module is currently performing an MII Management Read
or Write cycle.
Note: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-41
Section 35. Ethernet Controller
Register 35-37: EMAC1SA0: Ethernet Controller MAC Address 0 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— —
15:8
R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P
STNADDR6<7:0>
7:0
R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P
STNADDR5<7:0>
Legend: P = Programmable bit
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-8 STNADDR6<7:0>: Station Address Sixth Byte bits
This field holds the sixth transmitted byte of the station address.
bit 7-0 STNADDR5<7:0>: Station Address Fifth Byte bits
This field holds the fifth transmitted byte of the station address.
Note 1: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
2: This register is loaded at reset from the factory preprogrammed station address.
Register 35-38: EMAC1SA1: Ethernet Controller MAC Address 1 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— ——————
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
— ——————
15:8
R/W-P R/W-PR/W-P R/W-P R/W-P R/W-P R/W-P R/W-P
STNADDR4<7:0>
7:0
R/W-P R/W-PR/W-P R/W-P R/W-P R/W-P R/W-P R/W-P
STNADDR3<7:0>
Legend: P = Programmable bit
R = Readable bit W = Writable bit U = Unimplemented bit, read as0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Unimplemented: Read as ‘0
bit 15-8 STNADDR4<7:0>: Station Address Fourth Byte bits
This field holds the fourth transmitted byte of the station address.
bit 7-0 STNADDR3<7:0>: Station Address Third Byte bits
This field holds the third transmitted byte of the station address.
Note 1: Both 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed.
8-bit accesses are not allowed and are ignored by hardware.
2: This register is loaded at reset from the factory preprogrammed station address.
PIC32 Family Reference Manual
DS60001155D-page 35-42 © 2009-2017 Microchip Technology Inc.
Register 35-39: EMAC1SA2: Ethernet Controller MAC Address 2 Register
Bit
Range
Bit
31/23/15/7
Bit
30/22/14/6
Bit
29/21/13/5
Bit
28/20/12/4
Bit
27/19/11/3
Bit
26/18/10/2
Bit
25/17/9/1
Bit
24/16/8/0
31:24
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
————————
23:16
U-0 U-0 U-0 U-0 U-0 U-0 U-0 U-0
————————
15:8
R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P
STNADDR2<7:0>
7:0
R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P R/W-P
STNADDR1<7:0>
Legend: P = Programmable bit
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 31-16 Reserved: Maintain as ‘0’; ignore read
bit 15-8 STNADDR2<7:0>: Station Address Second Byte bits
This field holds the second transmitted byte of the station address.
bit 7-0 STNADDR1<7:0>: Station Address First Byte bits
This field holds the most significant (first transmitted) byte of the station address.
Note 1: 16-bit and 32-bit accesses to this register (including the Set, Clear and Invert registers) are allowed. 8-bit
accesses are not allowed and are ignored by hardware.
2: This register is loaded at reset from the factory preprogrammed station address.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-43
Section 35. Ethernet Controller
35.4 OPERATION
The Ethernet Controller provides the system modules needed to implement a 10/100 Mbps
Ethernet node using an external PHY chip. To offload the CPU from moving packet data to and
from the module, two internal descriptor-based DMA engines are included in the
Ethernet Controller.
The Ethernet Controller module consists of the following sub-modules:
10/100 Megabit Media Access Controller (MAC):
This controller implements the MAC sub-layer of the Data Link Layer, and performs the
CSMA/CD function contained in the ISO/IEC 8802-3 and the IEEE 802.3 specifications,
which includes:
- MII to connect to an external PHY
- RMII to connect to an external PHY
- MII Management block that provides control/status connection to the external PHY
- Performs the receive path Flow Control functions contained in Annex 31B of the IEEE
802.3 Specification
- Implements the MAC Transmit and MAC Receive interfaces that connect with the TX
and RX DMA engines.
Flow Control:
Responsible for control of the transmission of PAUSE frames, as defined in Annex 31B of
the IEEE 802.3 Specification
RX Filter (RXF):
This block performs multiple filters on every receive packet to determine whether each
packet should be accepted or rejected.
TX DMA/TX BM Engine:
The TX DMA engine and TX BM engine perform data transfers from the packet buffers to
the MAC Transmit Interface, and also transfers the Transmit Status Vector (TSV) from the
MAC to the packet buffers once the transmission is complete. It operates using the TX
Descriptor tables.
RX DMA/RX BM Engine:
The RX DMA engine and RX BM engine transfer receive packets and the Receive Status
Vector (RSV) from the MAC to the packet buffers using the RX Descriptor tables.
CAUTION
The Ethernet Controller requires a minimum clock frequency to be able to sustain 100
Mbps traffic. Currently, this frequency must be at least 40 MHz for PIC32MX/PIC3MZ
devices. This is a minimum value, and depending on the system bus load, the actual
running frequency may need to be higher than this. If this condition is not satisfied,
data loss will occur, resulting in RX FIFO Overflow or TXABORT conditions.
PIC32 Family Reference Manual
DS60001155D-page 35-44 © 2009-2017 Microchip Technology Inc.
35.4.1 Ethernet Frame Overview
IEEE 802.3-compliant Ethernet frames (packets) are between 64 bytes and 1518 bytes long
(Preamble and Start-of-Frame (SOF) Delimiter not included). Frames containing less
than 64 bytes are known as Runt frames, while frames containing more than 1518 bytes are
known as Huge frames.
An Ethernet frame is made up of the following fields:
• Start-of-Stream/Preamble
Start-of-Frame Delimiter (SFD)
Destination MAC address (DA)
Source MAC address (SA)
Type/Length field
Data Payload
Optional Padding field
Frame Check Sequence (FCS)
Figure 35-2 illustrates the traffic on the actual physical cable. Refer to the IEEE 802.3
Specification for detailed information about the Ethernet protocol.
Figure 35-2: Ethernet Frame Format
35.4.1.1 START OF STREAM/PREAMBLE AND START-OF-FRAME DELIMITER
When transmitted on the Ethernet medium, the Start-of-Stream/Preamble and the SFD fields are
appended to the beginning of an Ethernet frame automatically by the MAC.
When receiving, these fields are automatically stripped from the received frames so that these
fields are not written into the RX data buffers. The software does not need to process/generate
these fields.
Filtered out by the module
Start of-Frame Delimiter
(filtered out by the module)
Destination address such as:
Multicast, Broadcast, or Unicast
Source Address
Type of packet or the length
Packet Payload
(with optional padding)
Frame Check Sequence – CRC
Start-of-Stream/
Preamble
SFD
DA
SA
Type/Length
Data
Padding
FCS
7
1
6
6
2
46-1500
4
Used in the
calculation of
FCS
Number of Bytes Field Comments
of the packet
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-45
Section 35. Ethernet Controller
35.4.1.2 DESTINATION MAC ADDRESS
A MAC address is a 6-byte number representing the physical address of the node(s) on an
Ethernet network. The destination address contains the MAC address of the device for which the
frame is intended. There are different types of addresses in the Ethernet space.
For example,
Unicast Address: Designated for usage by the addressed node only. A Unicast address is
an address where the Least Significant bit (LSb) in the first byte of the address is zero (i.e.,
the first byte of the address is even). For example, 00 04 a3 00 00 01 is a Unicast address,
but 01 04 a3 00 00 01 is not a Unicast address.
Multicast Address: Designated for use by a selected group of Ethernet nodes. A Multicast
address is an address where the LSb in the first byte of this address is set (i.e., the byte is
odd). For example, 01 04 a3 00 00 01 is a Multicast address. The Multicast address,
FF-FF-FF-FF-FF-FF, is reserved (Broadcast address) and is directed to all nodes on the
network.
The Ethernet Controller incorporates the Receive Filter module that can be configured to accept
or discard Unicast, Multicast and Broadcast frames. For more information on the receive filters,
refer to 35.4.8 “Receive Filtering Overview”.
35.4.1.3 SOURCE MAC ADDRESS
The source address is the 6-byte field MAC address of the node that transmitted the Ethernet
frame. Every Ethernet device must have a globally unique MAC address. Each PIC32 including
an Ethernet Controller has a unique address, which is loaded into the MAC registers on
power-up. This value can be used as is, or the registers may be reconfigured with a different
address at run time by modifying the EMAC1SA0, EMAC1SA1, and EMAC1SA2 registers.
35.4.1.4 TYPE/LENGTH
This is a 2-byte field indicating the protocol to which the frame belongs. Applications using
standards such as Internet Protocol (IP) or Address Resolution Protocol (ARP), should use the
type code specified in the specific standards document. Alternately, this field can be used as a
length field when the user is implementing proprietary network protocols. Typically, any value of
1500 (0x05DC) or smaller, is considered to be a length field and specifies the amount of
non-padding data, which follows in the data field.
35.4.1.5 DATA
The data field typically consists of between 0 byte and 1500 bytes of payload data for each frame.
PIC32 devices are capable of transmitting and receiving frames larger than this when the Huge
Frame Enable bit (HUGEFRM) in the Ethernet Controller MAC Configuration 2 Register
(EMAC1CFG2<2>) is set. However, these larger frames that do not meet the IEEE 802.3
Specification will likely be dropped by most Ethernet nodes.
35.4.1.6 PADDING
The padding field is a variable length field appended to meet the IEEE 802.3 Specification
requirements when transmitting small data payloads. The minimum payload for an Ethernet
frame is 46 bytes. Smaller frames must be padded to fill this space. For transmitted frames, the
software can instruct the Ethernet Controller to automatically generate the required padding by
using the Pad/CRC Enable bit, PADENABLE (EMAC1CFG2<5>), the VLAN Pad Enable bit,
VLANPAD (EMAC1CFG2<6>), and the Auto Detect Pad Enable bit,
AUTOPAD (EMAC1CFG2<7>). However, if the auto-padding is not enabled and the application
does not provide appropriate padding, the PIC32 device will not prevent the transmission of
these “runt” frames. When receiving frames, PIC32 devices accept and write all padding to the
receive buffer. Frames shorter than the required 64 bytes can optionally be filtered by the Runt
Error Reject filter, as described in 35.4.8.4 “Runt Rejection Filter”.
PIC32 Family Reference Manual
DS60001155D-page 35-46 © 2009-2017 Microchip Technology Inc.
35.4.1.7 FRAME CHECK SEQUENCE
The Frame Check Sequence (FCS) is a 4-byte field containing a standard 32-bit CRC calculated
over the Destination, Source, Type/Length, Data, and Padding fields. It allows for the detection
of transmission errors.
For transmitted frames, PIC32 devices can automatically generate and append a valid Flow
Control by using the CRC Enable1 bit, CRCENABLE (EMAC1CFG2<4>). Otherwise, the
software must calculate the CRC for the frame to be transmitted and append it properly.
For received frames, the FCS field is stored to the receive buffer. Frames with invalid CRC values
can either be discarded or accepted using the CRC Error and CRC Check Acceptance filters
described in 35.4.8.1 “CRC Error Acceptance Filter” and 35.4.8.3 “CRC Check Acceptance
Filter”.
Note: The polynomial for generating the FCS is:
G(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 +x4 + p46-x2 + x + 1.
The FCS is transmitted starting with bit 31 and ending with bit 0.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-47
Section 35. Ethernet Controller
35.4.2 Basic Ethernet Controller Operation
The Ethernet Controller is enabled by setting the Ethernet ON bit in the Ethernet Controller
Control 1 Register (ETHCON1<15>), and is disabled by resetting the same bit. This is the default
state after any Reset. If the Ethernet Controller is disabled, all of the I/O pins used for the
MII/RMII and MIIM interfaces operate as port pins, and are under the control of the respective
PORT latch bit and TRIS bit.
Disabling the controller resets the internal DMA state machines, and all transmit and receive
operations are aborted. The SFRs are still accessible and their values preserved.
Clearing the ON bit while the Ethernet Controller is active will abort all pending operations and
reset the peripheral, as defined above.
Re-enabling the ON bit will restart the Ethernet Controller in its clean reset state while preserving
the SFRs values.
35.4.3 MAC Overview
The MAC sub-layer is part of the functionality described in the Open Systems
Interconnection (OSI) model for the Data Link Layer. It defines a medium independent facility,
built on the medium dependent physical facility provided by the Physical Layer, and under the
access-layer-independent LLC sub-layer or other MAC client. It is applicable to a general class
of local area broadcast media suitable for use with the Carrier Sense Multiple Access with
Collision Detection (CSMA/CD).
The CSMA/CD MAC sub-layer provides services to the MAC client required for the transmission
and reception of frames. The CSMA/CD MAC sub-layer makes best effort to acquire the medium,
and transfer a serial stream of bits to the Physical Layer. Although, certain errors are reported to
the client, error recovery is not provided by the MAC.
The following is a summary of the functional capabilities of the CSMA/CD MAC sub-layer, see
Figure 35-3:
For Frame transmission:
- Accepts data from the MAC client and constructs a frame
- Presents a bit-serial data stream to the Physical Layer for transmission on the medium
- In Half-Duplex mode, defers transmission of a bit-serial stream whenever the physical
medium is busy
- It can append proper FCS value to outgoing frames and verifies full byte boundary
alignment
- Delays transmission of frame bit-stream for specified Interframe Gap (IFG) period
- In Half-Duplex mode, halts transmission when collision is detected
- In Half-Duplex mode, schedules retransmission after a collision until a specified retry
limit is reached
- In Half-Duplex mode, enforces collision to ensure propagation throughout network by
sending jam message
- Adds preamble and Start-of-Frame Delimiter and appends FCS to all frame
- Appends PAD field for frames whose data length is less than the minimum value
Note 1: If the ON bit is cleared during an active internal bus transaction, the controller will
complete the current bus transaction before entering the disabled state. Once the
controller is disabled, the Transmit Busy bit (TXBUSY) in the Ethernet Controller
Status Register (ETHSTAT<6>) and the Receive Busy bit, RXBUSY
(ETHSTAT<5>), will reflect an inactive status.
2: Whenever the Ethernet Controller is reset through the ON bit, the software should
also reset the external PHY using the MIIM interface. This ensures the PHY is in a
known initialized state. In addition, the MAC should also be soft reset through the
Ethernet Controller MAC Configuration 1 Register (EMAC1CFG1).
PIC32 Family Reference Manual
DS60001155D-page 35-48 © 2009-2017 Microchip Technology Inc.
For Frame reception:
- Receives a bit-serial data stream from the Physical Layer
- Presents the received frames to the MAC client (broadcast, multicast, unicast frames,
and so on)
- Checks incoming frames for transmission errors by way of FCS, and verifies byte
boundary alignment
- Removes preamble, Start-of-Frame Delimiter and PAD field (if necessary) from the
received frames
- Implements the MII Management block that provides control/status connection to the
external PHY
Figure 35-3: CSMA/CD Media Access Control Functions
The MAC is accessed using Register 35-23 through Register 35-30 and Register 35-37 through
Register 35-39 SFRs.
Note: Refer to Clause 2, Clause 3, and Clause 4 of the IEEE 802.3 Specification for a
detailed explanation of the MAC sub-layer functions and operation.
Physical Layer Signaling
Receive
Data Decoding
Transmit
Data Encoding
Access to Physical Interface
Receive Media
Access Management
Transmit Media
Access Management
Transmit
Data Encapsulation
Receive
Data Decapsulation
Access to MAC Client
MAC Client Sub-Layer
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-49
Section 35. Ethernet Controller
35.4.4 Media Independent Interface
The Media Independent Interface (MII) is a standard interconnection between the MAC and the
PHY for communicating TX and RX frame data.
The MII has the following important characteristics:
Capable of supporting 10/100 Mbps rates for data transfer, and offers support for
management functions
Provides independent four bit wide transmit and receive data paths
Uses Transistor-Transistor Logic (TTL) signal levels, compatible with common digital
Complementary Metal-oxide Semiconductor (CMOS) processes
Provides Full-Duplex operation
In 10 Mbps mode, the MII runs at 2.5 MHz; in 100 Mbps mode, it runs at 25 MHz. PHYs that
provide MII are not required to support both data rates, and may support either one or both.
Table 35-4 provides a list of the 18 MII signals.
Table 35-4: MII Signals
Signal
Name
IEEE
802.3 MII
Signals
Width Type Description
ETXCLK TX_CLK 1 Input The transmit clock signal is a continuous clock that provides the timing
reference for the transfer of the ETXEN, ETXD and ETXERR signals from
the MAC to the PHY. The ETXCLK frequency is a quarter of the nominal
transmit data rate. A PHY operating at 100 Mbps must provide a ETXCLK
frequency of 25 MHz, and a PHY operating at 10 Mbps must provide a
ETXCLK frequency of 2.5 MHz.
ERXCLK RX_CLK 1 Input The receive clock signal is a continuous clock that provides the timing
reference for the transfer of the ERXDV, RXD and ERXERR signals from
the PHY to the MAC. ERXCLK has a frequency equal to a quarter of the
data rate of the received signal.
ETXEN TX_EN 1 Output The transmit enable signal indicates that the MAC is presenting nibbles on
the MII for transmission. ETXEN transitions synchronously with respect to
ETXCLK.
ETXD<3:0> TXD<3:0> 4 Output The transmit data signals transition synchronously with respect to the
ETXCLK.
ETXERR TX_ER 1 Output The transmit coding error signal is synchronous with respect to the
ETXCLK. When ETXERR is asserted for one or more ETXCLK periods
while ETXEN is also asserted, the PHY will emit one or more symbols that
are not part of the valid data or delimiter set somewhere in the frame being
transmitted. This signal only affects 100 Mbps data transmission.
ERXDV RX_DV 1 Input The receive data valid signal indicates that the PHY is presenting
recovered and decoded nibbles on the RXD data lines. ERXDV is
synchronous with ERXCLK. ERXDV remains asserted for the entire frame.
ERXD<3:0> RXD<3:0> 4 Input The receive data signals represents the four data signals synchronous
with respect to ERXCLK. For each ERXCLK period in which ERXDV is
asserted, RXD<3:0> transfers four bits of recovered data from the PHY to
the MAC.
ERXERR RX_ER 1 Input The receive error signal is asserted to indicate to the MAC that a coding
error (or any error that the PHY is capable of detecting) has occurred in
the frame being transferred from the PHY to the MAC. ERXERR is
synchronous with ERXCLK.
ECRS CRS 1 Input The Carrier Sense signal is asserted by the PHY when either the transmit
or receive medium is non idle. Carrier Sense (CRS) will be deasserted by
the PHY when both the transmit and receive media are idle. The CRS
remains asserted throughout the d uration of a collision condition. It does
not have to be synchronous with either the ETXCLK or the ERXCLK.
PIC32 Family Reference Manual
DS60001155D-page 35-50 © 2009-2017 Microchip Technology Inc.
Refer to Clause 22 of the IEEE 802.3 Specification for detailed MII specifications.
Figure 35-4 illustrates a typical MII connection between the PIC32 and the external PHY.
Figure 35-4: PIC32 to External PHY Typical MII Connection
ECOL COL 1 Input The collision detected signal is asserted by the PHY upon detection of a
collision on the medium, and remains asserted while the collision condition
persists. It does not have to be synchronous with respect to either
ETXCLK or ERXCLK.
EMDC MDC 1 Output The management data clock signal is part of the MII Management
interface, and is explained in 35.4.6 “Media Independent Interface
Management (MIIM)”.
EMDIO MDIO 1 Input/
Output
The management data input/output signal is part of the MII Management
interface, and is explained in 35.4.6 “Media Independent Interface
Management (MIIM)”.
Table 35-4: MII Signals (Continued)
Signal
Name
IEEE
802.3 MII
Signals
Width Type Description
PIC32 with
Ethernet Controller
MII
External PHY
EMDC
EMDIO
MII
Management
Interface
ETXCLK
ERXCLK
ETXEN
ETXD<3:0>
ETXERR
ERXDV
ERXD<3:0>
ERXERR
ECRS
ECOL
Media
Independent
Interface
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-51
Section 35. Ethernet Controller
35.4.5 Reduced Media Independent Interface (RMII)
The management interface (MDIO/MDC) is assumed to be identical to that defined in MII.
The RMII has the following characteristics:
Capable of supporting 10 Mbps and 100 Mbps data rates
Single clock reference for both MAC and the PHY (can be sourced from the MAC or from
an external source)
Provides independent two bit wide transmit and receive data paths
Uses TTL signal levels, compatible with common digital CMOS processes
Provides Full-Duplex operation
The interface runs at 50 MHz. Table 35-5 provides a list of the 10 Reduced Media Independent
Interface (RMII) signals.
Table 35-5: RMII Signals
Signal
Name
IEEE 802.3
RMII Signals Width Type Description
EREFCLK REF_CLK 1 Input The reference clock signal is a continuous clock that provides the
timing reference for ECRSDV, RXD<1:0>, ETXEN, ETXD<1:0> and
ERXERR. EREFCLK is a 50 MHz clock signal sourced by the MAC or
an external source. For PIC32 devices, the EREFCLK is an external
supplied clock signal.
ECRSDV CRS_DV 1 Input The Carrier Sense/Receive Data Valid signal is asserted by the PHY
when the receive medium is non idle. ECRSDV is asserted
asynchronously on detection of carrier. Loss of carrier results in the
deassertion of ECRSDV synchronous to the REF_CLK (only on nibble
boundaries). The data on RXD<1:0> is considered valid once
ECRSDV is asserted. Using the ECRSDV the MAC can accurately
recover ERXDV and CRS. If ERXERR is asserted while ECRSDV is
asserted, the frame will be rejected. If the ECRSDV is not asserted,
the ERXERR is ignored.
ERXD<1:0> RXD<1:0> 2 Input The receive data signals transition synchronously to EREFCLK. For
each clock period in which ECRSDV is asserted, ERXD transfers two
bits of recovered data from the PHY.
ERXD is ‘00 to indicate the idle condition when ECRSDV is
deasserted. Since the use of the PHY signal ERXERR is optional,
in order to ensure the propagation of errors for the received
signal, the ERXD replaces the data in the decoded stream with
01 so that the MAC CRC mechanism will reject the frame.
In 100 Mbps ERXD is synchronous to the EREFCLK
In 10 Mbps the ERXD is sampled every tenth cycle
ETXEN TX_EN 1 Output The transmit enable signal indicates that the MAC is presenting di-bits
on ETXD<1:0> for transmission. ETXEN is asserted with the first
nibble of the preamble and remains asserted while all di-bits are
transmitted. ETXEN is synchronous with respect to EREFCLK.
ETXD<1:0> TXD<1:0> 2 Output The transmit data signal is transmits data to the PHY when ETXEN is
asserted. The ETXD data lines transition synchronously with respect
to EREFCLK. ETXD uses the value of ‘00 to signal idle when the
ETXEN is deasserted.
In 100 Mbps mode, ETXD provides valid data for each EREFCLK
period while ETXEN is asserted
In 10 Mbps mode since the EREFCLK frequency is 10 times the
data rate the value on ETXD is sampled every tenth cycle
PIC32 Family Reference Manual
DS60001155D-page 35-52 © 2009-2017 Microchip Technology Inc.
Figure 35-5 illustrates a typical RMII connection between the PIC32 and the external PHY.
Figure 35-5: PIC32 to External PHY Typical RMII Connection
ERXERR RX_ER 1 Input The receive error signal is asserted for one or more EREFCLK periods
to indicate that an error was detected somewhere in the frame
presently being transferred from the PHY. The ERXERR is
synchronous with respect to EREFCLK.
EMDC MDC 1 Output The management data clock signal is part of the MII Management
interface and is explained in
35.4.6 “Media Independent Interface
Management (MIIM)”.
EMDIO MDIO 1 Input/
Output
The management data input/output signal is part of the MII
Management interface and is explained in
35.4.6 “Media
Independent Interface Management (MIIM)”.
Table 35-5: RMII Signals (Continued)
Signal
Name
IEEE 802.3
RMII Signals Width Type Description
PIC32 with
Ethernet Controller
RMII
External PHY
E MDC
EMDIO
RMII
Management
Interface
EREFCLK
ETXEN
ETXD<1:0>
ERXD<1:0>
ERXERR
ECRSDV
Reduced
Media
Independent
Interface
External ClockSource
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-53
Section 35. Ethernet Controller
35.4.6 Media Independent Interface Management (MIIM)
The Media Independent Interface Management (MIIM) module provides a serial communication
link between the PIC32 host and an external MII PHY device. The external serial
communications link operates in accordance with Clause 22 of the IEEE 802.3 Specification.
The MIIM input/output signals are:
Management Data Clock (MDC) – MDC is sourced by the MAC to the PHY as the timing
reference for transfer of information on the MDIO signal.
Management Data Input/Output (MDIO) – MDIO is a bidirectional signal between the PHY
and the MAC. It is used to transfer control information and status between the PHY and the
MAC. Control information is driven by the MAC synchronously with respect to MDC and is
sampled synchronously by the PHY. Status information is driven by the PHY synchronously
with respect to MDC and is sampled synchronously by the MAC.
The communication over the MIIM interface takes place in frames. Frames transmitted on the
MIIM have the following structure (see Table 35-6):
Preamble: At the beginning of each transaction, the MAC sends a sequence of 32 logic one
bits on MDIO to provide the PHY with a synchronization pattern.
SOF: The SOF is indicated by a <01> pattern
Operation Code: <10> for a read transaction, <01> for a write transaction
PHY Address: Five bits, allowing 32 unique PHY addresses. A PHY will always respond to
transactions with address zero.
Register Address: Five bits, allowing 32 individual registers to be addressed within each PHY
Turnaround: A 2-bit-time spacing between the Register Address field and the Data field of a
management frame to avoid contention during a read transaction.
Data: This 16-bit field carries the data to/from the addressed PHY register
Table 35-6: MIIM Frame Format
As indicated previously, the size of an MIIM frame is 64 bits. However, the MIIM module may be
configured to suppress the preamble portion of the MII Management serial stream using the
Suppress Preamble bit (NOPRE) in the Ethernet Controller MAC MII Management Configuration
Register (EMAC1MCFG<1>), when the PHY supports a suppressed preamble operation.
Refer to Clause 22 in the IEEE 802.3 Specification for more information on MIIM.
35.4.6.1 EXTERNAL PHY REGISTER ACCESS
The PHY registers provide configuration and control of the PHY module, and status information
about its operation. Unlike the on-chip SFRs, the PHY registers are not directly accessible
through the SFR control interface. Instead, access is accomplished through a special set of MAC
control registers that implement the Media Independent Interface Management. These control
registers are referred to as the MIIM registers. The PHY registers are accessed through the MIIM
interface of the MAC. To do this, the MII Management Command, Address, and Data registers in
the MAC must be used.
The registers that control access to the PHY registers are listed in Table 35-1, and include
Register 35-31 through Register 35-36.
Note: The Idle condition on MDIO is a high-impedance state.
Operation
Management Frame Fields
PRE PHYADST OPCODE REGAD TA DATA IDLE
READ 1….1 01 10 a0…a4 d0….d15r0…r4 Z0 Z
WRITE 1….1 01 01 a0…a4 d0….d15r0…r4 10 Z
PIC32 Family Reference Manual
DS60001155D-page 35-54 © 2009-2017 Microchip Technology Inc.
35.4.6.2 INITIALIZING THE MII MANAGEMENT MODULE
For the MAC MIIM module to create the interface clock (MDC) frequency, the clock speed must
be configured. The MIIM module uses the SYSCLK as an input clock.
Use the MII Management Clock Select 1 bits, CLKSEL<3:0> (EMAC1MCFG<5:2>) to select the
divider for creating the MDC clock signal, which the IEEE 802.3 Specification defines to be no
faster than 2.5 MHz. However, some PHYs support clock rates up to 12.5 MHz.
35.4.6.3 READING A PHY REGISTER
When a PHY register is read through the MAC, the entire 16 bits are obtained.
To read from a PHY register, follow these steps:
1. Write the address of the PHY and of the PHY register to read from into the Ethernet
Controller MAC MII Management Address Register (EMAC1MADR).
2. Set the MII Management Read Command bit (READ) in the Ethernet Controller MAC MII
Management Command Register (EMAC1MCMD<0>). The read operation begins and
the MII Management Busy bit (MIIMBUSY) in the Ethernet Controller MAC MII
Management Indicators Register (EMAC1MIND<0>), will be set after three SYSCLK
periods (this is due to the internal pipeline of the MIIM interface).
3. Poll the MIIMBUSY bit to be certain that the operation is complete (the operation time is
the one needed to transfer a full MIIM frame). While MIIM is busy, the software should not
start any MII scan operations or write to the Ethernet Controller MAC MII Management
Write Data Register (EMAC1MWTD). When the MAC has obtained the register contents,
the MIIMBUSY bit will clear itself.
4. Clear the READ bit (EMAC1MCMD<0>).
5. Read the desired data from the Ethernet Controller MAC MII Management Write Data
Register (EMAC1MRDD).
35.4.6.4 WRITING A PHY REGISTER
When a PHY register is written to, all of the 16 bits are written at once; selective bit writes are not
implemented. If it is necessary to only reprogram select bits in the register, the software must first
read the PHY register, modify the resulting data, and then write the data back to the PHY register.
To write to a PHY register, follow these steps:
1. Write the address of the PHY and of the PHY register to read from into the EMAC1MADR
register.
2. Write the 16 bits of data to be written into the EMAC1MWTD register. Writing to this
register automatically begins the MIIM transaction, which causes the MIIMBUSY bit to be
set after three SYSCLK periods, this is due to the internal pipeline of the MIIM interface.
3. Poll the MIIMBUSY bit until it is cleared, which indicates the write has completed.
4. The PHY register will be written after the MIIM operation completes, which takes a MIIM
frame time. When the write operation has completed, the MIIMBUSY bit will clear itself.
The software should not start any MII scan or read operations while busy.
Note: All PHY chip registers are treated as 16 bits in width. Writes to unimplemented
locations are ignored, and any attempts to read these locations will return 0’. All
reserved locations should be written as ‘0’; their contents should be ignored when
read. Refer to the vendor-specific PHY data sheet for register access information.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-55
Section 35. Ethernet Controller
35.4.6.5 SCANNING A PHY REGISTER
The MAC can be configured to perform automatic back-to-back read operations on a PHY
register. This can significantly red uce the software complexity when periodic status information
updates are desired.
To perform the scan operation, follow these steps:
1. Write the address of the PHY, and of the PHY register to be read from, into the
EMAC1MADR register.
2. Set the MII Management Scan Mode bit, SCAN (EMAC1MCMD<1>). The scan operation
begins and the MIIMBUSY bit is set.
3. The first read operation will complete after the first MIIM frame is transferred. Subsequent
reads will be done at the same interval until the operation is canceled. The MII
Management Read Data Not Valid bit, NOTVALID (EMAC1MIND<2>), may be polled to
determine when the first read operation is complete. Read the scanned register data from
the EMAC1MRDD register.
4. After setting the SCAN bit, the EMAC1MRDD register will be updated automatically every
MIIM frame interval. There is no status information, which can be used to determine when
the EMAC1MRDD register is updated.
5. When the MIIM scan operation is in progress, the software must not attempt to write to the
EMAC1MWTD register or start a read operation.
6. The MIIM scan operation can be cancelled by clearing the SCAN bit, and then polling the
MIIMBUSY bit. New operations may be started after the MIIMBUSY bit is cleared.
Example 35-1 provides example code for a MIIM initialization and PHY register read, write, and
scan.
Example 35-1: MIIM Initialization and PHY Access
// Assume we're running at 80 MHz and we're working with a PHY that supports a maximum
// 2.5 MHz MIIM frequency
#include <p32xxxx.h>
#define PHY_ADDRESS 0x1f // the address of the PHY
EMAC1MCFG=0x00008000; // issue reset
EMAC1MCFG=0; // clear reset
EMAC1MCFG=(0x8)<<2; // program the MIIM clock, divide by 40
// read the basic status PHY register: 1
unsigned int phyRegVal;
while(EMAC1MIND&0x1); // wait not busy
EMAC1MADR=0x1|((PHY_ADDRESS)<<8); // set the PHY and register address
EMAC1MCMD=1; // issue the read order
__asm__ __volatile__ (“nop; nop; nop;”); // wait busy to be set
while(EMAC1MIND&0x1); // wait op complete
EMAC1MCMD=0; // clear command register
phyRegVal=EMAC1MRDD; // read the selected register
// write the basic control PHY register: 0
while(EMAC1MIND&0x1); // wait in case of some previous operation
EMAC1MADR=0x0|((PHY_ADDRESS)<<8); // set the PHY and register address
EMAC1MWT=0x8000; // issue the write order (PHY reset)
__asm__ __volatile__ (“nop; nop; nop;”); // wait busy to be set
while(EMAC1MIND&0x1); // wait write complete
// Make sure data has been written
// Perform a scan of the status PHY register: 1
// Start the scan
while(EMAC1MIND&0x1); // wait in case of some previous operation
EMAC1MADR=0x1|((PHY_ADDRESS)<<8); // set the PHY and register address
EMAC1MCMD=0x2; // issue the scan order
// Read the status register
// Note that the read can occur now at any time
// without previously selecting the read operation and the register
while(EMAC1MIND&0x4); // wait data valid
phyRegVal=EMAC1MRDD; // read the scanned register
// After some time we decide to stop the scan operation
EMAC1MCMD=0; // cancel scan
PIC32 Family Reference Manual
DS60001155D-page 35-56 © 2009-2017 Microchip Technology Inc.
35.4.7 Flow Control Overview
Ethernet Flow Control can send and recei ve PAUSE frames, which cause the receiving node to
stop transmitting for a specific time.
On the transmit side, the Flow Control block handles the hardware handshaking between the
MAC and the CPU when the transmit Flow Control is enabled. Flow Control for the received
packets is part of the MAC functionality.
The PIC32 MAC supports Symmetric PAUSE and Asymmetric PAUSE, as described in Clause
28, Table 28B-2, and Clause 31 and Annex 31B of the IEEE 802.3 Specification.
The Flow Control block supports two modes of operation: manual and automatic. In addition, the
mode of transmission (Full-Duplex or Half-Duplex) programmed into the MAC registers, is used
by the Flow Control block.
Before software can throttle-down incoming packets, it must enable Flow Control. The Flow
Control mechanism operates d ifferently between Full-Duplex and Half-Duplex mode.
35.4.7.1 FULL-DUPLEX
On the transmit side, the MAC will send a PAUSE control frame with a PAUSE timer value. The
receiving MAC decodes the control frame, extracts the PAUSE timer value and stalls
transmission for the designated time. This does not imply the transmitting device will pause
immediately. There is latency in the activation of the pause mechanism. If Flow Control is to be
deactivated before the PAUSE timer value expires, another PAUSE frame can be sent that
encodes a value of 0x0000 for the PAUSE timer value.
At the receiving node, if the MAC receives a PAUSE frame transmitted by another device, the
receiving node's transmit operation is inhibited until the PAUSE timer expires or the other device
cancels the request for PAUSE frames.
35.4.7.2 HALF-DUPLEX
When the software enables the Flow Control, the Flow Control block requests the MAC to apply
back-pressure. The MAC will continue sending a preamble pattern on the transmit line to prevent
any other device from gaining control of the bus. This will continue until Flow Control is disabled.
35.4.7.3 MANUAL FLOW CONTROL
The manual Flow Control is enabled through the Manual Flow Control bit, MANFC
(ETHCON1<4>). When manual Flow Control is enabled, the MAC sends PAUSE control frames
using the value of the PAUSE Timer Value bits, PTV<15:0> (ETHCON1<31:16>). When transmit
Flow Control is disabled, the MAC will send another PAUSE frame that encodes a value of
0x0000 for the PAUSE timer value to disable the Flow Control.
Note: The software should not change the Full-Duplex or Half-Duplex mode of operation,
while the transmit logic is in the middle of transmitting a package.
Note: A PAUSE frame includes the period of pause time being requested, in the range of
0 through 65535. The pause time is measured in units of pause “quanta”, where
each unit is equal to 512 bit times.
© 2009-2017 Microchip Technology Inc. DS60001155D-page 35-57
Section 35. Ethernet Controller
35.4.7.4 AUTOMATIC FLOW CONTROL
The automatic Flow Control is enabled through the Automatic Flow Control bit, AUTOFC
(ETHCON1<7>). When automatic Flow Control is enabled, the PAUSE control frames are sent
by hardware based on the current value of the Packet Buffer Count bits, BUFCNT<7:0>
(ETHSTAT<23:16>).
The PAUSE control frames are framed based on the value in the Receive Watermark bits:
When the BUFCNT value reaches the value specified by the Receive Full Watermark bits
(RXFWM<7:0>) in the Ethernet Controller Receive Watermarks Register
(ETHRXWM<23:16>), a PAUSE frame is automatically sent every 512/2 * PTV<15:0>
(ETHCON1<31:16>) bit transmit clock cycles
.
When the BUFCNT value reaches the value specified by the Receive Empty Watermark
bits, RXEWM<7:0> (ETHRXWM<7:0>), a PAUSE frame with the MAC with the PTV set to
0x0000.
The BUFCNT value is only updated on a packet boundary; therefore, all automatic Flow Control
changes occur on packet boundaries. When automatic Flow Control is enabled, it has the highest
priority for setting and clearing Flow Control operations. Therefore, it is not recommended to mix
automatic and manual Flow Control.
To manually transmit a PAUSE frame, follow these steps:
1. In the initialization sequence, software sets the PAUSE value by writing the PTV<15:0>
bits (ETHCON1<31:16>).
2. Software writes the MANFC bit (ETHCON1<4>) to manually start the transmission of a
PAUSE frame.
3. The Flow Control block will request the MAC to send a PAUSE frame.
4. The MAC will assemble the complete Flow Control frame as follows:
• Preamble
Start-of-Frame Delimiter (SFD)
Destination Address = 01-80-c2-00-00-01 (Special PAUSE multicast address)
Source Address = Station Address from EMAC1SA0-EMAC1SA3 registers
Length = 0x8088 (Control Frame)
Payload: Opcode (2 bytes) = 0x0001, PAUSE Value (2 bytes) = PTV
• Pad
• FCS
Note 1: The transmit clock cycle is 10 MHz or 100 MHz depending on the current MAC
speed selection: 10 Mbps or 100 Mbps.
2: Software must ensure that the Flow Control watermark values allow the PAUSE
frames to be sent when the amount of free space allocated by the free RX
descriptors drops below two times maximum Ethernet frame size (i.e., 1536 * 2).
This will ensure there is no receive overflow conditions.
3: The PTV value may only be changed when the operation is not enabled
ETHCON1<15> = 0.
PIC32 Family Reference Manual
DS60001155D-page 35-58 © 2009-2017 Microchip Technology Inc.
Example 35-2 shows example code for using manual Flow Control.
Example 35-2: Using Manual Flow Control Code
35.4.8 Receive Filtering Overview
The Receive Filter (RXF) block examines all incoming receive packets and accepts or rejects the
packet based on the user selectable filters. The following RX filters are supported:
CRC Error Acceptance Filter controlled by the CRC Error Collection Enable (CRCERREN) bit
in the Ethernet Controller Receive Filter Configuration Register (ETHRXFC<7>)
Runt Error Acceptance Filter controlled by the Runt Error Collection Enable bit, RUNTERREN
(ETHRXFC<5>)
CRC Check Rejection Filter controlled by the CRC Okay Enable bit, CRCOKEN
(ETHRXFC<6>)
Runt Rejection Filter controlled by the Runt Enable bit, RUNTEN (ETHRXFC<4>)
Unicast Acceptance Filter controlled by the Unicast Enable bit, UCEN (ETHRXFC<3>)
Not Me Unicast Acceptance Filter controlled by the Not Me Unicast Enable bit, NOTMEEN
(ETHRXFC<2>)
Multicast Acceptance Filter controlled by the Multicast Enable bit, MCEN (ETHRXFC<1>)
Broadcast Acceptance Filter controlled by the Broadcast Enable bit, BCEN (ETHRXFC<0>)
Hash Table Acceptance Filter controlled by the Enable Hash Table Filtering bit, HTEN
(ETHRXFC<15>)
Magic Packet Acceptance Filter controlled by the Magic Packet™ Enable bit, MPEN
(ETHRXFC<14>)
Pattern Match Acceptance Filter with logical inversion controlled by the Pattern Match Mode
bits, PMMODE<3:0> (ETHRXFC<11:8>), and the Pattern Match Inversion bit, NOTPM
(ETHRXFC<12>)
The order of the filters listed above specifies the priority of the filter from highest-to-lowest, such
that if a filter is enabled and accepts or rejects a packet, all lower priority filters will have no effect.
For example, if the Runt Error Acceptance Filter is enabled and a packet of less than 64 bytes is
received, it will always be accepted even if the CRC check fails.
If a received packet is not explicitly accepted or discarded by an enabled filter, the packet will be
discarded by default. Due to the internal design of the RX Filter, the final accept versus abort
decision for an Ethernet frame is made at the end of the frame.
When a packet is received, the RSV for each receive packet contains information about which
filters matched the corresponding RX packet, regardless of whether these filters were active at
the time. This provides extra “status” information about the packet that may be used to filter
packets in software. For example, in Promiscuous mode, the Magic Packet Filter RSV bit (see
Offset 8, RXF_RSV<3> in Table 35-8) may be used to quickly identify a magic packet without the
need to examine the frame contents. Figure 35-9 illustrates information about the RSV.
Note: Each filter is either an Acceptance filter or a Rejection filter. Acceptance filters force
the acceptance of a packet, while Rejection filters force the rejection of a packet.
// NOTE: Setting the new PTV value should be done only when the peripheral
// is not enabled
#include <p32xxxx.h>
ETHCON1CLR=0xffff0000; // clear PTV
ETHCON1SET=(ptvVal)<<16; // set the new PTV value
/*....*/
ETHCON1SET=0x10; // turn on the Manual Flow Control at this moment PAUSE
// Frames are being sent or back-pressure is applied
// do some other things
// manage/retrieve all the received packets so far
// ...
// ...
ETHCON1CLR=0x10; // disable the Manual Flow Control

Termékspecifikációk

Márka: Microchip
Kategória: nincs kategorizálva
Modell: PIC32MZ2048ECG064

Szüksége van segítségre?

Ha segítségre van szüksége Microchip PIC32MZ2048ECG064, tegyen fel kérdést alább, és más felhasználók válaszolnak Önnek




Útmutatók nincs kategorizálva Microchip

Útmutatók nincs kategorizálva

Legújabb útmutatók nincs kategorizálva

MOZA

MOZA SR-P Útmutató

10 Április 2025
CaterChef

CaterChef 445001 Útmutató

9 Április 2025
IFM

IFM E40581 Útmutató

9 Április 2025
Livn

Livn Bolt Útmutató

9 Április 2025
Livn

Livn Beats Útmutató

9 Április 2025
IFM

IFM O3R252 Útmutató

9 Április 2025