7 years, 2 months ago.

EthernetInterface unreliable on NUCLEO-F746ZG board

I've tranlated my UDP server code that already works on an mbed LPC1768 board to the NUCLEO-F746ZG board, using the EthernetInterface in mbed-os, but it doesn't work reliably; after reset it (most of the times) responds, but then after some time is hangs.

The same happens with the HTTP server example code (mbed-os-tcp-server-example). It sometimes responds, but hangs most of the time.

I've no time to debug this, just wanted to know if someone has found the same behavior and a fix for it.

Kind regards, Rolf

My simple UDP server

int main() {
    EthernetInterface eth;
    SocketAddress client;
    char buffer[256];

    eth.connect(); 
    UDPSocket server;
    server.open(&eth);

    while ( server.bind(PORT) != 0);  
    
    while (true) {     
        int n = server.recvfrom(&client, buffer, sizeof(buffer));       
        if (n>0) {   
          if (!strncmp(buffer,"id\n",3)) {
            server.sendto(client, "hello\n", 6);
          } else {
            server.sendto(client, "unknown\n", 8);
          }      
       }
    }
}

Question relating to:

STM32 Nucleo-144 development board with STM32F746ZGT6 MCU, supports Arduino, ST Zio and morpho connectivity

2 Answers

5 years, 12 months ago.

have similar issue. 1) eth.connect is difficult to get IP address and it needs to reset multiple time to get IP address. 2) only send one packet out every one minute, but it will stop send packet out after several hours.

MCU is still working, no crash, but no idea what happen.

7 years, 1 month ago.

Hello, i also have similar problems when sending and receiving Udp Messages at these high speeds near every ms. What i have observed is, that the time for execution to receive a message in non blocking mode varies strange over time. Its like a perfect ramp function with negative slope changing from 1ms down to approx 100us during a timespan of 3 seconds or so. See the attached plot. Y-axis is time in us, x-axis is time in seconds. The peak at -21.2 seconds occurs always, when an incoming packet has arrived.

used code

    debugTimer.reset();
    debugTimer.start();
    sendBytesCount = socket.sendto(udp_server_address, (char *)&messageOutBuffer, sizeof(messageOutBuffer));
    channels[SEND_TIMER] = (float)debugTimer.read_us();

    debugTimer.reset();
    debugTimer.start();
    channels[RECEIVED_BYTES_COUNT] = (float)socket.recvfrom(&dump_address, (char *)&messageInBuffer, sizeof(messageInBuffer));
    channels[RECEIVE_TIMER] = (float)debugTimer.read_us();

Link to the image in better resolution: https://ibb.co/ffLPrF

https://preview.ibb.co/d02tka/UDP.png