EthernetInterface Library

15 Mar 2013

Horst Hevert wrote:

Hi, I miss two functions. With the old version of EthernetNetIf I control the physical port state.

eth.link() = returns the current ethernet port state (link or no link).

eth.set_link() = sets the ethernet port parameter speed and duplex mode.

Do you plan to implement these functions in the future ?

Best regards, Horst

PS: Please excuse my bad english!

+1 for this, especially the eth.link(). Unless someone knows of another way to get the link and speed led status from the PHY. I know they are connected to P1_25 and P1_26 but DigitalIn(P1_25) seems to kill the mbed.

Adrian.

15 Mar 2013

Do you mean this?

#define FIO1PIN (LPC_GPIO1->FIOPIN)
DigitalOut Green(p30), Yellow(p29);

//put in main loop
            Green = !(FIO1PIN&(1<<25));//link
            Yellow= !(FIO1PIN&(1<<26));//speed

16 Mar 2013

That can read the pin input, thanks. But the value doesn't seem to change. If I unplug the ethernet cable there is no change to either input state.

29 May 2013

Hi,

you say, the old stack is deprecated. Unfortunately, the new, still lacks stability.

Just tested TCPSocket_HelloWorld and occupied it with a simple ping -s2000 ip Well, ist stoped working after only a few packets.

Also gave HTTPServer_echoback a try. It seems to be more robust, but only till you send it the mentioned pings AND visit it's web page.

I was hoping for a more stable library for my upcoming project. Can you say something about the timeline? When do you expect the new, officially supported, high performing AND stable library to be ready?

Jan

02 Oct 2013

Is there a way to actually do Ethernet and not TCP/IP ?

27 Oct 2013

I compiled the UDP example.

It's not calculating the ethernet frame checksum /media/uploads/lawless/udp_cap.png .

which is the last four bytes of the packet.

12 Nov 2013

issue: more than 3 sockets

I have an application that requires multiple network connections (4 UDP sockets) and I have trouble implementing this (LPC1768). I wrote some questions in the "questions" section, and started a forum discussion, but nobody replied yet.

Can anyone confirm this behaviour - or can anyone refute it, meaning you have an app with 4+ sockets ? any help appreciated

thanks, Matthias

05 May 2014

It seems as though this library has recently been updated, to support the K64F platform. Has this library been fully tested in this platform?

I am presently struggling to get the TCPSocket_HelloWorld example to work.

Earlier in the week I was seeing that the connect() function was always returning an error (-1), regardless of whether I using DHCP or static. Now, for some unexplained reason, the init() function never returns.

[EDIT] I figured out my issue with init() not returning. Apparently my using a printf() immediate preceding calling init() was to blame. Inserted a 1 second delay between the two calls and this minor issue is resolved.

I still, however, continue to experience problems with connect() returning -1.

Thanks, Cameron

05 Sep 2014

Cameron, did you ever get this working? I'm using the following simple code:

#include "mbed.h"
#include "EthernetInterface.h"

int main()
{
    printf( "Starting...\r\n");
    
    EthernetInterface interface;
    if( 0 != interface.init( "192.168.2.88", "255.255.255.0", "192.168.2.3")) {
        printf( "init failed\r\n");
        return -1;
    } else {
        printf( "init succeeded\r\n");
    }
    if( 0 != interface.connect()) {
        printf( "connect failed\r\n");
        return -1;
    } else {
        printf( "connect succeeded\r\n");
    }
}

Like you, I always get -1 when I call connect(). However, if I use DHCP, connect() succeeds.

I wonder if the non-DHCP code in this library broke recently?

EDIT - I just noticed something interesting. Even though connect() times out with an error, I can ping the device at the new IP address. What could this mean?

13 Oct 2014

This problem Would not been resolved yet?

Matt Lesslaw wrote:

I compiled the UDP example.

It's not calculating the ethernet frame checksum /media/uploads/lawless/udp_cap.png .

which is the last four bytes of the packet.

10 Nov 2014

Oh yes I'm having the same problem, how can you report a bug here.

Hiroki Mihara wrote:

This problem Would not been resolved yet?

Matt Lesslaw wrote:

I compiled the UDP example.

It's not calculating the ethernet frame checksum /media/uploads/lawless/udp_cap.png .

which is the last four bytes of the packet.

05 Jan 2015

Hi,

In the first example your link is out of date, it should read:

GET http://developer.mbed.org/media/uploads/mbed_official/hello.txt HTTP/1.0\n\n

