"EthernetInterface.h" library is not working for FRDMK66F Micocontroller

I am trying to use the “EthernetInterface.h” library on FRDMK66F Microcontroller for Socket communication. But the compiler is giving the following error -

Error: #error directive: The Ethernet Interface library is not supported on this target in “EthernetInterface/EthernetInterface.h”, Line: 24, Col: 3

when I look into the “EthernetInterface.h” header file, it does not include FRDMK66F,

#if !defined(TARGET_LPC1768) && !defined(TARGET_LPC4088) && !defined(TARGET_LPC4088_DM) && !defined(TARGET_K64F) && !defined(TARGET_RZ_A1H) && !defined(TARGET_VK_RZ_A1H) && !defined(TARGET_STM32F4)
#error The Ethernet Interface library is not supported on this target

I am using TCP/IP example from this link -

Instead of “EthernetInterface.h” can I use any other library?

The lib was for mbed2, when you are using mbed6 now, this example will help:

Thank you for your suggesition. The program compilation was successful but it was not able to establish the connection.

In the mbed_app.json file, MACRO is given for the FRDMK64F. I could not found the macro for FRDMK66F.

“K64F”: {
“target.macros_add” : [“MBEDTLS_SHA1_C”]

Can anyone suggest a good working example for the FRDMK66F Microcontroller socket communication?


The mbed-os-example-socket works fine for my FRDM-K66F board.

$ git clone https://github.com/ARMmbed/mbed-os-example-sockets
$ cd mbed-os-example-sockets
$ mbed deploy

I added K66F config in the mbed_app.json:

        "K64F": {
            "target.macros_add" : ["MBEDTLS_SHA1_C"]
        "K66F": {
            "target.macros_add" : ["MBEDTLS_SHA1_C"]

and compiled by Mbed CLI:

$ mbed compile -m k66f -t gcc_arm
$ cp ./BUILD/K66F/GCC_ARM/mbed-os-example-sockets.bin /Volumes/FRDM-K66FD 

I got log below:

Starting socket demo

Connecting to the network...
IP address: XXX.YYY.80.75
Gateway: XXX.YYY.64.1

Resolve hostname ifconfig.io
ifconfig.io address is
Opening connection to remote port 80

Sending message: 
GET / HTTP/1.1
Host: ifconfig.io
Connection: close

sent 56 bytes
Complete message sent
received 100 bytes:
HTTP/1.1 200 OK

Demo concluded successfully