Adam Dunkel's uIP on the Olimex EasyWeb2 and LPC-E2124

By Paul Curtis, Rowley Associates Limited

Welcome to the project page which contains a port of Adam Dunkel's uIP to the SoftBaugh TCP430 and the Olimex EasyWeb2. These boards are available off-the-shelf with a Crystal CS8900A Ethernet LAN chip wired to the MSP430 so you can experiment with Internet-enabled applications. Of course, you need to write those applications yourself...

As an exercise, I also ported uIP to the Olimex LPC-E2124 which uses the came Ethernet chip but replaces the MSP430 with an Philips LPC2124 based on an ARM7 core. This is a quick-and-dirty proof of concept port that doesn't use hardware for timing, just a delay loop — be warned!

Although I haven't tried it, uIP should also work on the Olimex MSP430-EasyWeb3 board. Please let me know if anybody gets it working on this board and of any changes you needed to make.

Setting the Scene

Well, I wanted to work on some embedded Internet applications and dabble.  SoftBaugh generously delivered me a TCP430 and I set to work with TI's Web Server application note and code written by Andreas Dannenberg. I started to get to grips with TCP/IP but I didn't get very far because Andreas' code was simply a minimal port, just enough to get a Web server working. It was going to be a bit more difficult...

I started writing my own code for the TCP/IP stack and got a fair way down the line, but time was against me, and I realised I'd much rather be working on applications that writing the stack.  So, I looked around for some code that fitted the bill.  Well, to cut a long story short, I found uIP.  Brilliant!  A great piece of work.

Why uIP?

Well, it was already written, that was a good point, it was targeted at small devices, and it was well documented.

I worked on the uIP port in my spare time for enjoyment during the long winter evenings when I had some spare time or needed a break from writing the latest optimization algorithms or code generation heuristics in CrossWorks for MSP430. It didn't take that long, but by no means was it a push over either.

Andreas Dannenberg's original Web Server application note is a good start and shows that the MSP430 is capable of hosting a mini web server, but it has a number of limitations which this port seeks to correct:

  • Single connection problem  Andreas' code supports only a single connection to the server at any one time. This is rather restrictive, especially if the web pages need to be viewed by multiple clients at the same time. Consider a sensor board with web access to the sensor states as a web page: you'd want to allow anybody to view these at any time. The number of simultaneous connections is configurable in uIP, which corrects this problem.

  • No IP checksum checks  No, there aren't any: incoming IP frames are just not checked. uIP verifies uIP checksums.

  • No UDP support  If you need UDP, you're out of luck with the web server code. However, uIP supports UDP datagrams.

  • Packet reassembly  Just not supported at all by Andreas' code. However, this is a configurable option in uIP. How important is it? Well, if you're accessing a web server on the MSP430 from the other side of the world over multiple segments, packets can be split by routers. You don't see packet splitting on local LANs so much. If packet reassembly isn't implemented in the TCP software on the server, then fragmented packets are thrown away. It's good to be able to rely on packet reassembly, if you need it.

  • Ready-to-run software  uIP also has support for an HTTP client, telnet server and client, and SMTP. Of course, you can write your own code too. And uIP is being ported to more and more devices, so has an active user community.

  • Free for commercial use  Buy that man a beer!

Technical Details

Before we get down to business, uIP on the Olimex LPC-E2124 takes just 12,916 bytes of code compiled with CrossWorks for ARM v1.3, and uIP on the Olimex EasyWeb2 takes just 7878 bytes of code compiled for CrossWorks for MSP430 v1.3. And, of course, all this works in less than 2K of RAM.

I used some of Andreas' code as a starting point for the CS8900A driver, but I refined it a lot to support buffer management better. I also implemented the uIP timer in the CS8900A module so that the higher layer parts of the software can know of elapsed times, which is part of uip-0.9.1 that you can get from Adam.

There is a single CrossWorks project, uip.hzp, that you should load and build. The TCP address is set in uipopt.h and the MAC address in cs8900a.c. There are two configurations of the IP address in uipopt.h which reflect my home network and the office network at Rowley Associates. You'll need to configure these yourself so that they don't clash with an address on your network. (I was going to write a DCHP client, but I just haven't had the time lately.)

As it stands, you should be able to build and load the software onto the SoftBaugh or Olimex boards and point a web browser at and see the uIP web server home page.

Future Directions

Although I've finished the port, I'd like to get uIP working on the ELEC226 board that Rice Univerity are producing for one of their courses. This has a whole bunch of peripherals on it and also an Embedded CrossConnect. It's a fine board!

If you find problems in the code, please drop me an e-mail and I'll try to help out, but I'm not an absolute whizz on the intricacies of TCP and can't guarantee anything. I can run Ethereal and, with the Stevens book by my side, can debug TCP and UDP problems given enough time, coffee, and encouragement.