energia / tivac-core

7 stars 17 forks source link

trying to begin with a static IP after DHCP fails locks up the program #10

Open robertinant opened 8 years ago

robertinant commented 8 years ago

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

robertinant commented 8 years ago

From @rei-vilo on March 31, 2015 15:41

Which MCU?

robertinant commented 8 years ago

From @rei-vilo on March 31, 2015 15:55

Thanks. So I guess you're using the CC3100 BoosterPack.

robertinant commented 8 years ago

From @jstamour802 on March 31, 2015 19:30

@rei-vilo I am using the TM4C1294XL connected launchpad and have this problem -- I'm not sure why @a-bhat1 changed the topic to something else..