# chipKIT™ Network Shield™ Reference Manual

Revision: August 27, 2013

Note: This document applies to REV D of the shield.

# Overview

The chipKIT Network Shield is an input/output expansion board designed for use with the chipKIT Max32™ microcontroller board. It has circuitry and connectors that enable you to exploit the advanced communications features of the PIC32MX795F512L microcontroller on the Max32.

The Network Shield has a 10/100 Mbps Ethernet PHY to enable connection to an Ethernet network. It provides the connectors and load switch to use the USB 2.0 On-The-Go (OTG) controller to implement a USB device, USB host, or OTG operation. It also has two CAN transceivers and connectors to allow connection to two independent CAN networks. Connectors are provided to enable connection to two of the I2C busses supported by the Max32.

In addition to the communications features, the Network Shield also has a 256Kbit I2C EEPROM for non-volatile data storage and a 32.768Khz oscillator for using the real-time clock/calendar (RTCC) peripheral in the PIC32 microcontroller.

The Network Shield has the same form factor as the Max32 board.

Features include:

• an SMSC LAN8720 10/100 Ethernet PHY
• an RJ45 connector with integral magnetics
• a USB device and host connectors
• two MCP2551 CAN transceivers
• two 12-pin header connectors for CAN
• two I2C daisy chain connectors
• a 256Kbit I2C EEPROM
• a 32.768Khz oscillator

# 1. chipKIT Network Shield Hardware Overview

The Network Shield has the following hardware features:

1. USB Connectors

The connector on top of the board is a standard USB A-type receptacle. This is used when the Max32/Network Shield combination is used as a USB host. Immediately below this connector is a USB Micro-AB connector. This connector is used when the Max32/Network Shield is used as a USB device or when using it as a USB OTG device.

2. Ethernet Connector with Integral Magnetics

This connector is used to connect the Max32/Network Shield to an Ethernet network.

3. JP4: USB Host Connector Selection

When the Max32/Network Shield is used as a USB host, this jumper is used to select which USB connector is being used.

4. J17: Power Pass-Through Connector

This connector passes the power connector from the Max32 through the Network Shield and powers the Network Shield from the Max32.

5. J9 & J12: Analog Signal Pass-Through Connectors

These connectors pass the analog input pins on the Max32 through the Network Shield.

6. CAN2 Connector

7. CAN1 Connector

8. Digital Signal Connector

This connector provides most of the signals used by the Ethernet and USB interfaces from the Max32 board to the Network Shield. The remaining signals are passed through the Network Shield.

9. J7: I2C #1 Daisy Chain Connector

This is a 2×4 pin header connector that provides access to the I2C signals SDA and SCL as well as power from the 3.3V power bus and ground. This can be used to extend the I2C bus off the board and to power an external I2C device. Digilent has cables and a selection of I2C peripheral modules that can be accessed using this connector.

10. J6: I2C #2 Daisy Chain Connector

This is a 2×4 pin header connector that provides access to the I2C signals SDA and SCL as well as power from the 3.3V power bus and ground. This can be used to extend the I2C bus off the board and to power an external I2C device. The jumpers for disabling the onboard pull-ups are adjacent to this connector.

11. Digital Signal Connectors

Some of the signals used by the Network Shield are provided on these connectors. The rest of the signals are passed through the Network Shield.

# 2. chipKIT Network Shield Hardware Description

The following describes the hardware on the Network Shield and how to use it. Appendices at the end show pin-out and connection tables.

The Network Shield is designed to be used with the chipKIT Max32 board. When used together, the two boards have the necessary supporting hardware and connectors to use all the advanced communications and networking features of the PIC32MX795F512L microcontroller on the Max32.

## 2.1. Ethernet Interface

The Network Shield can interface with 10Mbps or 100Mbps Ethernet networks. The PIC32MX795 microcontroller on the chipKIT Max32 board contains a 10/100 Ethernet Medium Access Controller (MAC). The Network Shield provides an SMSC LAN8720 Ethernet Physical Layer Transceiver (PHY). Together, the MAC and PHY provide a complete 10/100 Ethernet interface.

The RJ45 connector J1 provides the physical connection to an Ethernet network using a standard Ethernet cable.

When the Ethernet controller is enabled in the PIC32 microcontroller, it takes over the use of a number of the microcontroller pins. All of the signals from these pins are taken from connector J10 on the Network Shield (connector J8 on the Max32). Three of these signals are also shared with connector J7 on the Max32 and are analog pins A11, A12, and A13. When the Ethernet interface on the Network Shield is being used, these pins are not available for other uses, and nothing should be connected to them to avoid interference with the operation of the Ethernet interface.

