November
2004, Issue 172
TCP/IP
Stack Solution
A
Detailed Look at the CMX-MicroNet
If
you need more than a minimal TCP/IP stack for your
next application, consider using the CMX-MicroNet,
which is a stack designed for microcontrollers that
have small amounts of data and program memory. This
month, Fred describes the CMX-MicroNet’s behavior.
by
Fred Eady
As
many of you already know, when I’m not putting words
into Circuit Cellar magazine I’m moonlighting at EDTP
Electronics, which is focused on designing and marketing
inexpensive microcontroller-based Ethernet devices from
an Internet-based storefront. As a Circuit Cellar columnist
and an electronic barkeep (I’m the “support” behind
support@edtp.com), I’m in direct contact with many of
you. Aside from enjoying shooting the breeze, I also
like that I get to know firsthand what you’re interested
in and what problems you’re facing. Hopefully, that
makes my Circuit Cellar columns interesting to you.
The
line of Easy Ethernet devices are all supported by a
minimal homebrewed TCP/IP-UDP implementation. The baseline
Easy Ethernet products are powered by 40-pin PIC and
Atmel microcontrollers that contain between 368 (PIC16F877)
and 1,024 bytes (ATmega16) of RAM complemented by 8
(PIC16F877) and 16 KB (ATmega16) of program flash memory.
That means the Easy Ethernet Internet protocol and application
code must be minimized to leave enough program memory
space and RAM for your application code.
To
accommodate those of you who need a bit more application
space, I employed the services of Microchip’s next generation
of microcontrollers, the PIC18xxxx series. Atmel coders
were also considered in the upgrade process because
an easy migration path up from the ATmega16 used on
the Easy Ethernet AVR is provided by the pin-compatible
ATmega32, which doubles the amount of RAM and program
flash memory contained in the ATmega16. When moving
from the PIC16F877 to the PIC18F452, the Microchip PIC18xxxx
coder gains a little more than 1 KB of RAM while matching
the Atmel coder’s 32 KB of program flash memory.
I
didn’t design the TCP/IP stack for industrial use. The
mini stack I wrote is intended to show you that complicated
TCP/IP stuff can be done on the cheap with simple code.
My simplistic TCP/IP stack works well both in a local
LAN environment and on the big wire. However, I’ve seen
many of you, especially college students, make modifications
and add features to my little garage-built TCP/IP-UDP
stack to improve its usability (and to finish those
senior projects).
For
more demanding applications, it may be advantageous
to deploy a more robust TCP/IP stack. However, in a
microcontroller environment, space is always constrained,
and you still will be faced with squeezing in just enough
stack to support your application. That means the stack
you choose or write must be modular. For instance, if
you don’t need FTP, there shouldn’t be useless FTP code
floating around taking up space in your stack. Another
point to consider is the setting up and tuning of the
stack. The stack’s knobs and buttons should be located
in a logical place. They also should be easy to understand
and use.
Writing
a serious TCP/IP stack is not child’s play. If you’re
not into rolling your own TCP/IP stack, and if you need
a bit more than a minimal TCP/IP stack for your application,
CMX Systems is a good place to start.