Silicon Laboratories Network Card User Manual

Ethernet-DK
EMBEDDED ETHERNET DEVELOPMENT KIT USER S GUIDE

1. Overview

The Embedded Ethernet Development Kit (Ethernet-DK) provides all the hardware and software required to develop real-world embedded Ethernet applications using the industry proven CMX Micronet™ protocol stack and high-performance Silicon Laboratories microcontrollers. The TCP/IP protocol stack is developed specifically for embedded processors and is freely distributed in an easy-to-use library . A TCP/IP Configuration Wizard is provided to generate a highly customized library optimized for user selected protocols. It also generates the framework cod e required to use the library and a project file that can be managed in the Silicon Laboratories Integrated Development Environment (IDE). Additional information about the TCP/IP library and Configuration Wizard, including a detailed API description, can be found in application note “AN237: TCP/IP Library Programmer’s Guide”.
The Embedded Ethernet Development Kit hardware includes a C8051F120 Target Board, AB4 Ethernet Development Board, USB Debug Adapter, and all necessary cables to debug the MCU and connect it to an Ethernet network. The C8051F120 Target Board features the 100 MIPS, 128 kB Flash, 8 kB RAM, 8051-based C8051F120 MCU. The MCU network interface provided by the AB4 board consists of the CP2200 Ethernet controller and an RJ-45 connec tor with integrated magnetics and LEDs. The TCP/IP Library inc ludes a built-in driver for the CP2200 and has a custom driver interface with auto-generated templates to allow drivers for any Ethernet controller to be written.
The Silicon Labs IDE supports full-speed, non-intrusive MCU debugging and is bundled with an evaluation version of the Keil C51 Toolchain allowing immediate application code evaluation in C. Projects with up to 4 kB of object code and unlimited library code can be developed using the included toolse t. Numerous applicatio n code examples are included in the development kit and a walkthrough of an embedded web server demo is included in Section 6 on page 9.
Figure 1. C8051F120TB Target Board and AB4 Ethernet Development Board
Rev. 0.6 1/11 Copyright © 2011 by Silicon Laboratories Ethernet-DK
Ethernet-DK

2. Kit Contents

The Embedded Ethernet Development Kit contains the following items:
C8051F120 Target BoardAB4 Ethernet Development BoardCAT5e Ethernet CableSilicon Laboratories Evaluation Kit IDE and Product Information CD-ROM. CD content includes the following:
Silicon Laboratories Integrated Development Environment (IDE) Keil C51 Evaluation Toolchain (assembler, linker and C compiler with 4 kB object code generation and unlimited library
code usage)
Source code examples and register definition files Documentation TCP/IP Configuration Wizard Embedded Ethernet Development Kit User’s Guide (this document)
Universal (100–240 V, 50–60 Hz) AC to DC Power AdapterUSB Debug Adapter (USB to JTAG/C2 Debug Interface)USB CableSerial Cable
2 Rev. 0.6
Ethernet-DK
J1
JTAG
P1
J24
J11
J3
J23
PWR
P1.6
J5
J9
J20
Pin 1
Pin 2
J22
Pin 1
Pin 2
J4
P3.7
RESET
J8J10 J6
Pin 1
Pin 2
Port 0 Port 2
Port 4
Port 7
Port 1
Port 3Port 6Port 5
J21
MONEN
C8051F12x
C8051F120
Target Board
RJ45
CP2200
AB4 Ethernet Development
Board
LED1 LED2
SW2 SW1
J6
J5
J3
J4
Prototyping
Area
R1
USB Port
USB
Debug
Adapter
Ribbon
Cable
USB
Cable
PC
AC / DC Adapter
C8051F120
Target Board
JTAG
AB4 Ethernet Development
Board

3. Hardware Setup