In order to connect to and use an Ethernet network, the PIC32 microcontroller must be running network protocol stack firmware. Normally, the TCP/IP (Transmission Control Protocol/Internet Protocol) network protocol is used and TCP/IP Stack software is used. The Ethernet library provided for use with the Network Shield has the necessary stack support for using the chipKIT Max32/Network Shield in the MPIDE programming environment.

If the board is being used outside the MPIDE programming environment, the Microchip Applications Library, available for download format www.microchip.com, provides full protocol stack support compatible with the PIC32MX795 MAC and the LAN8720 PHY. Microchip also provides many example programs demonstrating the use of their network protocol stack for various applications.

When not using the either the chipKIT Ethernet library or the Microchip network protocol stack, refer to the manufacturer documentation for the PIC32MX795 and LAN8720, as well as network protocol documentation, for information on using the Ethernet interface.

The PIC32MX795 microcontroller has two alternate sets of pins that can be used to connect the MAC to the external PHY. It also provides two alternate standard MAC/PHY interface signaling conventions. The chipKIT Max32/Network Shield is designed to use the standard (not alternate) pins, and to use the RMII (not MII) interface signaling convention. These options are selected using the configuration variables in the PIC32 microcontroller and are specified using the #pragma config statement. To enable the Ethernet controller in the correct configuration, the following statements must appear in the main program module:

#pragma config FETHIO=ON
#pragma config FMIIEN=OFF

The boot loader in the chipKIT Max32 board sets this configuration by default. When using the Network Shield within the MPIDE environment no additional work is necessary. When using it outside the MPIDE environment, these configuration settings must be made.

The LAN8720 PHY has a reset signal, labeled NRST in the schematic, which is used to reset the PHY. This signal is connected to the INT2/RE9 pin on the PIC32 microcontroller. This pin is chipKIT digital pin 7 on the Max32 board. The NRST signal is active low. Configure the microcontroller pin as an output and drive it low to reset the PHY, or drive it high to allow the PHY to come out of reset and begin operation. The NRST signal is pulled low on the Network Shield, so that the PHY is held in reset by default. To allow the PHY to operate, this pin must be driven high. This reset operation is not part of the Microchip network protocol stack, and so the NRST must be driven high before initializing the Microchip network stack. When using the chipKIT Ethernet library for the Network Shield, this is done automatically by the library.

## 2.2. USB Interface

The PIC32MX795 microcontroller on the Max32 contains a USB 2.0-compliant, fullspeed device and On-The-Go (OTG) controller. This controller has the following features:

• USB full-speed host and device support
• low-speed host support
• USB OTG support
• endpoint buffering anywhere in system RAM
• integrated DMA to access system RAM and Flash memory.

Connector J4, on the top left side of the Network Shield, is a standard USB type-A receptacle. This connector is generally used when the Max32/Network Shield has been programmed to operate as a USB host. The USB device is connected to J4 either directly or via cable.

Connector J2, on the bottom left side of the Network Shield, is the Device/OTG connector. It is a standard USB micro-AB connector. Connect a cable with a micro-A plug (available from Digilent) from this connector to a USB port on a PC or USB hub.

When the USB controller in the PIC32 microcontroller on the Max32 board is in use, it takes over the use of several of the pins. The signals provided by these pins appear on connector J13 on the Network Shield (connector J9 on the Max32). Two additional signals are used when doing USB hosting. These signals appear on AN5 and digital pin 2. These pins are not available when using the USB interface.

When operating as a USB device, the chipKIT Max32/Network Shield will normally be a selfpowered device. To operate as a self-powered device, an external power supply should be connected to the external power connector J2 on the Max32 board. If the external power supply is a regulated 5V supply, jumper JP1 on the Max32 should be set in the BYP position to bypass the on-board 5V regulator. The Max32/Network Shield can also be operated as a self-powered device powered by USB connector J1 on the Max32. This is the connector used by the USB serial converter. When operated this way, the Max32/Network Shield will be a bus-powered device from the perspective of the USB port connected to J1, and a self-powered device from the perspective of the port connected to the USB connector J2 on the Network Shield.

