Thursday, September 29, 2011

Grinch Border Router - routing HTTP traffic

In my last post devoted to Grinch Border Router I described how to forward pings through the router. However the router wasn't capable of sending much more than standard size pings. It wasn't possible to route any IPv6 packet larger than 152 bytes. I blamed it on Zigbit's limited memory, and decided to get a new module with Atmega128RFA1.

However in the meantime I had some problems with my DSLR and decided to try, and repair it myself. I failed miserably and damaged the power board of the camera, and had to send it to the professionaI support. I had to pay for the new power board, and had no cash for the RFA1 modules, so I decided to work on the Zigbit a little bit more :) . It quickly turned out, that Zigbit has enough memory for everything. I just had to turn off the webserver, and I managed to fit the full 1280-byte buffer for the packets. I also had to correct some bugs:

  • Debug comments - debug comments in AVR can be put either into flash memory, or RAM memory. RAM is faster, but very limited, so I was using primarily flash comments. This significantly slowed down the microcontroller, so that it was not possible to send 6lowpan fragmented packets. After turning off all debug comments the border has enough processing power to forward packets that need fragmentation.
  • ENC28J60 driver bug - the driver has a config parameter MAX_FRAMELEN which limits maximum packet size. In my first build it was set to 500 bytes. It made HTTP communication impossible.
  • In my first build the interrupts were turned off when receiving packets from ENC28J60. I changed it to turn off interrupts also when sending packets. The stability of the Grinch Border Router increased greatly (works for several hours without freezing).

After these changes the Grinch has become quite usable as a border router. It is possible to access Raven webserver from the PC almost every time. Also large 1232 byte pings are forwarded without problems. The router is still not ready for the deployment, but it's perfectly ready for testing of wireless sensor networks.

Next thing to do is the automatic discovery of Grinch in the network. For that Router Advertisements are needed. I still haven't modified this part of Contiki to support multiple interfaces, but it shouldn't be hard. I also plan to run some long tests of the router to see how stable it is.