Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethernet shield startup problem if no internet connection #201

Open
mgnthe54 opened this issue Jul 7, 2022 · 4 comments
Open

Ethernet shield startup problem if no internet connection #201

mgnthe54 opened this issue Jul 7, 2022 · 4 comments
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@mgnthe54
Copy link

mgnthe54 commented Jul 7, 2022

Hello, I use Arduino Mega with w5100 and w5500 Ethernet shields. And the Ethernet library v2.0.
If the Ethernet cable (or internet does not work when booting the Arduino)
The Arduino reboots without stopping it remains blocked on the instruction: error= Ethernet.begin(mac); then reboot , it does not pass following the code:

if (error == 0) Ethernet. begin(mac, ip); // force the ip address if not acquired by box

Does version 2.0.1 fix this problem?
If not, how can this problem be corrected?
Thanks

@JAndrassy
Copy link
Contributor

JAndrassy commented Jul 7, 2022

Ethernet.begin(mac) requests IP address from a DHCP server so of course it fails without connection to network.
How did you determine that it hangs in Ethernet.begin(mac, ip)?

2.0.1 doesn't fix anything, it just doesn't have one compilation warning which confused users.

@mgnthe54
Copy link
Author

mgnthe54 commented Jul 7, 2022

Hello, to determine where it was not working I inserted different messages in different places of the program using Serial.println "messages";
Of course I also have this as parameters:

#define SECRET_MAC {0x90,0xA2,0xDA,0x0D,0xC1,0xC1} // here your MAC address...

byte mac[]=SECRET_MAC; // variable for your MAC address

IPAddress ip(192,168,1,145); // The default IP address that the shield will take if the box does not assign an IP.

If you reconnect the ethernet cable it works fine. But normally if the DHCP of the box does not respond the shield should initialize with IPAddress.

@JAndrassy
Copy link
Contributor

If you reconnect the ethernet cable it works fine. But normally if the DHCP of the box does not respond the shield should initialize with IPAddress.

yes. and it does for me and for others a.f.a.i.k.
so what is different in your test?

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Jul 7, 2022
@mgnthe54
Copy link
Author

mgnthe54 commented Jul 7, 2022

Yes normally without dhcp, the shield should initialize with ipAdress (fixed ip) but this is not the case it crashes after a short waiting time, then it reboots and that without stopping!

I can send you if you wish the code of the sketch.
But I'm not the only one to encounter this problem, some suddenly apparently use the Ethernet2 library, but I send emails and the library that allows me to send emails (emailsender) is currently only compatible with the Ethernet! library.
I would have to try with an Arduino (normal not a mega) to see if the problem recurs too. But now I'm on vacation for 3 weeks...
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants