PIC16C74 Embedded 10BaseT Ethernet CS8900




Embedded ethernet enables microcontroller based projects to send and receive packets over the network. The board shown on the left is actual size and incorporates all the circuitry needed to enable 10BaseT communications. The board is designed to minimize the pin count needed to interface with microcontrollers. An 8 bit data bus, 4 bit address bus, and three control signals (15 signals) with an optional interrupt signal are all that is needed to control the board. This is made possible by using the Crystal CS8900 ethernet transceiver running in 8-bit mode. All the information, schematics, and source code needed to perform TCP/IP communication over ethernet is detailed on this page. I’m using a Microchip PIC16C74 controller in this project however, any controller with enouph port capacity will also work. This would include the popular Motarola 68HC11.

The project described here is in two parts. The actual embedded ethernet board and the test circuit utilizing the PIC16C74. The code running on the PIC incorporates the necessary drivers for the board along with the TCP/IP layers needed to communicate on the network.PIC16C74 Embedded 10BaseT Ethernet CS8900

Overview of the Crystal CS8900

The Crystal CS8900 is a single chip solution capable of interfacing directly to the analog side of 10BaseT ethernet using only an isolation transformer and some passive components. The CS8900 has 4K of integrated memory allowing it to receive and send packets asynchronous to the microcontroller. This eliminates any timing issues that would normally be present and allows even the slowest microcontroller to talk on the ethernet. The CS8900 itself, is running at 20Mhz and requires an external crystal. Most ethernet transceivers operate directly on the ISA bus and use DMA to access external RAM for incoming and outgoing packets and control information. The Crystal part also operates in this mode but also has an 8 bit mode. Using this mode is similar to controlling ports in the PC architecture. For a write operation, the address is placed on the address bus, say 0×300, the data is placed on the data bus and then and then the /IOW signal is toggled. Address decode logic on one of the boards “sees” that it’s there port address (0×300) and then grabs the data from the data bus. For a read operation, the address, 0×300, is placed on the address bus and the /IOR signal is toggled, the card with this address places the data on the bus for the “in” instruction to read. This is how the CS8900 works in 8 bit mode and the default starting address for port access is 0×300 and continues to 0x30F. Notice that only 4 bits are really needed on the address bus to address all the register locations.

Other address bus pins are tied either high or low. By manipulating these 16 register locations, you can control the entire 4K of internal memory known as PacketPage memory. Essentially, the CS8900 incorporates and indirect set of registers for controlling a much larger 4K area of internal memory on the part. For example, the documentation states that the length of the frame received is at location 0×0402 and 0×0403 (The CS8900 always uses 16 bit values) so you place the value 0×0402 into the PacketPage pointer location (0xa and 0xb) and read the data from the PacketPage data location (0xc and 0xd). The actual data you’re reading is coming from the 0×0402 and 0×0403 locations within PacketPage memory. This technique is more completely described in the Crystal application note AN112.

Schematic of the embedded ethernet card shown above
This board was designed using ExpressPCB. The software for board layout design can be downloaded for free from their website and the ordering of boards is automated though the software package.

It should be mentioned that you will need to use a professionaly designed board for this project since the CS8900 is only available in a 100 pin QFP surface mount package. Don’t panic! I didn’t know anything about surface mount technology until I started this project, either. Here’s the technique I use to solder the chip to the board:

• Use a 3x/4x magnifying lamp.
• Get a soldering iron that has adjustable temperature settings, use 450-500 degrees farenheit.
• Since the CS8900 uses .020 inch spaced leads, use a tip that has a diameter less than this, I use a .015 inch tip.
• Get some flux at Radio Shack and place a very small amount on the surface mount pads.
• Get some silicon-based adhesive from Radio Shack and place a small amount on the belly of the CS8900. This will allow you to place the part and center it over the pads. Take your time and go slow.

• When the silicon hardens, heat up the iron and on the outer-edge pins, place your iron on the pad and allow a small amount of solder to flow. What we’re trying to do here is anchor the part on the four sides. Repeat for each side.

• From this point on, don’t use ANY SOLDER. The board as manufactured by ExpressPCB has been tin-lead plated and the pads already contain all the solder necessary to form a good inter-metalic bond. Merely touch the iron to each pin and allow the solder to reflow. This goes very fast and you can solder all the remaining 96 pins in under 5 minutes.

Overview of the test circuit A Microchip PIC16C74 is used to drive the CS8900 and to implement some basic TCP/IP functionallity. The test circuit, once connected to the ethernet backbone, can be pinged from another node. Also, a Windows Sockets program is included that connects to the test circuit who is listening on UDP port 7 (echo). The echo service sends back any data that it receives.

The programs are all setup to use IP address 192.168.1.2 and Ethernet address (also called an OUI- Organizationally Unique Identifier) of 00:00:00:12:34:56. Since these are ficticious numbers, you may need to change them. Two places that need modification, the program running on the PIC has equates for these values and the IP address is hard coded in the testudp.c program. If you don’t change them, and are testing under NT (recommended) you may need to add a static route using the command route add 192.168.1.2 your.ip.gateway.address. This will cause all traffic to the board to go through the default gateway of you’re local machine.

Schematic of the test circuit

PIC16C74 Embedded 10BaseT Ethernet CS8900

Embedded ethernet enables microcontroller based projects to send and receive packets over the network. The board shown on the left is actual size and incorporates all the circuitry needed to enable 10BaseT communications. The board is designed to minimize the pin count needed to interface with microcontrollers. An 8 bit data bus, 4 bit address bus, and three control signals (15 signals) with an optional interrupt signal are all that is needed to control the board. This is made possible by using the Crystal CS8900 ethernet transceiver running in 8-bit mode. All the information, schematics, and source code needed to perform TCP/IP communication over ethernet is detailed on this page. I’m using a Microchip PIC16C74 controller in this project however, any controller with enouph port capacity will also work. This would include the popular Motarola 68HC11.

