You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My program stops working if DHCP fails and I try to begin with a static IP. If you try to call ethernet.begin(mac,IP) after DHCP fails, the program locks up.
The "DHCP chat server example" demonstrates this - if you have no DHCP it never begins with the static IP and moves beyond the setup loop
void setup() {
// open the serial port
Serial.begin(9600);
Serial.println("\n\nDhcpChatServer setup");
// start the Ethernet connection:
Serial.println("Trying to get an IP address using DHCP");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// initialize the ethernet device not using DHCP**************never gets past this point!!!************
Ethernet.begin(mac, ip, gateway, subnet);
}
// print your local IP address:
Serial.print("My IP address: ");
ip = Ethernet.localIP();
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(ip[thisByte], DEC);
Serial.print(".");
}
Serial.println();
// start listening for clients
server.begin();
From @jstamour802 on March 31, 2015 15:30
using the TM4C1294 connected launchpad..
My program stops working if DHCP fails and I try to begin with a static IP. If you try to call ethernet.begin(mac,IP) after DHCP fails, the program locks up.
The "DHCP chat server example" demonstrates this - if you have no DHCP it never begins with the static IP and moves beyond the setup loop
void setup() {
// open the serial port
Serial.begin(9600);
Serial.println("\n\nDhcpChatServer setup");
// start the Ethernet connection:
Serial.println("Trying to get an IP address using DHCP");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// initialize the ethernet device not using DHCP**************never gets past this point!!!************
Ethernet.begin(mac, ip, gateway, subnet);
}
// print your local IP address:
Serial.print("My IP address: ");
ip = Ethernet.localIP();
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(ip[thisByte], DEC);
Serial.print(".");
}
Serial.println();
// start listening for clients
server.begin();
}
Copied from original issue: energia/Energia#594
The text was updated successfully, but these errors were encountered: