Adjusted Initialization of MAC address

Fork of WIZnetInterface by WIZnet

Files at this revision

API Documentation at this revision

Comitter:
sgnezdov
Date:
Thu Jun 29 18:58:37 2017 +0000
Parent:
29:c91884bd2713
Commit message:
Adjusted WIZnetInterface initialization to properly work with DHCP no-DHCP and use hardware mac address option

Changed in this revision

Socket/TCPSocketConnection.cpp Show annotated file Show diff for this revision Revisions of this file
arch/ext/W5500.cpp Show annotated file Show diff for this revision Revisions of this file
eth_arch.h Show annotated file Show diff for this revision Revisions of this file
--- a/Socket/TCPSocketConnection.cpp	Tue Nov 17 06:35:55 2015 +0000
+++ b/Socket/TCPSocketConnection.cpp	Thu Jun 29 18:58:37 2017 +0000
@@ -34,14 +34,14 @@
     if (_sock_fd < 0) {
         _sock_fd = eth->new_socket();
         if (_sock_fd < 0) {
-            return -1;
+            return -2;
         }
     }
     if (set_address(host, port) != 0) {
-        return -1;
+        return -3;
     }
     if (!eth->connect(_sock_fd, get_address(), port)) {
-        return -1;
+        return -4;
     }
     set_blocking(false);
     // add code refer from EthernetInterface.
--- a/arch/ext/W5500.cpp	Tue Nov 17 06:35:55 2015 +0000
+++ b/arch/ext/W5500.cpp	Thu Jun 29 18:58:37 2017 +0000
@@ -167,9 +167,8 @@
     reset_pin = 1;
     wait_ms(400); // 400ms (w5500)
 #if defined(USE_WIZ550IO_MAC)
-	// write MAC address inside the WZTOE MAC address register
-    reg_wr_mac(SHAR, mac);
 #endif
+
     // set RX and TX buffer size
 #if 0
     for (int socket = 0; socket < MAX_SOCK_NUM; socket++) {
@@ -177,6 +176,10 @@
         sreg<uint8_t>(socket, Sn_TXBUF_SIZE, 2);
     }
 #endif
+
+	// write MAC address inside the WZTOE MAC address register
+    reg_wr_mac(SHAR, mac);
+
 }
 
 
--- a/eth_arch.h	Tue Nov 17 06:35:55 2015 +0000
+++ b/eth_arch.h	Thu Jun 29 18:58:37 2017 +0000
@@ -30,6 +30,6 @@
 
 #else
 #include "W5500.h"            // W5500 Ethernet Shield 
-//#define USE_WIZ550IO_MAC    // WIZ550io; using the MAC address
+// #define USE_WIZ550IO_MAC    // WIZ550io; using the MAC address
 
 #endif