Networking

New networking stack

Note that this page refers to the new officially supported networking stack, which is designed to supercede the previous networking stack.

Most networking examples on mbed still rely on the old stack, but all new stack development will take place on this version.

Introduction

The mbed microcontroller is capable of connecting to the internet, and functioning as client or server for a variety of protocols. To achieve this, the LwIP TCP/IP stack has been ported to mbed.

Getting started

Step one, physical connection

On the RJ45 page you will find wiring diagrams for popular RJ45 sockets. You can skip this step if you have a baseboard with RJ45 socket (see list of baseboards on the cookbook homepage).

Step two, set up the networking stack

On the Ethernet Interface page you will find everything you need to set an IP address, and bring up the stack.

Next steps

Afterwards, you should hopefully have TCP/IP up and running over Ethernet.

Where to look next:

About this networking stack

The introduction of an mbed RTOS among the officially supported mbed libraries allowed us to finally add an officially supported networking stack providing the familiar Berkeley sockets programming interface. The previously community supported networking stacks, because of the lack of an operating system, could only support a "polling" paradigm. Besides, providing a more familiar programming interface, this new networking stack provides an impressive performance improvement: benchmark.

System overview

/media/uploads/emilmont/layers.png

Let's analyse the above layers from top down:

Interface drivers

The networking stack is currently supporting two different transports:

Where to get help

If you have questions on the usage of this stack, the best place to ask is in the Forum.




4 related questions:


8 comments:

» Show archived comment by fernandomachado
20 Aug 2012

At your,

"Getting started

Step one, physical connection

On the RJ45 page ...", the link "RJ45" is broken.

» Show archived comment by emilmont
20 Aug 2012

Hi Fernando,

Fernando Machado wrote:

On the RJ45 page ...", the link "RJ45" is broken.

Thanks for reporting it: fixed.

Cheers, Emilio

» Show archived comment by leodee
09 Sep 2012

Hi

Not quite sure why, but this library appears to confict with the keypad library somehow - just including the new network library in a bare keypad project stops the keypad working. No compile errors, it just doesn't work

any ideas?

» Show archived comment by leodee
10 Sep 2012

same with the ConfigFile library

very strange, as I can't think of why either of these libraries would stop working as result of a new network protocol

» Show archived comment by timexton
02 Nov 2012

Hi I'm having serious trouble getting Ethernet to work using the new EthernetInterface/mbed_rtos/mbed libary set. This is on hardware which works perfectly with the old EthernetNet scheme of things. Cutting back to something stable I am fairly sure the example project TCPSocket_HelloWorld does not work with EthernetInterface Rev25, mbed_rtos Rev5 and mbed Rev43.

To me it is like the chips are net being initialised or geared up for a different chip.

Do you have any ideas?

» Show archived comment by timexton
02 Nov 2012

I have always said software was put on this earth to make you look an idiot. Found the problem - obscure hole in the wire!! Don't Panic.

» Show archived comment by Ludviche38
18 Sep 2013

Tim Exton-McGuinness wrote:

Hi I'm having serious trouble getting Ethernet to work using the new EthernetInterface/mbed_rtos/mbed libary set. This is on hardware which works perfectly with the old EthernetNet scheme of things. Cutting back to something stable I am fairly sure the example project TCPSocket_HelloWorld does not work with EthernetInterface Rev25, mbed_rtos Rev5 and mbed Rev43.

To me it is like the chips are net being initialised or geared up for a different chip.

Do you have any ideas?

» Show archived comment by emilmont
18 Sep 2013

PERONNET Ludovic wrote:

TCPSocket_HelloWorld does not work with EthernetInterface Rev25, mbed_rtos Rev5 and mbed Rev43.

Do you have any ideas?

No, I do not know why this combination of revisions from August and October 2012 does not work:

  • EthernetInterface Rev25: 13 Aug 2012
  • mbed_rtos Rev5: 03 Aug 2012
  • mbed Rev43: 26 Oct 2012

I tried the latest revision:

Import programTCPSocket_HelloWorld

TCP Socket Hello World with Ethernet

And it seems to work well:

IP Address is 10.2.200.27
Received 299 chars from server:
HTTP/1.1 200 OK
Server: nginx/1.1.19
Date: Wed, 18 Sep 2013 15:16:01 GMT
Content-Type: text/plain
Connection: close
Last-Modified: Fri, 27 Jul 2012 13:30:34 GMT
Cache-Control: max-age=36000
Expires: Wed, 18 Sep 2013 16:54:22 GMT
Vary: Accept-Encoding
X-Mystery-Header: 1125861752
X-be: web
Received 40 chars from server:
1_prod_sjc
Age: 30099

Hello world!

Is there any particular reason why you have to use that particular mix of revisions from 2012?

Cheers, Emilio

Posting new comments for this page has been disabled