Git Product home page Git Product logo

Comments (4)

maidnl avatar maidnl commented on July 18, 2024

@Channel59 thank you for submitting this problem.
The patch should solve it. I have just a couple of remarks about the way you replicate the problem:

  1. your DHCP server must be configured in a way that the OPTA gets always the same ip address (so that at a certain MAC address is always associated the same ip address). Otherwise OPTA could be assigned a different ip address and you so fail the ping because you are using the wrong IP address (the old one).
  2. DHCP assign address could take a bit so it is maybe useful to wait just a little after the interface goes up, before to ping again the device
    Thanks!

from arduinocore-mbed.

Channel59 avatar Channel59 commented on July 18, 2024

Dear @maidnl,

Thank you very much for taking the time to investigate this problem. I agree with your remarks regarding the replication of the problem.

I have tested your patch and it seems like the issue is partly resolved.
After applying this patch on ArduinoCore-mbed 4.0.10 and the mbed-os-arduino 4.0.10, it seems that the network interface of the opta does not get stuck after the first iteration of the shell script to test the Opta.

However, the opta can still become unresponsive quite easily, using e.g. this code:

#include <Arduino.h>
#include "EthernetInterface.h"
#include "mbed.h"
auto net = EthernetInterface::get_default_instance();

void setup(){
    net->set_blocking(true);
    net->set_dhcp(true);
    net->connect();
}

void loop() {
    rtos::ThisThread::sleep_for(1000);
}

and by simply using this commands (or unplugging the ethernet cable for 3 seconds and re-plugging it):

sudo ifconfig eth0 down && sleep 3 && sudo ifconfig eth0 up

This is already enough to break it, however re-running this will also restore the connecition

With static IP there is no issue it seems.

or with this more elaborate script, including your wait time:

#!/bin/bash

opta=192.168.0.100
eth=eth0

for i in {1..2000}
do
        for j in {1..5}
        do
                t_down=$((500 + $RANDOM % 5000))
                t_up=$((1000 + $RANDOM % 2000))
                echo -ne "_"
                ifconfig $eth down
                ./usleep $(($t_down * 1000))
                echo -ne "\b-"
                ifconfig $eth up
                ./usleep $(($t_up * 1000))
                echo -ne "\b."
        done

        if (( $t_up<3000 )); then
                t_wait=$((3000 - t_up))
                ./usleep $(($t_wait * 1000))
        fi
	sleep 2
        if ping -c 1 $opta &> /dev/null
        then
                echo -n "|"
        else
                echo "X"
                exit 1
        fi
done

(Use e.g. this for usleep: https://github.com/pklaus/usleep-binary)

In this case, another ethernet interface down/up from the host seems to resolve the problem and the opta starts sending DHCP requests again and obtains an ip.

It seems there is still something stange going on with the DHCP.

As a side-note, that may or may not be related, I have done some more testing of the Opta in the context of ethernet disconnect/reconnects, and have found an issue that is seems to be related UDP multicast (see:#904). I assume the DHCP uses somewhere under the hood also some UDP multicast socket, and thus these issues might be related / the same.

from arduinocore-mbed.

Channel59 avatar Channel59 commented on July 18, 2024

I have done a little bit of testing and it seems that this issue and also #904 are resolved with f97304b.

from arduinocore-mbed.

maidnl avatar maidnl commented on July 18, 2024

@Channel59 Thank you for test it, we hoped that this would fix this problem.

This issue is then closes thanks to commit 97304bffff1852de6ebf10ccbb941f431b70b16

from arduinocore-mbed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.