Smart Star
User's Manual
PREV INDEX NEXT


5. Using the TCP/IP Features

Chapter 5 discusses using the TCP/IP features on the CPU cards. Note that the TCP/IP feature is available only on the SR9150 CPU Card.

5.1 Ethernet Connections

Before proceeding you will need to have the following items.

The Ethernet cables and Ethernet hub are available from Rabbit Semiconductor in a TCP/IP tool kit. More information is available at www.rabbit.com.

  1. Install the CPU Card on the backplane, and connect the power supply and the programming cable as shown in Chapter 2, "Getting Started."

  2. Ethernet Connections

  3. If you do not have access to an Ethernet network, use a crossover Ethernet cable to connect the installed CPU Card to a PC that at least has a 10Base-T Ethernet card.

  4. If you have an Ethernet connection, use a straight-through Ethernet cable to establish an Ethernet connection to the installed CPU Card from an Ethernet hub. These connections are shown in Figure 18.



Figure 18. Ethernet Connections

  1. Apply Power

Plug in the power supply. The Smart Star is now ready to be used.

NOTE A hardware RESET is accomplished by unplugging the power supply, then plugging it back in.

The green LNK light is on the CPU Card is on when the Smart Star is properly connected either to an Ethernet hub or to an active Ethernet card. The orange ACT light flashes each time a packet is received.

5.2 TCP/IP Sample Programs

We have provided a number of sample programs demonstrating various uses of TCP/IP for networking embedded systems. These programs require that you connect your PC and the Smart Star together on the same network. This network can be a local private network (preferred for initial experimentation and debugging), or a connection via the Internet.

5.2.1 How to Set IP Addresses in the Sample Programs

With the introduction of Dynamic C 7.30 we have taken steps to make it easier to run many of our sample programs. You will see a TCPCONFIG macro. This macro tells Dynamic C to select your configuration from a list of default configurations. You will have three choices when you encounter a sample program with the TCPCONFIG macro.

  1. You can replace the TCPCONFIG macro with individual MY_IP_ADDRESS, MY_NETMASK, MY_GATEWAY, and MY_NAMESERVER macros in each program.

  2. You can leave TCPCONFIG at the usual default of 1, which will set the IP configurations to 10.10.6.100, the netmask to 255.255.255.0, and the nameserver and gateway to 10.10.6.1. If you would like to change the default values, for example, to use an IP address of 10.1.1.2 for the CPU Card, and 10.1.1.1 for your PC, you can edit the values in the section that directly follows the "General Configuration" comment in the TCP_CONFIG.LIB library. You will find this library in the LIB\TCPIP directory.

  3. You can create a CUSTOM_CONFIG.LIB library and use a TCPCONFIG value greater than 100. Instructions for doing this are at the beginning of the TCP_CONFIG.LIB library in the LIB\TCPIP directory.

There are some other "standard" configurations for TCPCONFIG that let you select different features such as DHCP. Their values are documented at the top of the TCP_CONFIG.LIB library in the LIB\TCPIP directory. More information is available in the Dynamic C TCP/IP User's Manual.

IP Addresses Before Dynamic C 7.30

Most of the sample programs use macros to define the IP address assigned to the CPU Card and the IP address of the gateway, if there is a gateway. Instead of the TCPCONFIG macro, you will see a MY_IP_ADDRESS macro and other macros.

In order to do a direct connection, the following IP addresses can be used for the CPU Card:

In this case, the gateway and nameserver are not used, and are commented out. The IP address of the CPU Card is defined to be 10.1.1.2. The IP address of you PC can be defined as 10.1.1.1.

5.2.2 How to Set Up Your Computer for Direct Connect

Follow these instructions to set up your PC or notebook. Check with your administrator if you are unable to change the settings as described here since you may need administrator privileges. The instructions are specifically for Windows 2000, but the interface is similar for other versions of Windows.

NOTE If you are using a PC that is already on a network, you will disconnect the PC from that network to run these sample programs. Write down the existing settings before changing them to facilitate restoring them when you are finished with the sample programs and reconnect your PC to the network.

  1. Go to the control panel (Start > Settings > Control Panel), and then double-click the Network icon.

  2. Select the network interface card used for the Ethernet interface you intend to use (e.g., TCP/IP Xircom Credit Card Network Adapter) and click on the "Properties" button. Depending on which version of Windows your PC is running, you may have to select the "Local Area Connection" first, and then click on the "Properties" button to bring up the Ethernet interface dialog. Then "Configure" your interface card for a "10Base-T Half-Duplex" or an "Auto-Negotiation" connection on the "Advanced" tab.

