Jump to content
43oh

IPv6 with the Launchpad


Recommended Posts

Hi,

 

Though I'd like to share a little project of mine, which I have spend the last couple of weeks on. It's a small IPv6 stack running on the MSP430G2553 and using Microchip's ENC28J60 as MAC/PHY. I got a breakout board for the ENC28J60 cheap off e-bay (~ 7 $) and wondered if it was possible to create a small IPv6 stack using the MSP430-value line. I know that it is a bit silly, as there both are plenty of IP stacks around for the bigger MCUs and the WizNet chips (which do TCP/IP for you) are actually cheaper than the ENC28J60. But I just had to try doing it myself :oops:

 

Now, as the 2553 only has 512 bytes of RAM I am using an external SPI SRAM chip to provide a bit more storage as an IPv6 address takes up 16 bytes and you can't get around storing around 4 or 5 of them. Currently, around 2K are used of the SPI ram.

Currently supported are basic IPv6 things such as obtaining an address from Router Advertisments (only 1, though), ICMP ping, UDP transmission, and a very simple TCP implementation that support both server and client mode.

The implementation is very rough (especially TCP), so I won't share it at this time.

 

I have implemented a small proof-of-concept demonstrating the Launchpads ability to send a simple HTTP request to a web server through the ENC28J60. In order to show this, I have created two PHP scripts. One that appends a line to a file, with a time stamp, and the other displaying the file. The latter page is reloaded once a second.

The Launchpad is programmed to send a request to the first page every time a button is pushed.

The example takes up 11162 bytes, but does contain a fair amount of debugging strings and the size could probably be brough down a bit.

The following short video-clip shows the thing working:

I'll post a bit more interesting videos of Wireshark soon.

I have a small project where I will use this, but for future projects I think I'll prefer using a WizNet chip :lol:

Link to post
Share on other sites
  • 3 months later...

Code is now available on github: https://github.com/xpgdk/net430. The code works, but has tons of issues.

Currently implemented features are:

- IPv6 Stateless autoconfiguration (based on router advertisments)
- ICMP Ping
- Simple TCP-stack
 
What really is lacking is a proper API. Currently, it's quite difficult to deal with TCP-streams in a sane way, as the handler code receives the data one packet at a time. But it is doable, just not very efficient :smile:

If anyone is interested in this, I might document the entire thing a bit further.

The following video shows a MS430G2553 with a HD44780 character display being controlled by HTTP-GET requests:

Link to post
Share on other sites
This is some impressive work!

 

Thanks

 

Does your ISP actually provide IPv6 service or is this on your LAN?

 

Unfortunately, my ISP does not provide IPv6 natively. However, I have a tunnel to the IPv6 Internet via http://www.sixxs.net/. My NAS is acting as local IPv6 router, which really isn't optimal but it works just fine.

 

What SRAM chip are you using? I have been thinking about using one but I don't see them for sale at the electronics vendors I normally use.

I'm using the 32K SPI RAM modules from Microchip, although I'm only using around 3K. I usually buy such things from Mouser, although their shipping is bit expensive for small orders.

Link to post
Share on other sites
  • 3 months later...

hello,

Can I use a static ipv6 adress?

And how can I know what the ipv6 adress of the ENC28J60 is?

 

At this point the stack only works with router advertisments that contain an IPv6 prefix. The entire IPv6 address is then defined by the combination of the

prefix and the MAC address. The steps are the following:

  1. The 48-bit MAC address is converted into a IEEE's 64-bit Extended Unique Identifier (EUI-64). There is a nice description of this procedure here: http://packetlife.net/blog/2008/aug/4/eui-64-ipv6/.
  2. Next, the 64-bit EUI-64 is combined with an 64-bit prefix to generate the entire IPv6 address: PPPP:PPPP:PPPP:PPPP:XXXX:XXXX:XXXX:XXXX, where P's are bits from the prefix, and X's are bits from the EUI-64.

That being said, it should be quite simple to modify the stack to use a static IPv6 address.

The ENC28J60 chip comes without a pre-programmed MAC address, so you have to provide a MAC address of your own. Unless you are planning on distributing your solution you can simply construct a valid MAC address yourself. If you need a MAC address for serious stuff, I guess Microchip is willing to sell you a whole range (or you could register at the IANA for a vendor prefix).

Link to post
Share on other sites

Note: Your GitHub account is no longer accessible.

 

Now, as the 2553 only has 512 bytes of RAM I am using an external SPI SRAM chip to provide a bit more storage as an IPv6 address takes up 16 bytes and you can't get around storing around 4 or 5 of them. Currently, around 2K are used of the SPI ram.

 

And IPv6 requires a minimum packet size of 1280 bytes. Generally, you need to implement at least two of those buffers (one for RX, one for TX).

 

Anyway, if we see an MSP430F5529 Launchpad in the future, this would be a pretty nice demo.

 

Did you invent your IPv6 stack or did you start with something like uIP?

Link to post
Share on other sites

Note: Your GitHub account is no longer accessible.


Hmm... strange, I have no problem accessing it. I'll look into it.

 


Anyway, if we see an MSP430F5529 Launchpad in the future, this would be a pretty nice demo.

 

Did you invent your IPv6 stack or did you start with something like uIP?

 

I did the IPv6-stack from scratch, mainly due to the fact that it had to work with external memory. Of course, it was fun doing it as well. For any system that has enough memory I think I would be using uIP

Link to post
Share on other sites

 

 

Hmm... strange, I have no problem accessing it. I'll look into it.

 

I did the IPv6-stack from scratch, mainly due to the fact that it had to work with external memory. Of course, it was fun doing it as well. For any system that has enough memory I think I would be using uIP

 

It seems to be up now... I suppose there was a GitHub error last night.

 

uIP is sort of "the stick in the ground," but IMO think it's sort of a top-down approach more than it needs to be.  That said, at the moment I have no interest in writing my own IP stack, so it wins in that respect.  :)

 

Anyway, nice work.  Have you looked at CoAP?

Link to post
Share on other sites

It seems to be up now... I suppose there was a GitHub error last night.

Great.

 

uIP is sort of "the stick in the ground," but IMO think it's sort of a top-down approach more than it needs to be.  That said, at the moment I have no interest in writing my own IP stack, so it wins in that respect.   :smile:

I think it is possible create something that has a slightly nicer API than uIP. However, if it is going to run in the same amount of ROM/RAM as uIP there is not that much room for improvement. lwIP is much more flexible than uIP but it also more hungry when it comes to RAM and ROM. Writing stuff like this from scratch is a really good learning experience, but that's about it. Getting things like TCP right takes time unless you are already very familiar with the details. That being said, I am considering adding IPv4 capabilities to my stack just to see if it is possible to add DHCP without increasing the flash footprint too much.

I actually have a single instance of my stack that has been running for 3+ months now. It doesn't do much, but it does it quite well: When it receives a signal from a RF-module it sends a HTTP request.

 

Anyway, nice work.  Have you looked at CoAP?

Thanks. Haven't heard about CoAP before now. It looks really interesting. Thanks for pointing me in that direction.

I am currently playing around with a couple of CC2500 modules and trying to build a small sensor network where MSP430 Launchpads are attached to various kind of sensors, and send data back to a Stellaris Launchpad, which then in turn relays the data on to some kind of database system. CoAP might fit nicely in.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...