at the moment it just references

char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";

which won't work if you are outside the ARM network.

Dan

10 Feb 2015

Hi,

Can this library be made to work with the F411RE?

I imported the library in a project running on F411RE and I got this error:

The Ethernet Interface library is not supported on this target

  1. if !defined(TARGET_LPC1768) && !defined(TARGET_LPC4088) && !defined(TARGET_LPC4088_DM) && !defined(TARGET_K64F) && !defined(TARGET_RZ_A1H)
  2. error The Ethernet Interface library is not supported on this target
  3. endif
10 Feb 2015

No, EthernetInterface is only for the boards listed there, who have an integrated Ethernet peripheral. The F411 does not have this (at least I don't think it has one, for sure it is not supported). You will need an external ethernet board with its own library.

17 Feb 2015

Erik - wrote:

No, EthernetInterface is only for the boards listed there, who have an integrated Ethernet peripheral. The F411 does not have this (at least I don't think it has one, for sure it is not supported). You will need an external ethernet board with its own library.

I have recently been playing around with an Arduino Ethernet Shield on top of an nRF51-DK board and got a few basic examples working using the WizNet Library - however, based on the statement above; are there plans in the EthernetInterface library to work look at the possibility of external ethernet support so developers can utilise the lwip implementation and any other goodies that are built on top of the low level eth implementations? currently; each of these "own libraries" are done in different ways or limited in functionality due to the requirements based on what has been implemented by the associated developers - fragmentation is going to blow out here.

technically; one could fork the repo and integrate their own support based on the primary board (ie: TARGET_NRF51_DK) and assume that the external ethernet (shield or connector) is correctly attached; it would be interesting to know the teams plans for how to possibly include modular drivers for cases where integrated ethernet peripherals are not available.

Aaron

17 Feb 2015

a possible idea here would be to define a driver target definition such as:

TARGET_EXTERNAL_SPI_W5100

which makes it clear it is an external component using an SPI interface - the developer would simply specify the corresponding pinout uses for SPI (MOSI, MISO, SCLK, CS). for example; using the nRF51-DK with the WizNet library the configuration connected to the arduino headers provided was as simple as

SPI spi(P0_25, P0_28, P0_29); mosi, miso, sclk WIZnetInterface eth(&spi, P0_24, P0_0); spi, cs, reset

while it may not seem an obvious thing right now - you can imagine the possibilities when there is a desire to take advantage of anything that it built on top of lwip (more notably; IPv6) :) most of these external boards provide a basic TCP/UDP layers and in addition to raw modes (IPRAW and MACRAW) - but naturally the provided drivers may not be yet fully exploiting this.

Aaron

17 Feb 2015

The advantage of the WIZnet chip is that the TCP/UDP stack is integrated in the chip. The LWIP stack could be used, but this is not dependent on EthernetInterface. That is for built-in ethernet for MCUs. In principle there is nothing stopping anyone from publishing a library which uses the LWIP interface, minus that for the WIZnet device it simply is way, way easier not to do it.

17 Feb 2015

a valid argument; but unfortunately not all libraries are created equal - a baseline recommendation would be a good start. however I am forward thinking here - how long will we stick with IPv4 and how far away is IPv6 from being available in lwip (if it isn't there already). the provided TCP and UDP implementations (chip level) will fall behind.

Aaron

15 Jun 2015

<</quote>>

Horst Hevert wrote:

Hi, I miss two functions. With the old version of EthernetNetIf I control the physical port state.

eth.link() = returns the current ethernet port state (link or no link).

eth.set_link() = sets the ethernet port parameter speed and duplex mode.

Do you plan to implement these functions in the future ?

I also need these functions. I need to communicate whith a device that works at 10 mbit and not negotiate the link. Is there a workaround to set the link speed?

02 Jul 2015

Dan Cohen wrote:

In the first example your link is out of date, it should read:

GET http://developer.mbed.org/media/uploads/mbed_official/hello.txt HTTP/1.0\n\n

at the moment it just references

char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";

which won't work if you are outside the ARM network.

I can't reproduce the problem, and I'm outside the ARM network, but I do suggest that the "server" name in the example be changed from mbed.org to developer.mbed.org, as the specified HTML file has been moved. The example still works but it's a little less exciting when you get a "301 Moved Permanently" instead of "Hello world!"

23 Jul 2015

I've been testing Ethernet performance on the mbed LPC1768 with both SPI-based wiz820io and the native ethernet. I'm real impressed with the native implementation. On a 100Base-T local net, I measured 8-byte UDP round-trip latency at 292us. The LPC1768 could send 1000-byte UDP packets at 39.7 mbs (megabits/sec) and TCP packets (1000-byte write's) at 25.4 mbs. TCP receive rate was 19.3 mbs. The UDP receive rate was measured with a rate-limiting transmitter, and the rate was limited until 20 1000-byte UDP packets were received with no loss, strangely, the max in-bound lossless rate was only 1.7 mbs.

The wiznet performance is limited by the byte-oriented SPI rates (with the SPI clock at 24mhz, the program sees a max rate of 6mbs. (SPI library needs a DMA implementation). UDP latency was 1392us with the SPI CLK at 1mhz. UDP send rate was 0.8 mbs, and receive rate only 0.08 mbs (TCP was 0.9 and 0.3 mbs). With SPI CLK at 24mhz, UDP and TCP send rates were 5.9 mbs (but TCP library would send a RST on close, and abort the receiver at 24mhz clock?). UDP receive would not work at 24mhz. And the wiz library had another bug that would prevent it from sending UDP packets, unless it had first received a UDP packet from the destination?? tcpdump showed no packets on the wire, even though the UDP send's were completing normally.

I've run similar tests on the wiz820io on other MCU's (many with DMA-based SPI), results at https://github.com/manitou48/DUEZoo/blob/master/wizperf.txt

25 Apr 2016

Hello, I use this library on FRDM-K64F. Why does it take a long time (approx. 15 seconds) to execute eth.init() with static IP, mask and gateway set? DHCP on the other hand is processed within a second. MBED LPC1768 and WIZwiki-W7500(P) do this like a piece of cake, using a static address. Thank you, Mary

14 Jun 2016

Does this work on any of the Nucleo-FRxxx boards?

14 Jun 2016

Hi,

I use EthernetInterface library and its work fine except when i want to use Serial attach, my mbed K64F crash.

I try with Serial readable+getc in my main while its work but if i try en ticker with the same Serial readable+getc the mbed crash.

I dont know why ...

24 Oct 2016

The static IP is buggy for FRDM K64F in the last revision (11 may 2016)

You must use this patch if you want it working :

https://github.com/ARMmbed/mbed-os/pull/1645

Regards

29 Oct 2016

I am trying to read a text file from my server by changing the following lines in the example code: sock.connect("xyz.com", 80); char http_cmd[] = "GET /api/xyz.txt HTTP/1.0\n\n";

I get a 401 bad request error when I try to run the code. Can anyone point out the problem here?

29 Oct 2016

Randall Darden wrote:

Dan Cohen wrote:

In the first example your link is out of date, it should read:

GET http://developer.mbed.org/media/uploads/mbed_official/hello.txt HTTP/1.0\n\n

at the moment it just references

char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";

which won't work if you are outside the ARM network.

I can't reproduce the problem, and I'm outside the ARM network, but I do suggest that the "server" name in the example be changed from mbed.org to developer.mbed.org, as the specified HTML file has been moved. The example still works but it's a little less exciting when you get a "301 Moved Permanently" instead of "Hello world!"

Will this code be able to read files from any other server or they have to be hosted on mbed's server? I am getting the following error when I try to read a text file from my server.

IP Address is 192.168.1.88 Received 299 chars from server: HTTP/1.1 404 Not Found Date: Sat, 29 Oct 2016 05:02:56 GMT Server: Apache/2.4.18 (Unix) OpenSSL/1.0.1k-fips mod_bwlimited/1.4 Accept-Ranges: bytes Connection: close Content-Type: text/html

31 Oct 2016

Hi. When will it be possible to use this library on ST NUCLEO-F767ZI ? Or which steps should be done to get this work? Same question for DISCO-769I. I use mbed-cli. Thank you.

08 Dec 2016

When trying to compile on the K64F these two errors occur:

Error: Struct "_enet_handle" has no field "rxBdDirty" in "EthernetInterface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c", Line: 86, Col: 19

and

Error: Struct "_enet_handle" has no field "rxBdDirty" in "EthernetInterface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c", Line: 89, Col: 19
09 Oct 2017

Mary Jane wrote:

Hi. When will it be possible to use this library on ST NUCLEO-F767ZI ?

Same question. I need tcp client. Is it real to do this using mbed libraries?