9 years, 10 months ago.

class Ethernet broken ?

Hello,

I am trying to get a simple Ethernet link up/down status on a K64F. It seems to be broken. Line "Ethernet elink; gets a compiler error:

Error: Identifier "Ethernet" is undefined in "main.cpp", Line: 4, Col: 2

Sample code:

#include "mbed.h"

RawSerial pc(USBTX, USBRX);
Ethernet elink;                             //Ethernet connection used only for link status
bool EthPhyUpT = false;
int EthUpDownCnt;

int TestEthLink() {
    if(((elink.link())) && (EthPhyUpT == false)) {
        pc.printf("Eth Link UP\n");
        EthPhyUpT = true;
    } else if((!(elink.link())) && (EthPhyUpT == true)){
        pc.printf("Eth Link DOWN\n");
        EthPhyUpT = false;
        EthUpDownCnt++;
    }
    if(EthPhyUpT == true) return(1);
    return(0);
}

int main() {
    pc.baud(230400);
    while(1) {
        wait(1.0);
        TestEthLink();
    }
}

Bringing this up again.

...kevin

posted by Kevin Braun 10 Jun 2014

1 Answer

9 years, 9 months ago.

Missing include file...

include "EthernetNetIf.h"

Unfortunately Ben,

EthernetNetIf.h is not compatible with EthernetInterface.h of which I use extensively (but not shown in the example above). The code above should compile standalone as is. For instance, it compiles fine with the LPC4088QS and the LPC1768, but not with the K64F.

...kevin

posted by Kevin Braun 14 Jul 2014