Porting the uIP tcp/ip stack to the msp430 (easyweb3)

Share

Introduction

I recently purchased an olimex easyweb 3 and wanted to get it working.

However, I had no luck whatsoever with any of the software listed on the olimex site. Only 1 builds with mspgcc, and that didn’t work.

I had heard good things about uIP and was happy to find that there was a port for my board by Paul Curtis of Rowley Associates.

There were 2 problems with this.
1. It was for an old version of uIP (0.9).
2. It was for some expensive IDE that Rowley Associates sell.

So I set about modifying Curtis’ port to work with my compiler and uIP version.

Tools

To get a cross compilation environment set up, I basically followed this rather helpful guide from linuxjournal.com.

Unfortunately the versions provided by cdk4msp (the prebuilt binary packages of mspgcc, etc) were rather old. This seemed to cause problems with a particular part of the http server code from uIP (something bizarre to do with initializing structures which only occurred when -fpack-struct was enabled (turning it off is also likely to be a bad move)).

These problems aside, cdk4msp seems to provide me with something that can build software for the msp430 and download it successfully.

Changes

I decided to remove the majority of the stuff from Curtis’ package and get it down to the very simplest working system. Instead of httpd (which has some problems with my version of mspgcc), I decided to use uIP’s “hello world” application which listens on port 1000 and does little.

Other than deleting lots of files, the first change was to the makefile. Basically just modifying it to build the correct files, to be aware of some changes to the layout of uIP between 0.9 and 1.0 and to use the mspgcc compiler.

A small change was required at the end of cs8900a.c to make it declare the interrupt service routine in the way that mspgcc expects. Also, in the same file, the declaration of InitSeq needed fixing (I have no idea why it was broken).

With this done, I built and downloaded (following the linuxjournal guide) the thing to the board. It responded to ARP requests (which is further than I got with the demo program), but would not respond to pings or tcp connections.
After a lot of debugging and confusion, I eventually found that the problem was caused by the ethernet chip being initialised with 1 mac address and uIP returning a completely different one to ARP requests. I have modified main.c, so this no longer occurs.

With this fixed, the program works, responding to pings and accepting tcp connections to port 1000. :D

The code


A copy of the code can be found here. A binary (named uip) is included for your convenience.
This code should work fine on an easyweb2, also.
This program uses the ip 172.16.0.30. You may modify this in main.c. The MAC address is set in uip-conf.h.
You will need uIP version 1.0 (or possibly later) and the mspgcc compiler.
Unpack uIP and then unpack my code as a subdirectory of the uIP directory.

What next?


My next project will probably involve writing an application to run on uIP that will allow me to read and write the gpio pins over the network (and possibly read the ADC too). This could be useful for all kinds of projects.

I might even write an htcpcp server for it… lol.

Contact


For help and support (not guaranteed in any way), either comment here or email me at the address below.

Purchasing the board


The board can be ordered directly from olimex, or from coolcomponents.co.uk (seems to be cheaper, if you’re in the uk).


Share

Tags: , , , , ,

Leave a Reply