What is a good microcontroller for doing Ethernet applications? Or do I just need a good Ethernet library to connect with an Ethernet MAC/PHY?
Microchip's PIC18s with built-in ethernet are excellent for this, just add a magjack (or other connector with built in magnetics) and download their TCP/IP stack. You'll be pinging things in no time. For more grunt, the PIC24 and PIC32 also have TCP/IP stacks designed to run with one of the SPI Ethernet MAC/PHY parts they offer (ENC624J600 or ENC628J60).
ST also recently enhanced their ARM Cortex based STM32 line to include on-chip ethernet, but you'll need an external PHY and magnetics. It's an option if you're already looking at the PIC32.
Regarding having a TCP/IP stack, there are three projects you should look at:
- The Contiki Operating System
Contiki is an open source, highly portable, multi-tasking operating system for memory-efficient networked embedded systems and wireless sensor networks. Contiki has been used is a variety of projects, such as road tunnel fire monitoring, intrusion detection, water monitoring in the Baltic Sea, and in surveillance networks.
Contiki is designed for microcontrollers with small amounts of memory. A typical Contiki configuration is 2 kilobytes of RAM and 40 kilobytes of ROM.
- The uIP TCP/IP Stack:
The open-source uIP TCP/IP stack provides TCP/IP connectivity to tiny embedded 8-bit microcontrollers, with maintained interoperability and RFC standards compliance.
- The lwIP TCP/IP Stack:
Much faster than uIP but harder to get started with
Generally Ethernet is not built into microcontrollers. First you need a jack which can convert Ethernet signals into signals read by a microcontroller (this is generally called 'magnetics'). Then you need a TCP/IP stack, and then on top of that you need DHCP, DNS and whatever other protocols you want to use. So the actual microcontroller you use doesn't matter a whole lot. If you get something very powerful like an ARM with Linux running on it, then developing for it would be very simple, almost the same as writing a network application running on a desktop PC running Linux. Or you could go with something less powerful & cheaper like an AVR or PIC.
Ethernet and TCP/IP can be quite complex if you want to implement an entire TCP/IP stack in software. One common solution is to use something like Wiznet's W5100 chip, which handles all the low level TCP/IP stuff for you. You can buy it in a pre-made module that includes the ethernet connector and everything for pretty cheap, around $20 for the WIZ812MJ module. You can communicate with it using only SPI, so it won't take a lot of I/O pins on your microcontroller.
Lantronix also provides some more powerful modules that look even simpler to use, but they are a bit more pricey ($50-$100 depending on the model). See their XPort for example.
ARMs are the microcontrollers of the day, and NXP has a wide offering of them. This web page lists literally too many Ethernet controllers to mention all here, as of this date (2011-07-13):
17 ARM7 devices
2 ARM9 devices
16 Cortex-M3 devices
I moved the ARM advantages discussion to this answer.
Microchip have a number of Pic microcontrollers with inbuilt ethernet capabilities, there's a list here. They also have a series of pages concerning design solutions for ethernet and their products here, which also includes details of their full TCP/IP stack (with integrated MAC and PHY).
Hope this helps.
Lots of the TI Luminary microcontrollers (ARM Cortex-M3) have an onboard ethernet MAC. It needs an external crystal and ethernet PHY (connector + magnetics).
GCC and openOCD (JTAG flashing/debugging) support them well and they're pretty cheap in quantity.
They have cheap hardware devkits too...
Depending on just how easy you want to make your life I would recommend using an MBED and purchasing a magjack and ethernet breakout board (see sparkfun) for connecting up the cable and dealing with the signal conditioning. The supporting model is the mbed NXP LPC1768.
I managed to get an mbed sending data to my remote server (ie. over the internet) in about 2 hours from a standing start.
It depends what you want to do with it. The main thing to look out for is the amount of RAM (can limit individual message size) and if you want to serve web pages then the amount of storage available for that. I use an Arduino Duemilanova http://www.arduino.cc/ - ATMega328 micro controller, 2Kbytes RAM. You can connect up a SD card if you want significant storage. The ethernet shield will support upto 4 concurrent sessions. Don't expect to be able to serve up complex pages but works fine uploading to Pachube, twitter etc.
For a more powerful solution look at Marvell Plug
The nanode is open source and only £22 / $40 shipped. I've just bought two for home energy/environmental monitoring via pachube.
30 second pitch from the site:
Nanode is an open source Arduino-like board that has in-built web connectivity. It connects to a range of wireless, wired and ethernet interfaces. It allows you to develop web based sensor and control systems - giving you web access to six analogue sensor lines and six digital I/O lines. It is an easy build it yourself kit. Nanode was designed with Hacking in mind.
I've tried the microchip stack using the picdem.net 2 develpment card and i was not satisfied at all, it's not optimised and not well documented.
I think that the best solution in market now is Wiznet that have the first Ethernet based TCP/IP hardware chip that save a lot of time and give you more efficiency
This link gives all the solutions available and compare them:
I'm late to the party here but I recommend the TI Stellaris EK-LM3S6965. It's an ARM Cortex M3 part with built-in Ethernet controller including PHY. For prototyping I used their evaluation kit, which has an Ethernet jack, small OLED display (great for debugging and barebones UI), SD card slot, speaker, buttons, LEDs and breakouts for wiring stuff up to the micro's peripherals. You didn't describe your application (i.e., looking to produce tens of thousands of something or a one-off hobby project), but pricing is reasonable (~$70 for the dev board, $12-15 in small quantities for just the chips), they come with an OK set of development libraries if you want to do your own firmware or it can run FreeRTOS (required a tiny bit of porting due to minor hardware revs between my board revision and the stuff in the FreeRTOS distro) and eLua. You can use either uIP or lwIP for TCP/IP.
Compared to popular hobbyist offerings like AVR/Arduino and PIC the Cortex M3 is a 32-bit part, runs at 50MHz, the 6965 has a lot of I/O features, IMO for the money it is just amazing how much computing power and how many features you can get out of something so tiny and cheap. It is pretty raw on the development side, however, and you must know C (well, unless you run eLua). I'm a software developer by trade and do my ARM development on a Mac, so I'm not afraid of scary/inconvenient toolchain setups and used Make + arm-eabi-gcc + OpenOCD for debugging, but if you are a Windows guy maybe the Code Composer Studio bundle would be a good bet. I used TI's Code Composer IDE for a fun MSP430 experimental project and it was fine by me and had an easier workflow than my OSX/ARM setup. They have about a half-dozen board bundles with different development tools, so you can pick your poison.
Full-disclosure, I haven't actually designed a PCB around this chip that used the Ethernet controller, but I did a board that didn't use the Ethernet and had a good experience with that, and I have built Ethernet-enabled projects using the evaluation board.
UPDATE Sep 2013
These parts seem to be no longer recommended for new designs. There don't seem to be any obvious replacements.
UPDATE Nov 2013
There's now a TM4C129XNCZAD which is nominally a replacement for the above part - it has onboard MAC + PHY, albeit not pin compatible - however a lot of people are reluctant to use it after the issues/confusion over the LM3S early life discontinuation / availability.
It may not be 100% what this question is asking, but for projects where the production runs are fairly small I've started to see people embedding pre-built boards like the raspberry pi. This has a lot of advantages:
- The price isn't too much more than one of the higher end CPUs with ethernet (at least for low-volumes), and you skip a whole load of design/test/bring up issues.
- The raspberry PI is already CE/EMC tested, so that cuts out a whole load of uncertainty (otherwise ethernet & fast clocks can throw up a bunch of EMC issues). You still have to test your final product, but at least there's a whole area that really shouldn't cause a failure.
- You get a lot more grunt and a proper, server grade TCP/IP stack if you use linux etc - none of these "only one active connection allowed" type things!
As I say, it's not for everyone, but for some projects it can be a good fit.
There's a few options in terms of the exact board used around:
You can use almost any MCU with Wiznet W5500 embedded MAC + PHY controller, it is driven by SPI. The advantages are: it has built-in network stack, Tx/Rx buffers, requires minimum MCU pins, simplified programming.
I just found another interesting option - AX88796C from ASIX, it also has both MAC + PHY, 10\100Mbps Ethernet and up to 40MHz SPI interface option, so looks nice fit for any ARM based MCU.
UPDATE: Netduino 3 is already using this chip, here are interesting details:
If you have any experience with firmware I would recommend the STM32F4Discovery board with the STM32F4DIS-EXT board. I recently used this to create a configuration webpage for my device and it was fairly easy. There is a lwIP example project available online and if you google "makefsdata" you will find a lot of information about how to generate the necessary files for your own HTML files. Message me if you need more info.
I like the (25 EUR) Openpicus FlyportPro ethernet module for that purpose. Just add an ethernet jack with magnetics and create your firmware using their TCP/IP stack. They have a TLS implementation as well:
I did a project using the 'classic' Flyport ethernet and it's been rock solid so far.