W5500 LAN vs WAN

Hi,

Working on an embedded webserver – LPC4088 + W5500

Works OK over LAN (Faultless)

If over internet (Even VPN) it stops files at around 33kbytes, occasionally twice that, and infrequently more still.

I could have many bugs in my code, but what I am trying to understand is what is different between TCP over LAN and over WAN.

Any advice appreciated, even if just hints on where to start looking.

Of course 1st suspicion has to be difference in speed, and I’m looking to see how that makes a difference to my code, but I can’t fathom it … If I solve it, I’ll post back …

Cheers

Nije
(In the UK)

Routing of the packets may be different in the LAN (where one or only several intermediate devices are involved) and in WAN (where a lot of devices may play their role, with packets arriving in incorrect sequence).

You must use Wireshark to see what is going on at the W5500 port and why it gets stuck. The obvious cause could be out of order packets.

Hi,

Thanks for that.

Typing-out my query went a long way to solving it. It was time related, and I was sending new data to the TX buffer(s) too quickly.

I haven’t proved it beyond doubt, but it seems highly probable that the W5500 generates a SEND_OK interrupt BEFORE(!) it’s ready to have its Tx buffer over-written.

i.e. I was polling for a SEND_OK before sending new data, and that was failing when done over WAN. Now “doing it” via TX_Free register.

All good when sending quickly over LAN, but gets into trouble with the slower WAN.

Not clear if you have solved the issue by using TX_FSR?
I never used SEND_OK, can not comment. It is intended for interrupts, maybe you are right and there must be some delay before you can send, but most probably you will have to check FSR in your ISR anyway, and wait until you have some free space before sending.