Modified for W5500 Ethernet initialize Added the Ethernet interface re-initialize code Added the connection retry

Dependents:   ThingPlug_Ethernet_Example

Fork of GMMP_mbed by Eric Jung

Revision:
5:9bbb6933559b
Parent:
4:1e04850ce835
--- a/GMMP.cpp	Wed Aug 12 08:49:45 2015 +0000
+++ b/GMMP.cpp	Wed Aug 12 08:58:58 2015 +0000
@@ -54,22 +54,19 @@
 	
 	#ifdef USE_WIZNET_W5500
 	#include "WIZnetInterface.h"
-	//#include "EthernetInterface.h" // WIZnet Ethernet library replacement(W5100/W5200/W5500 -> W5500/W7500)
+	//#include "EthernetInterface.h" // WIZnet Ethernet library replacement needed (W5100/W5200/W5500 -> W5500/W7500)
 		
 	#if defined(TARGET_LPC1768) 
 		SPI spi(p5, p6, p7); // mosi, miso, sclk
 		WIZnetInterface ethernet(&spi, p8, p11);
-	#elif defined(TARGET_NUCLEO_F411RE) || defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F334R8) || defined(TARGET_NUCLEO_L152RE)
-		//char tmpbuffer1[16] = {0, };
+	#elif defined(TARGET_NUCLEO_F411RE) || defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F334R8) || defined(TARGET_NUCLEO_L152RE)		
 		SPI spi(PA_7, PA_6, PA_5); // mosi, miso, sclk					
-		WIZnetInterface ethernet(&spi, PB_6, PA_9);//scs(PB_6), nRESET(PA_9); // reset pin is dummy, don't affect any pin of WIZ550io     						
-		//WIZnetInterface ethernet(PA_7, PA_6, PA_5, PB_6, PA_9);//scs(PB_6), nRESET(PA_9);
-		//char tmpbuffer2[16] = {0, };
+		WIZnetInterface ethernet(&spi, PB_6, PA_9);//scs(PB_6), nRESET(PA_9); // reset pin is dummy, don't affect any pin of WIZ550io     								
 	#else
 		// Ethernet interface initialization code for additional platforms will be added later.
 	#endif	
 	#endif//USE_WIZNET_W5500
-#elif defined(TARGET_WIZwiki_W7500)
+#elif defined(TARGET_WIZwiki_W7500) // WIZnet Ethernet library replacement needed (W5100/W5200/W5500 -> W5500/W7500)
 	#include "EthernetInterface.h" 
 	EthernetInterface ethernet;	
 #endif
@@ -152,12 +149,10 @@
     printf("IP Address is %s\r\n", wifi.getIPAddress());
     #endif//USE_SNIC_WIFI
 
-	#ifdef USE_WIZNET_W5500	
-	//SPI spi(PA_7, PA_6, PA_5); // mosi, miso, sclk					
-	//EthernetInterface ethernet(&spi, PB_6, PA_9);//scs(PB_6), nRESET(PA_9); // reset pin is dummy, don't affect any pin of WIZ550io     				
+	#ifdef USE_WIZNET_W5500		
 	//mbed_mac_address((char *)MAC_Addr); //Use mbed mac addres
 	
-		#if defined(TARGET_NUCLEO_F411RE)		
+		#if defined(TARGET_NUCLEO_F411RE) // For SPI Test
     	//spi.format(8,3);          // Setup:  bit data, high steady state clock, 2nd edge capture
     	//spi.frequency(25000000);    // SPI Clock; 25MHz (default: 1MHz)
     	//spi.frequency(12000000);    // SPI Clock; 12.5MHz (default: 1MHz)