EthernetInterface cannot connect when initiated from separate thread

13 Dec 2017

I have the following code:

    EthernetInterface eth;
    printf("Network Task Starting in context %p\r\n", Thread::gettid());
    printf("Connecting to network\r\n");
    int ethStatus = eth.connect();
    if(ethStatus != NSAPI_ERROR_OK)
    {
        printf("Failed to connect, reason:%s(-%04d)\r\n", nsapi_error_to_str(ethStatus), -ethStatus);
    }
    printf("\r\nThe target IP address is '%s'\r\n", eth.get_ip_address());

When I run this from main(), everything is fine, however when I run this from my task:

Thread threadComm(osPriorityNormal, 65536, NULL, "comm_thread");
threadComm.start(networkTask);

I get "Failed to connect, reason:NO_CONNECTION(-3004)"

This is on mbed-os 5.6 (5f65721), on a NUCLEO-F767ZI

Is this expected?

05 Feb 2018

Hi

Can you check https://github.com/ARMmbed/mbed-os/issues/5699

and tell us if the issue still occur with latest mbed release ?

Thx

05 Feb 2018

Hi

Can you check https://github.com/ARMmbed/mbed-os/issues/5699

and tell us if the issue still occur with latest mbed release ?

Thx

Jerome