Simple Webserver example for wiznet W5500 (SPI Ethernet chip) mbed OS 5 - HTTP 1.1 and multi-threaded
Dependencies: W5500Interface easy-connect mbed-http
Fork of http-webserver-example by
mbed-os-example-http-server
This application demonstrates how to run an HTTP server on an mbed OS 5 device & WIZnet W5500 Ethernet components.
Request parsing is done through [nodejs/http-parser](https://github.com/nodejs/http-parser).
To build
- Open ``mbed_app.json`` and change the `network-interface` option to your connectivity method ([more info](https://github.com/ARMmbed/easy-connect)).
- Build the project in the online compiler or using mbed CLI.
- Flash the project to your development board.
- Attach a serial monitor to your board to see the debug messages.
Tested on
- NUCLEO_F411RE with W5500 Ethernet shield.
- For W5500, you need the following libraries.
Import libraryW5500Interface
W5500 driver for mbed OS 5
Import libraryeasy-connect
Modified version of easy-connect for W5500 Ethernet components
But every networking stack that supports the [mbed OS 5 NetworkInterface API](https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/communication/network_sockets/) should work.
Test Result
mbed_app.json@5:ac9aebd61a31, 2018-08-10 (annotated)
- Committer:
- Bongjun
- Date:
- Fri Aug 10 08:52:29 2018 +0000
- Revision:
- 5:ac9aebd61a31
- Parent:
- 2:c8eff436549f
remove some comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jan Jongboom |
0:41f820ea137a | 1 | { |
Jan Jongboom |
0:41f820ea137a | 2 | "config": { |
Bongjun | 2:c8eff436549f | 3 | "network-interface":{ |
Bongjun | 2:c8eff436549f | 4 | "help": "options are ETHERNET, ETHERNET_W5500, WIFI_ESP8266, WIFI_ODIN, MESH_LOWPAN_ND, MESH_THREAD", |
Bongjun | 2:c8eff436549f | 5 | "value": "ETHERNET_W5500" |
Jan Jongboom |
0:41f820ea137a | 6 | }, |
Jan Jongboom |
0:41f820ea137a | 7 | "mesh_radio_type": { |
Jan Jongboom |
0:41f820ea137a | 8 | "help": "options are ATMEL, MCR20, SPIRIT1, EFR32", |
Jan Jongboom |
0:41f820ea137a | 9 | "value": "ATMEL" |
Jan Jongboom |
0:41f820ea137a | 10 | }, |
Jan Jongboom |
0:41f820ea137a | 11 | "esp8266-tx": { |
Jan Jongboom |
0:41f820ea137a | 12 | "help": "Pin used as TX (connects to ESP8266 RX)", |
Jan Jongboom |
0:41f820ea137a | 13 | "value": "D1" |
Jan Jongboom |
0:41f820ea137a | 14 | }, |
Jan Jongboom |
0:41f820ea137a | 15 | "esp8266-rx": { |
Jan Jongboom |
0:41f820ea137a | 16 | "help": "Pin used as RX (connects to ESP8266 TX)", |
Jan Jongboom |
0:41f820ea137a | 17 | "value": "D0" |
Jan Jongboom |
0:41f820ea137a | 18 | }, |
Jan Jongboom |
0:41f820ea137a | 19 | "esp8266-debug": { |
Jan Jongboom |
0:41f820ea137a | 20 | "value": true |
Jan Jongboom |
0:41f820ea137a | 21 | }, |
Jan Jongboom |
0:41f820ea137a | 22 | "wifi-ssid": { |
Jan Jongboom |
0:41f820ea137a | 23 | "value": "\"SSID\"" |
Jan Jongboom |
0:41f820ea137a | 24 | }, |
Jan Jongboom |
0:41f820ea137a | 25 | "wifi-password": { |
Jan Jongboom |
0:41f820ea137a | 26 | "value": "\"Password\"" |
Jan Jongboom |
0:41f820ea137a | 27 | } |
Jan Jongboom |
0:41f820ea137a | 28 | }, |
Jan Jongboom |
0:41f820ea137a | 29 | "target_overrides": { |
Jan Jongboom |
0:41f820ea137a | 30 | "*": { |
Jan Jongboom |
0:41f820ea137a | 31 | "target.features_add": ["NANOSTACK", "LOWPAN_ROUTER", "COMMON_PAL"], |
Bongjun | 2:c8eff436549f | 32 | "platform.stdio-baud-rate": 115200, |
Bongjun | 2:c8eff436549f | 33 | "platform.stdio-convert-newlines": true, |
Jan Jongboom |
0:41f820ea137a | 34 | "mbed-mesh-api.6lowpan-nd-channel-page": 0, |
Jan Jongboom |
0:41f820ea137a | 35 | "mbed-mesh-api.6lowpan-nd-channel": 12, |
Bongjun | 2:c8eff436549f | 36 | "mbed-trace.enable": 0 |
Jan Jongboom |
0:41f820ea137a | 37 | }, |
Jan Jongboom |
0:41f820ea137a | 38 | "HEXIWEAR": { |
Jan Jongboom |
0:41f820ea137a | 39 | "esp8266-tx": "PTD3", |
Jan Jongboom |
0:41f820ea137a | 40 | "esp8266-rx": "PTD2" |
Jan Jongboom |
0:41f820ea137a | 41 | }, |
Jan Jongboom |
0:41f820ea137a | 42 | "NUCLEO_F401RE": { |
Jan Jongboom |
0:41f820ea137a | 43 | "esp8266-tx": "D8", |
Jan Jongboom |
0:41f820ea137a | 44 | "esp8266-rx": "D2" |
Jan Jongboom |
0:41f820ea137a | 45 | }, |
Jan Jongboom |
0:41f820ea137a | 46 | "NUCLEO_F411RE": { |
Jan Jongboom |
0:41f820ea137a | 47 | "esp8266-tx": "D8", |
Jan Jongboom |
0:41f820ea137a | 48 | "esp8266-rx": "D2" |
Jan Jongboom |
0:41f820ea137a | 49 | } |
Jan Jongboom |
0:41f820ea137a | 50 | } |
Jan Jongboom |
0:41f820ea137a | 51 | } |