Code reading this is taken from W5100 official site. Here you are the function reading TX_FSR value:
@brief get socket TX free buf size
This gives free buffer size of transmit buffer. This is the data size that user can transmit.
User shuold check this value first and control the size of transmitting data
uint16 getSn_TX_FSR(SOCKET s)
val1 = IINCHIP_READ(Sn_TX_FSR0(s));
val1 = (val1 << 8) + IINCHIP_READ(Sn_TX_FSR0(s) + 1);
if (val1 != 0)
val = IINCHIP_READ(Sn_TX_FSR0(s));
val = (val << 8) + IINCHIP_READ(Sn_TX_FSR0(s) + 1);
} while (val != val1);
IINCHIP_READ() is implemented just as reading data from address since so far I used FMC (Flexible Memory Controller) and treat WIZ811 (W5100) as external static memory.
Connection between WIZ811 and PC goes trough TP-LINK swtich. I’ve tested with both cable from router (with the Internet) connected and disconnected. Testes told me that it doesn’t matter. I didn’t checked it with direct connection between WIZ811 and PC so far - will do it. Wireshar is running on the PC.
Regarding lost packets - I thought that if packet was lost, packet retransmittion is done. RTR = 4000, RCR = 5 so I guess if WIZ811 didn’t get ACK it should retransmit data packet within 400ms but it waits ~2800ms to take any action. And the action is sending next packet in a raw.
Will do soon. I decided to put aside FMC for now and generate all address, data and strobe signals on it own, I mean by driving GPIOs. I will set correct timings.
BTW, which timings are correct? This one from W811MJ or W5100 documentation? They are different which is strange for me because W811MJ is based on W5100 right?