This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500, W5200 and W5100. One of them can be selected by enabling it in wiznet.h.

Fork of WIZnet_Library by WIZnet

Revision:
4:37a5586c4f64
Parent:
2:c2eb7a08d7e6
Child:
6:ca8405b9564d
diff -r 48348a6eaa72 -r 37a5586c4f64 WIZnetInterface/WIZnet/W5500.cpp
--- a/WIZnetInterface/WIZnet/W5500.cpp	Mon Jul 21 05:35:40 2014 +0000
+++ b/WIZnetInterface/WIZnet/W5500.cpp	Wed Aug 20 02:17:02 2014 +0000
@@ -189,7 +189,15 @@
     t.reset();
     t.start();
     while(1) {
-        int size = sreg<uint16_t>(socket, Sn_RX_RSR);
+        //int size = sreg<uint16_t>(socket, Sn_RX_RSR);
+        // during the reading Sn_RX_RXR, it has the possible change of this register.
+        // so read twice and get same value then use size information.
+        int size, size2;
+        do {
+            size = sreg<uint16_t>(socket, Sn_RX_RSR);
+            size2 = sreg<uint16_t>(socket, Sn_RX_RSR);
+        } while (size != size2);
+        
         if (size > req_size) {
             return size;
         }
@@ -209,7 +217,15 @@
     t.reset();
     t.start();
     while(1) {
-        int size = sreg<uint16_t>(socket, Sn_TX_FSR);
+        //int size = sreg<uint16_t>(socket, Sn_TX_FSR);
+        // during the reading Sn_TX_FSR, it has the possible change of this register.
+        // so read twice and get same value then use size information.
+        int size, size2;
+        do {
+            size = sreg<uint16_t>(socket, Sn_TX_FSR);
+            size2 = sreg<uint16_t>(socket, Sn_TX_FSR);
+        } while (size != size2);
+        
         if (size > req_size) {
             return size;
         }