Comments (4)
@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:
- 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).
- 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.
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.
I have done a little bit of testing and it seems that this issue and also #904 are resolved with f97304b.
from arduinocore-mbed.
@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)
- Arduino Nicla Sense ME - SPI Slave support
- Giga Crashes if using ConnectionHandler and Scheduler.h HOT 5
- Missing WiFiClass::setHostname definition HOT 1
- error: 'WiFiAccessPoint' does not name a type,
- [ACELL02] Incomplete `library.properties` file for the GSM library
- Wrong bootloader information from factory Opta HOT 2
- Ethernet defines SSID_MAX_LENGTH HOT 1
- missing null pointer checks HOT 1
- potential null pointer access / _initializerCallback not initialized
- Nicla Voice Record_and_Stream compile fails HOT 1
- Binary constants - enum implementation, leading to severe macro-coditioning compilation errors HOT 1
- UDP Multicast crashes ethernet interface when cable is disconnected and reconnected HOT 1
- Socket Write and Close Hangs Indefinitely When There Is No Connectivity HOT 1
- Accessing mbed errors history HOT 1
- `Ethernet.dnsServerIP()` does not return the IP address I set with `Ethernet.begin()` HOT 2
- Issue with sdram.h using PLL2
- Can't have input A0 and A3 configured as interrupt on Opta HOT 5
- Giga R1 Wifi - Wifi-Access-Point only Possible with Secrets of existing WiFi-Network HOT 1
- mbed EoL HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinocore-mbed.