Description
In the past, with the Arduino-Ethernet-Shield, I used the following code to wait for ethernet connection to get available, so that I can have at least some limited functionality when ethernet is not available at this time, and automatically jump to full functionality as soon as link gets available.
void setup()
{
if (Ethernet.begin(mac) == 0)
{
FallBackMode();
}
}
void FallBackMode()
{
int Timestamp = millis();
while(1)
{
if ( millis() - Timestamp > 300000) //try reconnect every 5min
{
if (Ethernet.begin(mac, 30000) != 0) //Problem here
{
break; //successfully connected
}
Timestamp = millis();
}
//call "offline application" here, which serves all functionality that does not need Ethernet
}//ENDwhile
}
With the Nucleo 429ZI this does not work. As long as the cable is unplugged everthing is fine, but as soon as it is plugged in and ethernet gets available, the program gets locked inside the Ethernet.begin() function and never returns.
Am I misusing the function and it worked just coincidentally with the standard ethernet-shield, or is this a bug?
If this usage of the begin() function is not intended, is there another way to achieve that the board tries reconnecting itself?