WIZnetInterface for ARMmbed

This is an Ethernet Interface library port-based on EthernetInterface. This is where the driver using TCP/IP offload (W5500/W7500), which is a market-proven hardwired TCP/IP stack, is implemented. Therefore, this library does not need lwip-eth.library. The Socket folder contains files that implement the SocketAPI and Protocols as like DHCP and DNS. The arch folder contains files that implement the driver for W5500 and W7500x_TOE. The EthernetInterface.c/.h implement the functions from SocketAPI/EthernetInterface.h The eth_arch.h implement to select TCP/IP TOE depending on platform.
ORIGINAL POST
By Soohwan Kim
components
Hardware Components
WIZnet W7500
X 1
details

Ethernet1.png

This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500 and TCP/IP Offload Engine, W7500. Users » embeddist » Code » WIZnetInterface-> WIZnetInterface Lib will be released on Team WIZnet

  • WIZwiki_W7500
  • Platforms » WIZwiki-W7500
  • W5500 Ethernet Shield

What is this?

This is an Ethernet Interface library port-based on EthernetInterface. This is where the driver using TCP/IP offload (W5500/W7500), which is a market-proven hardwired TCP/IP stack, is implemented. Therefore, this library does not need lwip-eth.library.

  • The Socket folder contains files that implement the SocketAPI and Protocols as like DHCP and DNS.
  • The arch folder contains files that implement the driver for W5500 and W7500x_TOE.
  • The EthernetInterface.c/.h implement the functions from SocketAPI/EthernetInterface.h
  • The eth_arch.h implement to select TCP/IP TOE depending on platform.

What is new?

  • eth_arch.hThe eth_arch.h file is added to select arch depending to Target platform, we used define of TARGET_platform.#if defined(TARGET_WIZwiki_W7500) #include "W7500x_toe.h" #define __DEF_USED_IC101AG__ //For using IC+101AG@WIZwiki-W7500 #else #include "W5500.h" // W5500 Ethernet Shield //#define USE_WIZ550IO_MAC // WIZ550io; using the MAC address #endif
  • link()The link function is added to check Ethernet link (PHY) up or not. * Check if an ethernet link is pressent or not. * * @returns true if successful */ bool link(int wait_time_ms= 3*1000);
  • link_set()The set_link function is added to check Ethernet link (PHY) up or not. /* * Sets the speed and duplex parameters of an ethernet link. * * @returns true if successful */ void set_link(PHYMode phymode);
  • Included DHCP and DNS lib DHCP and DNS lib moved in Socket folder.

How to import

  • import and update
  • Right Click and click ‘From Import Wizard’ to import WIZnetInterface Library
  • In import Wizard, input ‘WIZnetInterface” in search box and click ‘Search’ button. Click ‘WIZnetInterface’ in search result window and click ‘Import’ button.
  • Set ‘Import name’ and ‘Target path’, check ‘update’

Where is Clone repository

hg clone https://embeddist@developer.mbed.org/users/embeddist/code/WIZnetInterface/

How to use

  • make main.cpp
  • WIZwiki_W7500#define _DHCP_ EthernetInterface eth; /*1. Creat eth object from EthernetInteface class*/ main() { uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x01, 0x02, 0x03}; /*2. Set MAC, IP, Gatway address and Subnet Mask*/ #ifdef _DHCP_ /*2.1 Set MAC address, Initialize the interface with DHCP*/ eth.init(mac_addr); #else /*2.2 Set MAC address and Set MAC, IP, Gatway address and Subnet Mask with string type */ eth.init(mac_addr, "192.168.77.34", "255.255.255.0", "192.168.77.1"); //Use fixed IP address #endif /*3. Check Ethernet Link-Done */ printf("Check Ethernet Linkrn"); if(eth.link() == true) { printf("- Ethernet PHY Link-Done rn"); } else {printf("- Ethernet PHY Link- Failrn");} /*4. Set IP addresses ,start DHCP if needed */ eth.connect(); printf("Connected, IP: %snr", eth.getIPAddress()); printf("MASK: %snr", eth.getNetworkMask()); printf("GW: %snr",eth.getGateway()); ... /* Your application Visit for examples - https://developer.mbed.org/teams/WIZnet/ */ }
  • W5500 Ethernet Shield#define _DHCP_ /* 0. Set SPI Interface with SPI API*/ SPI spi(D11, D12, D13); // mosi, miso, sclk /*1. Creat eth object from EthernetInteface class*/ EthernetInterface eth(&spi, D10, D9); // spi, cs, reset main() { uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x1D, 0x62, 0x11}; /*2. Set MAC, IP, Gatway address and Subnet Mask*/ #ifdef _DHCP_ /*2.1 Set MAC address, Initialize the interface with DHCP*/ eth.init(mac_addr); #else /*2.2 Set MAC address and Set MAC, IP, Gatway address and Subnet Mask with string type */ eth.init(mac_addr, "192.168.77.34", "255.255.255.0", "192.168.77.1"); //Use fixed IP address #endif /*3. Check Ethernet Link-Done */ printf("Check Ethernet Linkrn"); if(eth.link() == true) { printf("- Ethernet PHY Link-Done rn"); } else {printf("- Ethernet PHY Link- Failrn");} /*4. Set IP addresses ,start DHCP if needed */ eth.connect(); printf("Connected, IP: %snr", eth.getIPAddress()); printf("MASK: %snr", eth.getNetworkMask()); printf("GW: %snr",eth.getGateway()); ... /* Your application Visit for examples - https://developer.mbed.org/teams/WIZnet/ */ }

WIZnetInterface Implementations for mbed Ethenret Interface