The following instructions illustrate how to setup the hardware included with the kit.
1. Connect the AB4 Ethernet Development Board to the C8051F120 Target Board at J24 (Figure 2). Apply slight pressure to ensure the mating 96-pin connectors are firmly connected.
2. Using the ribbon cable, connect the USB Debug Adapter to the C8051F120 Target Board at the JTAG header as shown in Figure 3.
3. Connect one end of the provided USB cable to any available USB port on the PC (Figure 3).
4. Connect the other end of the USB cable into the USB connector on the USB Debug Adapter (Figure 3).
5. Connect the ac/dc Power Adapter to the C805 1F120 T a rget Board at P1 (Figure 3). This connection should power both boards. Power is indicated by the "PWR" LED on the C8051F120 TB.
Note: The 'F120TB places a 2  resistor in series with the power supply net powering the AB4 Board. We recom-
mend replacing this resistor with a 0 resistor to prevent large voltage drops, possibly triggering a V Monitor reset, when current demand increases.
DD
Figure 2. Embedded Ethernet Development Board Attachment
Figure 3. Embedded Ethernet Development Kit Debug Connections
Rev. 0.6 3
Ethernet-DK
Ethernet
Connector
PC
Ethernet
Router/
Switch
Or
Wa ll O ut le t
Ethernet
Cable
Ethernet
Cable
Ethernet Connector
Embedded Ethernet
Development Kit
‘F120TB + AB4
Ethernet
Connector
PC
Ethernet Crossover Cable
Ethernet Connector
Embedded Ethernet
Development Kit
‘F120TB + AB4

4. Network Setup

The Embedded Ethernet Development Kit can be connected to an Ethernet network using a standard Ethernet cable (see Figure 4) or directly to a PC using a crossover cable (see Figure 5). Table 1 describes the benefits of using each of the connection methods. A standard Ethernet cable is included in the kit and crossover cables are available for order from the Silicon Laboratories website, at www.silabs.com.
Note: Firewalls or VPN policies may need to be disabled in order to communicate with the development kit.

Table 1. Ethernet Cable Comparison

Standard Cable Crossover Cable
Remote access to embedded system. Distance from PC to embedded system is limited by
the length of the cable.
Multiple embedded systems may be networked and accessed from the same (or multiple) PC(s).
Shared communication medium. System may experience packet delays under heavy network traffic. This effect is
Only a single embedded system may be accessed from a single PC.
Dedicated channel bandwidth. Good for achieving consistent data throughput measurements.
greatly reduced if using a switched network. An existing network with wall outlet or a router/switch is
No additional hardware required.
required. PC does not require any additional IP address config ur a -
tion.
PC must be configured with a static IP address in order to recognize embedded system.
Standard cable is included in development kit. Crossover cable must be purchased separately.
Figure 4. Embedded Ethernet Network Connection (Standard Cable)
Figure 5. Embedded Ethernet Network Connection (Crossover Cable)
4 Rev. 0.6
Ethernet-DK
4.1. Network Setup Procedure
If using a standard cable:
1. Connect the AB4 Ethernet Development Board to an Ethernet wall outlet or to a router/switch using a standard Ethernet cable.
2. Connect a PC to the same Ethernet network using a standard Ethernet cable.
If using a crossover cable:
1. Connect the AB4 Ethernet Development Board directly to a PC using an Ethernet crossover cable.
2. Configure the PC to have a static IP address. The steps below show how to configure a Windows PC to use a static IP address.
a. Open the Network Connections Folder. This is accessible from the control panel or from the start menu by right-
clicking on My Network Places or Network and selecting Properties. b. Right-click on the Local Area Connection and select Properties. c. Select Internet Protocol (TCP /IP) and click Properties. Optionally, if the Show icon in notification area when connected
is checked, right-clicking the system tray icon will provide a quick shortcut to the LAN properties dialog and can be used as an indicator that the network is functioning properly.
d. Select Use the following IP address and specify an IP address and subnet mask for the PC. For a subnet mask of
255.255.255.0, the embedded system’s IP address must match the first three octets of the PC’s IP address for the PC to recognize the embedded system. See Section 4.2 for additional information abou t choosing the embedded system’s IP address. Note: When entering an IP or subnet address into the dialog box, the cursor will automatically advance to the next field for a three digit octet. If entering a one or two digit octet, the spacebar, right arrow key , or ‘.’ can be pressed to advance to the next field.
e. Click OK after the static IP address and subnet mask have been configured. The PC will now be able to access the
embedded system using a crossover cable.
Rev. 0.6 5
Ethernet-DK
PC IP Addre ss
PC Subnet Mask
Embedded Web Server IP Address
0000 1010 0000 1010 0000 1010 0101 0000
10 10 10 80
1111 1111 1111 1111 1111 1111 0000 0000
255 255 255 0
(decimal)
(binary)
(decimal)
(binary)
0000 1010 0000 1010 0000 1010
1010 0011
10
10
10
163
(decimal)
(binary)