The project described here is in two parts. The actual embedded ethernet board and the test circuit utilizing the PIC16C74. The code running on the PIC incorporates the necessary drivers for the board along with the TCP/IP layers needed to communicate on the network.

Overview of the Crystal CS8900

The Crystal CS8900 is a single chip solution capable of interfacing directly to the analog side of 10BaseT ethernet using only an isolation transformer and some passive components. The CS8900 has 4K of integrated memory allowing it to receive and send packets asynchronous to the microcontroller. This eliminates any timing issues that would normally be present and allows even the slowest microcontroller to talk on the ethernet. The CS8900 itself, is running at 20Mhz and requires an external crystal. Most ethernet transceivers operate directly on the ISA bus and use DMA to access external RAM for incoming and outgoing packets and control information. The Crystal part also operates in this mode but also has an 8 bit mode. Using this mode is similar to controlling ports in the PC architecture. For a write operation, the address is placed on the address bus, say 0×300, the data is placed on the data bus and then and then the /IOW signal is toggled. Address decode logic on one of the boards “sees” that it’s there port address (0×300) and then grabs the data from the data bus. For a read operation, the address, 0×300, is placed on the address bus and the /IOR signal is toggled, the card with this address places the data on the bus for the “in” instruction to read. This is how the CS8900 works in 8 bit mode and the default starting address for port access is 0×300 and continues to 0x30F. Notice that only 4 bits are really needed on the address bus to address all the register locations.

Other address bus pins are tied either high or low. By manipulating these 16 register locations, you can control the entire 4K of internal memory known as PacketPage memory. Essentially, the CS8900 incorporates and indirect set of registers for controlling a much larger 4K area of internal memory on the part. For example, the documentation states that the length of the frame received is at location 0×0402 and 0×0403 (The CS8900 always uses 16 bit values) so you place the value 0×0402 into the PacketPage pointer location (0xa and 0xb) and read the data from the PacketPage data location (0xc and 0xd). The actual data you’re reading is coming from the 0×0402 and 0×0403 locations within PacketPage memory. This technique is more completely described in the Crystal application note AN112.

Schematic of the embedded ethernet card shown above
This board was designed using ExpressPCB. The software for board layout design can be downloaded for free from their website and the ordering of boards is automated though the software package.

It should be mentioned that you will need to use a professionaly designed board for this project since the CS8900 is only available in a 100 pin QFP surface mount package. Don’t panic! I didn’t know anything about surface mount technology until I started this project, either. Here’s the technique I use to solder the chip to the board:

• Use a 3x/4x magnifying lamp.
• Get a soldering iron that has adjustable temperature settings, use 450-500 degrees farenheit.
• Since the CS8900 uses .020 inch spaced leads, use a tip that has a diameter less than this, I use a .015 inch tip.
• Get some flux at Radio Shack and place a very small amount on the surface mount pads.
• Get some silicon-based adhesive from Radio Shack and place a small amount on the belly of the CS8900. This will allow you to place the part and center it over the pads. Take your time and go slow.

• When the silicon hardens, heat up the iron and on the outer-edge pins, place your iron on the pad and allow a small amount of solder to flow. What we’re trying to do here is anchor the part on the four sides. Repeat for each side.

• From this point on, don’t use ANY SOLDER. The board as manufactured by ExpressPCB has been tin-lead plated and the pads already contain all the solder necessary to form a good inter-metalic bond. Merely touch the iron to each pin and allow the solder to reflow. This goes very fast and you can solder all the remaining 96 pins in under 5 minutes.

Overview of the test circuit A Microchip PIC16C74 is used to drive the CS8900 and to implement some basic TCP/IP functionallity. The test circuit, once connected to the ethernet backbone, can be pinged from another node. Also, a Windows Sockets program is included that connects to the test circuit who is listening on UDP port 7 (echo). The echo service sends back any data that it receives.PIC16C74 Embedded 10BaseT Ethernet CS8900 schematicThe programs are all setup to use IP address 192.168.1.2 and Ethernet address (also called an OUI- Organizationally Unique Identifier) of 00:00:00:12:34:56. Since these are ficticious numbers, you may need to change them. Two places that need modification, the program running on the PIC has equates for these values and the IP address is hard coded in the testudp.c program. If you don’t change them, and are testing under NT (recommended) you may need to add a static route using the command route add 192.168.1.2 your.ip.gateway.address. This will cause all traffic to the board to go through the default gateway of you’re local machine.

Schematic of the test circuit

In conclusion: I originally worked on this project in anticipation of selling the technology but circumstances changed and I hope that the embedded community will benifit from this work. Embedded ethernet is not without it’s problems. For example. I was planning on using an EEPROM as the storage for packet data but quickly realized that the write/erase times would not be sufficient. Typical write times are 5ms which brought the ping time for a 500 byte packet to 1.5 seconds. I believe now that the key to using this technology is to write specifically to the problem domain.

 

 

 

For more detail: PIC16C74 Embedded 10BaseT Ethernet CS8900




Current Project / Post can also be found using:

  • ethernet clock using microcontroller
  • pic controller with internet connection

Leave a Comment

*
= 5 + 4

Read previous post:
Introduction to the PIC32 using pic-microcontroller

The Microchip PIC32 is a family of complex and powerful microcontrollers that can be purchased for less than $10 in...

Close
Scroll to top