NOTE Your network interface card will likely have a different name.

  1. Now select the IP Address tab, and check Specify an IP Address, or select TCP/IP and click on "Properties" to assign an IP address to your computer (this will disable "obtain an IP address automatically"):

    IP Address : 10.10.6.101

    Netmask : 255.255.255.0

    Default gateway : 10.10.6.1

  2. Click <OK> or <Close> to exit the various dialog boxes.


5.2.3 Run the PINGME.C Demo

Connect the crossover cable from your computer's Ethernet port to the CPU Card's RJ-45 Ethernet connector. Open this sample program from the SAMPLES\TCPIP\ICMP folder, compile the program, and start it running under Dynamic C. When the program starts running, the green LNK light on the CPU Card should be on to indicate that an Ethernet connection is made. (Note: If the LNK light does not light, you may not have a crossover cable, or if you are using a hub perhaps the power is off on the hub.)

The next step is to ping the board from your PC. This can be done by bringing up the MS-DOS window and running the ping program:

or by Start > Run

and typing the command

Notice that the orange ACT light flashes on the CPU Card while the ping is taking place, and indicates the transfer of data. The ping routine will ping the board four times and write a summary message on the screen describing the operation.

5.2.4 Additional Demo Programs

The program SMTP.C (SAMPLES\SMRTSTAR\TCPIP\) demonstrates a basic Smart Star system using the SMTP library to send an e-mail when a keypress is detected on an LCD/keypad module. In order to run this sample program, edit the IP address as for the pingme program, edit the "mail to" e-mail address, compile the program, and start it executing. An e-mail corresponding to the keypad button that was pressed is sent.

The program SSI.C (SAMPLES\SMRTSTAR\TCPIP\) demonstrates how to make the Smart Star CPU Card a Web server. This program allows you to turn the LEDs on an attached LCD/keypad module on and off from a remote Web browser. In order to run these sample programs, edit the IP address as for the pingme program, compile the program, and start it executing. Then bring up your Web browser and enter the following server address: http://10.1.1.2. This should bring up the Web page served by the sample program.

The program SSI2.C (SAMPLES\SMRTSTAR\TCPIP\) demonstrates the use of I/O cards via instructions sent from a Web browser. You will need an A/D Converter Card, a D/A Converter Card, or a relay card installed on the backplane in order for the Web browser to be able to initiate changes on one or more of these I/O cards. Before you run this sample program, edit the IP address as for the pingme program, compile the program, and start it executing. The analog outputs will change or the relays will open and close in response to instructions sent from the Web browser.

5.2.5 LCD/Keypad Sample Programs Showing TCP/IP Features

The following sample programs, found in the TCPIP subdirectory in SAMPLES/LCD_Keypad/122x32_1x7, are demonstrate the features of the LCD/keypad module connected to the backplane. Remember to configure the IP address, netmask, and gateway as indicated in the sample programs.

When using MBOXDEMO.C, connect the Smart Star CPU Card and a PC (or other device with a Web Browser) to an Ethernet. If you connect the PC and the CPU Card directly, be sure to use a crossover Ethernet cable; straight-through Ethernet cables and a hub may be used instead.
TCP_RESPOND.C waits for a message from another single-board computer. The message received is displayed on the LCD, and you may respond by pressing a key on the keypad. The response is then sent to the remote single-board computer.
When a key on the keypad is pressed, a message associated with that key is sent to a specified destination address and port. The destination then responds to that message. The response is displayed on the LCD.
Note that only the LEFT and UP scroll keys are set up to cause a message to be sent.

When using TCPSEND.C and TCP_RESPOND.C, connect the CPU Card and the other single-board computer to an Ethernet. If you connect the them directly, be sure to use a crossover Ethernet cable; straight-through Ethernet cables and a hub may be used instead.

5.3 Where Do I Go From Here?

NOTE If you purchased your Smart Star through a distributor or Rabbit Semiconductor partner, contact the distributor or partner first for technical support.

If there are any problems at this point:

If the sample programs ran fine, you are now ready to go on.

Additional sample programs are described in the Dynamic C TCP/IP User's Manual.

Refer to the Dynamic C TCP/IP User's Manual to develop your own applications. An Introduction to TCP/IP provides background information on TCP/IP, and is available on our Web site.


Rabbit Semiconductor
www.rabbit.com
PREV INDEX NEXT