Operation of the Max32/Network Shield as a bus-powered device is possible although not recommended in most cases. The USB bus voltage from USB connector J2 appears on pin 1 of jumper JP4. Remove the shorting block from JP4 and move the jumper from pin 1 to any point on the board that connects to the 5V VCC5V0 bus. The VCC5V0 bus can be accessed from power connector J17, pin 3. It can also be accessed from either pin of J14, the uppermost two pins on the connector on the right edge of the board. When operating the board in this way, be aware that if the USB serial converter on the Max32 is connected to a live USB port, the 5V power supplies of the two USB ports (the one connected to the Max32 and the one connected to the Network Shield) will be shorted together. If these are not the same power supply (i.e., both USB ports are on the same PC), one or both USB ports and/or the Max32 or Network Shield may be damaged.

When operating as a USB host, the Max32/Network Shield should be externally powered. Connect a power supply to the external power connector J2 on the Max32. If the external supply is a regulated 5V supply, place JP1 on the Max32 in the BYP position to bypass the 5V regulator. The power supply must be able to supply enough current to power both the Max32/Network Shield and the attached USB device, because the Max32/Network Shield provides power to the attached USB device when operating as a host.

Jumper JP4 on the Network Shield is used to route power to the host connector being used. Place the shorting block in the “A” position when using the standard USB type-A (host) connector J4. Place the shorting block in the “MICRO” position for use with the USB micro- AB (OTG) connector J2.

When operating as a USB host, the PIC32MX795 microcontroller controls application of power to the connected device via the VBUSON control pin (labeled VBUSON in the schematic). Bus power is applied to the USB bus by driving the VBUSON pin high. Power is removed from the bus by driving the VBUSON pin low. The VBUSON pin is accessed via bit 3 of the U1OTGCON register. The VBUSON signal is shared with same microcontroller pin as analog input A5 and digital pin 59.

The VBUSON pin drives the enable input of a TPS2051B current-limited power distribution switch to control the application of USB power to the host connector. This switch has overcurrent detection capability and provides an over-current fault indication by pulling the signal USBOC low. The over-current output pin can be monitored via the INT1/RE8 pin on the PIC32MX795 microcontroller. This signal appears on connector J14, pin 5 on the Max32 board, and chipKIT digital pin 2. Details about the TPS2051B are available from the data sheet at the Texas Instruments web site.

The VBUSON signal is shared with the same microcontroller pin as analog input A5 and digital pin 59. This pin is not available for other uses when operating as a USB host. If the Max32/Network Shield is not being used as a USB host, you can use A5/pin 59 by cutting the trace on the bottom of JP3. USB host capability can be restored by soldering a 2-pin header to JP3 and installing a shorting block.

The PIC32 USB controller can be accessed using the chipKIT USB libraries for use within the MPIDE environment.

When using the Max32/Network Shield outside the MPIDE environment, the Microchip Application Library provides USB stack code that can be used with the Max32/Network Shield. There are reference designs available on the Microchip web site demonstrating both device and host operation of PIC32 microcontrollers. These reference designs are suitable for developing USB firmware for the Max32/Network Shield.

## 2.3. CAN Interfaces

The Controller Area Network (CAN) is a control networking standard originally developed for use in automotive systems, but has since become a standard used in various industrial control and building automation networking applications as well.

The PIC32MX795 microcontroller on the Max32 contains two independent CAN network controllers. These CAN controllers in combination with two Microchip MCP2551 CAN transceivers on the Network Shield allow the Max32/Network Shield to operate on one or two independent CAN networks.

When not using the MPIDE environment, refer to the PIC32MX7XX data sheet, the PIC32 Family Reference Manual, and the CAN network documentation available at www.microchip.com for information on CAN controllers and CAN networking in general.

The PIC32MX795 microcontroller provides two sets of pins that can be used to connect the CAN controllers to the external transceivers. The Max32/Network Shield is designed to use the alternate (not the standard) pins. This selection is made using the configuration variables in the microcontroller, set using a #pragma config statement. To select the use of the alternate interface pins, the following statement must appear in the main program module:

#pragma config FCANIO=OFF

When using the Max32/Network Shield within the MPIDE environment, the boot loader on the Max32 boards sets this configuration automatically. When using the boards outside the MPIDE environment, you must configure this setting.

The pins on the PIC32MX795 microcontroller used by signals for the CAN1 controller to connect to its transceiver are shared with two of the signals for UART3B and SPI port 3A. These signals appear on pins 14 & 15 of connector J4 on the Max32 board. Jumpers JP1 and JP5 enable you to use these pins if neither of the CAN networks are needed. There are cuttable traces on the bottom of the board between the pins of JP1 and JP5. Cut these traces to disconnect the transceiver for CAN1. To restore the connection, load two pin headers for JP1 and JP5 and install shorting blocks on the two jumpers.