4.2. Selecting an IP Address for the Embedded System

For a PC to recognize an embedded system on a network, its IP address and subnet mask need to be configured. Below are a few guidelines to follow when choosing an IP address for the embedded system. Figure 6 shows an example of a compatible PC and embedded system IP address combination.
1. Find the IP address and Subnet mask for the PC. If a Defau lt Gateway is specified, then save this address for later use. If you are using a crossover cable, you may choose any IP address for your PC as long as the Subnet mask allows it to recognize the embedded system.
2. The IP address chosen for the embedded system must match the PC’s IP address in all bit locations where the Subnet mask is a 1 in order for the PC to recognize the embedded system. Otherwise, the PC will send it’s request outside the local network.
3. Do not duplicate IP addresses or select a broadcast address. An IP address is considered a broadcast address if all bits which are 0 in the Subnet mask are 1 in the IP address. Broadcast addresses with additional 1s such as 10.10.255.255 (Figure 6) can be broadcast to nodes outside the local network.
4. The address 255.255.255.255 is known as the Ethernet br oadcast address and is used when the Subnet mask for the network is not known. Any packet transmitted to this address will reach all nodes on the local network but cannot go further than the nearest router.

4.3. IP Address Selection Example

The example in Figure 6 shows the IP address and subnet mask of the PC we want to connect to the embedded system. Since the first 24 bits of the subnet mask are 1, the first 24 bits of the embedded web server’s IP addre ss (shown in bold) must match the PC’s IP address. Only the least significant 8 bits may vary making the valid range of IP addresses for the embedded web server 10.10.10.0 to 10.10.10.254 with the exception of 10.10.10.80 since this address is already taken by the PC. 10.10.10.255 is reserved because it is the broadcast address for this network.
6 Rev. 0.6
Figure 6. IP Address Selection Example
Ethernet-DK

5. Software Setup

The included CD-ROM contains the Silicon Laboratories IDE, Keil C51 toolset, and documentation including datasheets, application notes, and an electronic version of this user’s guide. The instructions below describe how to install the Embedded Ethernet Development Kit software. Refer to the readme.txt file on the CD-ROM for the IDE release notes containing the latest information regarding supported devices, revision history, and known issues.
1. Place the Embedded Ethernet Development Kit CD-ROM into the PC’s CD-ROM drive. An installer will automatically launch, allowing you to install the IDE software or read documentation by clicking buttons on the Installation Panel. If the installer does not automatically start when you insert the CD-ROM, run autorun.exe, found in the root directory of the CD-ROM.
2. After the installation dialogue box appears, click the Install Development Tools button.
3. Select the ETHERNET-DK entry and press the Install button.
Rev. 0.6 7
Ethernet-DK
4. Unselect the “Install Raisonance Evaluation 8051 Toolset” option and select “Install Keil Evaluation 8051 Toolset”. Then press the Install button.
5. Follow the installation prompts to install the development tools. The following applications will be installed:
The Silicon Laboratories IDE will be installed by default in the C:\SiLabs\MCU directory. The Embedded Ethernet examples will be installed by default in the C:\SiLabs\MCU\Examples\C8051F12x\Ethernet
directory.
The TCP/IP Configuration Wizard will be installed by default in the C:\SiLabs\MCU\TCP-IP Config directory. Shortcuts to the applications will be placed in the StartPrograms menu.
6. To compile the projects discussed in this tutorial, the Keil tools must be enabled to the 4k-code limited evaluation version. See “AN104: Integrating Keil 8051 Tools into the Silicon Labs IDE" for more information. Application notes can be found on the Silicon Labs Application Notes webpage:
http://www.silabs.com/products/mcu/Pages/ApplicationNotes.aspx.
8 Rev. 0.6
Ethernet-DK