For networking based on Ethernet network, Ethernet Interface library is provided and is composed TCP/IP Protocol layer, Ethernet, EthernetInterface and Socket. In other words, the EthernetInterface library includes the networking stack necessary for connect between mbed platform and Internet.

Each layer in EthernetInterface provides APIs to connect to the internet.

Ethernet1.png

This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500 and TCP/IP Offload Engine, W7500. Users » embeddist » Code » WIZnetInterface-> WIZnetInterface Lib will be released on Team WIZnet

  • WIZwiki_W7500
  • Platforms » WIZwiki-W7500
  • W5500 Ethernet Shield

What is this?

This is an Ethernet Interface library port-based on EthernetInterface. This is where the driver using TCP/IP offload (W5500/W7500), which is a market-proven hardwired TCP/IP stack, is implemented. Therefore, this library does not need lwip-eth.library.

  • The Socket folder contains files that implement the SocketAPI and Protocols as like DHCP and DNS.
  • The arch folder contains files that implement the driver for W5500 and W7500x_TOE.
  • The EthernetInterface.c/.h implement the functions from SocketAPI/EthernetInterface.h
  • The eth_arch.h implement to select TCP/IP TOE depending on platform.

What is new?

  • eth_arch.hThe eth_arch.h file is added to select arch depending to Target platform, we used define of TARGET_platform.#if defined(TARGET_WIZwiki_W7500) #include "W7500x_toe.h" #define __DEF_USED_IC101AG__ //For using IC+101AG@WIZwiki-W7500 #else #include "W5500.h" // W5500 Ethernet Shield //#define USE_WIZ550IO_MAC // WIZ550io; using the MAC address #endif
  • link()The link function is added to check Ethernet link (PHY) up or not. * Check if an ethernet link is pressent or not. * * @returns true if successful */ bool link(int wait_time_ms= 3*1000);
  • link_set()The set_link function is added to check Ethernet link (PHY) up or not. /* * Sets the speed and duplex parameters of an ethernet link. * * @returns true if successful */ void set_link(PHYMode phymode);
  • Included DHCP and DNS lib DHCP and DNS lib moved in Socket folder.

How to import

  • import and update
  • Right Click and click ‘From Import Wizard’ to import WIZnetInterface Library
  • In import Wizard, input ‘WIZnetInterface” in search box and click ‘Search’ button. Click ‘WIZnetInterface’ in search result window and click ‘Import’ button.
  • Set ‘Import name’ and ‘Target path’, check ‘update’

Where is Clone repository

hg clone https://embeddist@developer.mbed.org/users/embeddist/code/WIZnetInterface/

How to use

  • make main.cpp
  • WIZwiki_W7500#define _DHCP_ EthernetInterface eth; /*1. Creat eth object from EthernetInteface class*/ main() { uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x01, 0x02, 0x03}; /*2. Set MAC, IP, Gatway address and Subnet Mask*/ #ifdef _DHCP_ /*2.1 Set MAC address, Initialize the interface with DHCP*/ eth.init(mac_addr); #else /*2.2 Set MAC address and Set MAC, IP, Gatway address and Subnet Mask with string type */ eth.init(mac_addr, "192.168.77.34", "255.255.255.0", "192.168.77.1"); //Use fixed IP address #endif /*3. Check Ethernet Link-Done */ printf("Check Ethernet Linkrn"); if(eth.link() == true) { printf("- Ethernet PHY Link-Done rn"); } else {printf("- Ethernet PHY Link- Failrn");} /*4. Set IP addresses ,start DHCP if needed */ eth.connect(); printf("Connected, IP: %snr", eth.getIPAddress()); printf("MASK: %snr", eth.getNetworkMask()); printf("GW: %snr",eth.getGateway()); ... /* Your application Visit for examples - https://developer.mbed.org/teams/WIZnet/ */ }
  • W5500 Ethernet Shield#define _DHCP_ /* 0. Set SPI Interface with SPI API*/ SPI spi(D11, D12, D13); // mosi, miso, sclk /*1. Creat eth object from EthernetInteface class*/ EthernetInterface eth(&spi, D10, D9); // spi, cs, reset main() { uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x1D, 0x62, 0x11}; /*2. Set MAC, IP, Gatway address and Subnet Mask*/ #ifdef _DHCP_ /*2.1 Set MAC address, Initialize the interface with DHCP*/ eth.init(mac_addr); #else /*2.2 Set MAC address and Set MAC, IP, Gatway address and Subnet Mask with string type */ eth.init(mac_addr, "192.168.77.34", "255.255.255.0", "192.168.77.1"); //Use fixed IP address #endif /*3. Check Ethernet Link-Done */ printf("Check Ethernet Linkrn"); if(eth.link() == true) { printf("- Ethernet PHY Link-Done rn"); } else {printf("- Ethernet PHY Link- Failrn");} /*4. Set IP addresses ,start DHCP if needed */ eth.connect(); printf("Connected, IP: %snr", eth.getIPAddress()); printf("MASK: %snr", eth.getNetworkMask()); printf("GW: %snr",eth.getGateway()); ... /* Your application Visit for examples - https://developer.mbed.org/teams/WIZnet/ */ }

WIZnetInterface Implementations for mbed Ethenret Interface

For networking based on Ethernet network, Ethernet Interface library is provided and is composed TCP/IP Protocol layer, Ethernet, EthernetInterface and Socket. In other words, the EthernetInterface library includes the networking stack necessary for connect between mbed platform and Internet.

Each layer in EthernetInterface provides APIs to connect to the internet.

COMMENTS

Please Login to comment
  Subscribe  
Notify of