Pins 15 and 16 on the PIC32MX795 microcontroller are used by the CAN2 signals and appear on connector J13 on the Network Shield (connector J9 on the Max32). They are digital pins 22 and 23 and are not available for any other use when using CAN2.

There is no standard connector for use with CAN networks. The Network Shield has two 2×6 pin header connectors for access to the CAN signals. Connector J3 provides access to the signals for the CAN1 network controller, and connector J5 provides access to the signals for CAN2. Refer to the schematic for the Network Shield or the tables at the end of this document for information on the connectors and signals. A Digilent 6-pin or 2×6 to dual 6-pin cables can be used to daisy chain Digilent boards together in a CAN network. A Digilent 6-pin cable and a Digilent PmodCON1 Screw Terminal Connector module can be used to connect the Max32/Network Shield to other network wiring configurations.

The CAN network standard requires that the nodes at each end of a network provide 120- ohm termination. The Network Shield provides the termination resistors and jumpers to enable/disable them depending on the location of the board in the network. Jumper JP2 is used to enable/disable the termination resistor for the CAN1 network, and JP7 is used to enable/disable the termination resistor for CAN2. Install a shorting block on the jumper pins to enable the termination resistor, or remove the shorting block to disable the termination resistor.

## 2.4. I2C Busses and Connectors

The Inter-Integrated Circuit (I2C) interface provides a medium-speed (100K or 400K bps) synchronous serial communications bus. The I2C interface provides master and slave operation using either 7-bit or 10-bit device addressing. Each device is given a unique address, and the protocol provides the ability to address packets to a specific device or to broadcast packets to all devices on the bus. Refer to the PIC32MX7XX data sheet and the PIC32 Family Reference Manual, both available at www.microchip.com, for detailed information on configuring and using the I2C interface.

The PIC32MX795 microcontroller on the Max32 provides for up to five independent I2C interfaces. The Network Shield is designed to provide access to two of these interfaces: I2C #1 (SCL1, SDA1) and I2C #2 (SCL2, SDA2). I2C #1 is the bus accessed through the standard chipKIT Wire library (see the MPIDE Help reference for more information on the standard libraries). There are five sets of pins on the board for access to the two I2C ports. Connectors J7, J16 and J19 provides access to I2C port #1 and connector J6 and digital pins 12 and 13 provides access to I2C port #2.

Note that external interrupt 3 and SCL1 share the same pin on the PIC32MX795. External interrupt 4 and SDA1 also share the same pin. Therefore, external interrupts 3 and 4 should not be used simultaneously with I2C#1 bus.

One I2C device is provided on the Network Shield, a 256Kbit EEPROM connected to the I2C #1 bus.

Connectors J6 and J7 can be used to extend the I2C busses off of the board to connect to external I2C devices. These are standard 2×4 pin header connectors with 0.100” spaced pins. They provide access to the I2C signals, SCL and SDA, plus VCC3V3 and ground. The VCC3V3 can be used to power external I2C devices.

The I2C bus uses open-collector drivers to allow multiple devices to drive the bus signals. This means that pull-up resistors must be provided to supply the logic high state for the signals. The Network Shield provides 2.2Kohm pull-up resistors on I2C #1. Because I2C #1 is the bus with the EEPROM, these pull-up resistors are permanently connected.

Jumpers JP9 & JP12 let I2C #1 be disconnected from the Network Shield if it is not in use but is interfering with the associated pins. There are cuttable traces on the underside of the board between the pins of these jumpers. Cut these traces to disconnect SCL1 and SDA1 from the Network Shield. To restore the connection, load two pin headers for JP9 and JP12 and install shorting blocks. If this is done, it is still possible to access the onboard EEPROM by connecting SCL and SDA from I2C #2 by installing jumper wires between connector J6 and J7. The EEPROM will then appear on I2C #2 bus.

The logic high pull-up for I2C #2 is provided by sourcing current mirrors instead of resistors. These current mirrors source approximately 1.7mA. The use of current mirrors provides faster rise times on the I2C signals and provides the ability to drive longer cable runs reliably than would be the case with simple pull-up resistors.