6. Embedded Ethernet Tutorial

Now that the Embedded Ethernet Development Kit hardware has been set up, the software installed, and the embedded system connected to a network, it is time to download firmware into the MCU and test its network connectivity. The Embedded Ethernet Tutorial consists of four stages of increasing functionality and will allow the user to quickly learn how to use the development kit hardware and software.

6.1. Stage 1—Basic Web Server

In the first demo stage, we will generate a “Hello World” web server with a single static web page using the TCP/IP Configuration Wizard. We will learn how to PING the embedded web server and view the page in a web browser.

6.1.1. Generating a Project using the TCP/IP Configuration Wizard

The instructions below show how to generate a new project using the TCP/IP Configuration Wizard.
1. From the Windows Start menu, start the TCP/IP Configuration Wizard. The shortcut will be under the
StartSilicon Laboratories menu. Alternatively , the Configur ation Wizard can be st arted by double-clicking TCPIP_Config.exe located by default in the “C:\SiLabs\MCU\TCP-IP Config” directory.
2. In the Communications Adapter section of the left window, check CP2200.
3. In the Device section of the left window, verify that C8051F12x is selected.
4. In the Protocol Settings section of the left window, make sure Ethernet is selected then check HTTP. The lower level protocols required to run HTTP (e.g., TCP) will automatically be enabled (see Figure 7).
Figure 7. TCP/IP Configuration Wizard Protocol Selection
Rev. 0.6 9
Ethernet-DK
5. In the System Settings section of the left window, select IP Addresses.
6. In the right window, set the Source IP Address to the IP address of the embedded system.
7. If the Gateway IP Address and Subnet mask of the network are known, then fill in the addresses on the right window (see Figure 8).
8. If using the CP2200, the MAC address field is ignored. The CP2200 Ethernet Controller contains a unique factory-programmed MAC address stored in Flash memory.
Figure 8. TCP/IP Configuration Wizard IP Address Specification
10 Rev. 0.6
Ethernet-DK
9. Save the selected configuration using the FileSave As menu.
10. Generate a new project with supporting firmware by selecting Generate Project from the File menu (see Figure 9).
11. When prompted for a folder to save the project, browse to an empty directory or create a new directory. Note: Any files in the selected directory will be overwritten. Click the OK button.
12. Click the OK button when the “Project generated successfully” message appears.
13. Close the TCP/IP Configuration Wizard.
Figure 9. TCP/IP Configuration Wizard Project Generation
Rev. 0.6 11
Ethernet-DK

6.1.2. Programming the MCU

We will now build the project created by the TCP/IP Configuration Wizard and download the firmware to the MCU using the Silicon Laboratories IDE.
1. From the Windows Start menu, start the Silicon Laboratories IDE. The shortcut will be under the
StartSilicon Laboratories menu. Alternatively, the Silicon Labs IDE can be started by double-clicking IDE.exe located by default in the “C:\SiLabs\MCU” directory.
2. After the splash screen disappears, open the generated project using the ProjectOpen Project menu command. Browse to the directory where the TCP/IP project was generated . Select TCPIP_Project.wsp, and click the Open button.
Note: An example project is available by default in the C:\SiLabs\MCU\Examples\C8051F12x_13x\Ethernet\HTTP\web-server-1 directory . This project is identical to the one generated in the previous steps.
3. If you would like to view the source code, double-click on main.c on the left hand side of the screen in the Project Window. Source code modification is not required to run this demo.
4. Select the Keil tools by going to ProjectTool Chain Integration and selecting the Keil preset under the
Preset Name drop down menu. Press No when the Save Preset? dialog appears.
12 Rev. 0.6
Loading...
+ 28 hidden pages