Generally, only one set of pull-ups is used on the bus. Jumpers JP10 and JP11 can be used to disable the on-board pull-ups on I2C #2 if a different value is needed or some other device on the bus is providing the pull-ups or if I2C #2 isn’t being used and the pull-ups are interfering with the use of the pins. The on-board pull-ups are enabled by install shorting blocks on JP10 and JP11. Removing the shorting blocks disables the pull-ups.

Digilent has several small I/O peripheral modules (Pmods™) available that can be connected using the I2C connector. These include a 3-axis accelerometer, a 4-channel 12-bit A/D converter, a serial character LCD panel, a 3-axis gyroscope, a real-time clock/calendar, and an I/O expander.

### 2.4.1. EEPROM

A 256Kbit (32Kbyte) I2C EEPROM is provided using a Microchip 24LC256. This EEPROM, IC5, is located on the bottom of the board.

The EEPROM is on the I2C #1 bus, and its 7- bit I2C device address is ‘1010000’.

Digilent has a library for using the EEPROM. It is contained in document # DSD-0000311 (chipKIT IOShield Library.zip) which can be downloaded from the Basic I/O Shield product page at www.digilentinc.com. The EEPROM library is IOShieldEEPROM.

For details on the 24LC256, see the data sheet at www.microchip.com.

## 2.5. 32.768KHz Oscillator

A 32.768KHz oscillator is provided for use as a clock source for the real-time clock/calendar (RTCC) peripheral in the PIC32MX796 microcontroller on the Max32 board. The output of this oscillator connects to pin 12 or connector J11.

On the Max32 board, this signal connects to signal RC13, which connects to pin 73 on the PIC32 microcontroller. This pin provides the secondary oscillator input, which can be used to clock the RTCC in the PIC32 microcontroller.

# Appendix A: chipKIT Network Shield Pinout Tables

## Pins Used by the Ethernet Interface

chipKIT Pin # PIC32 Pin # Pin Signal Notes
46 88 J10-8 C1TX/ETXD0/PMD10/RF1 ETXD0
45 87 J10-9 C1RX/ETXD1/PMD11/RF0 ETXD1
47 83 J10-7 ETXEN/PMD14/CN15/RD6 ETXEN
48 68 J10-6 RTCC/EMDIO/AEMDIO/IC1/RD8 EMDIO
49 71 J10-5 EMDC/AEMDC/IC4/PMCS1/PMA14/RD11 EMDC
53 14 J10-1 ERXCLK/AERXCLK/EREFCLK/AEREFCLK/SS2A/U2BRX/U2ACTS/PMA2/CN11/RG9 EREFCLK
43 12 J10-11 ERXDV/AERXDV/ECRSDV/AECRSDV/SCL2A/SDO2A/UATX/PMA3/CN10/RG8 ECRSDV
40 35 J10-14 AN11/ERXERR/AETXERR/PMA12/RB11 ERXERR
42 41 J10-12 AN12/ERXD0/AECRS/PMA11/RB12 ERXD0
41 42 J10-13 AN13/ERXD1/AECOL/PMA10/RB13 ERXD1
7 19 J11-15 AERXD0/INT2/RE9 NRST

## Pins Used by the USB Interface

chipKIT Pin # PIC32 Pin # Pin Signal Notes
27 57 J13-11 USBD+/RG2
26 56 J13-12 USBD-/RG3
25 51 J13-13 USBID/RF3
A5/59 20 J9-6 AN5/C1IN+/VBUSON/CN7/RB5
2 18 J11-5 AERXD0/INT1/RE8

## Pins Used by CAN Interfaces

chipKIT Pin # PIC32 Pin # Pin Signal Notes
14 39 J16-8 AC1TX/SCK3A/U3BTX/U3ARTS/RF13 CAN1
15 40 J16-7 AC1RX/SS3A/U3BRX/U3ACTS/RF12 CAN1
22 7 J10-16 T3CK/AC2TX/RC2 CAN2
23 8 J10-15 T4CK/AC2RX/RC3 CAN2

## Pins Used by I2C Interfaces

chipKIT Pin # PIC32 Pin # Pin Signal Notes
21 66 J16-1, J19-2, J7-1, J7-2 AETXCLK/SCL1/INT3/RA14 I2C1 – also attached to EXT INT 3
20 67 J16-2, J19-1, J7-3, J7-4 AETXEN/SDA1/INT4/RA15 I2C1 – also attached to EXT INT 4
12 58 J8-9, J6-1, J6-2 SCL2/RA2 I2C2
13 59 J8-11, J6-3 J6-4 SDA2/RA3 I2C2