Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENC28J60 stops reacting to network after TCP Retransmission packet #92

Closed
philfreeeu opened this issue Oct 7, 2014 · 7 comments
Closed

Comments

@philfreeeu
Copy link

Hello!

I am using UIPEthernet version 1.07. My arduino sketch implements gets DHCP address and runs one server.
I have 4 clients, that are connecting to that server once per second, send a request, got and answer and disconnect.
It works normally for a few minutes and then ENC28J60 stops to react to incoming TCP connections and also to ARP requests. Arduino code keeps working, it calls Ethernet.maintain(); once per minute and get's 0.

I've made a Wireshark dump of the communication and it looks that this behavour starts when ENC28J60 gets a TCP Retransmission packet. See this image:
2014-10-07-152053_1280x1000_scrot

It does not happen always, e.g. this retransmission happenned some time before and it did not hang:
2014-10-07-153428_1280x1000_scrot

I have the complete Wireshark dump file for this session and can sent it or any other information you may require.

@philfreeeu
Copy link
Author

Adding Ethernet.begin(mac) to run once per minute seems to be a valid workaround - it starts to accept network connection again after it. But it probably be interesting to find the core reason ot this...

@ntruchsess
Copy link
Owner

I'm pretty sure the TCP-retransmits are symptom, not cause.
I've reviewed quite a lot of logs regarding such failure and all I could find so far is the Arduino for some reason eventually does not retrieve any more packets from enc28j60.

Enc28J60Ethernet.receivePacket (https://github.com/ntruchsess/arduino_uip/blob/master/utility/Enc28J60Network.cpp#L156) is called from UIPEthernet.tick() (https://github.com/ntruchsess/arduino_uip/blob/master/UIPEthernet.cpp#L168). One would have to put in some debug-code into Enc28J60Ethernet.receivePacket to see what exactly happens there (register EPKTCNT not incrementing any more or receive-status keeps being invalid?)

@ntruchsess
Copy link
Owner

I have a potential fix for this issue (and #71 #75 #88 #90): f416bf3

So far test is running fine with WebServer.ino from Ethernet-lib executing 4 requests/sec.

To test either checkout UIPEthernet branch 'fix_receive_wraparound' from https://github.com/ntruchsess/arduino_uip/tree/fix_receive_wraparound
or just replace the single file https://github.com/ntruchsess/arduino_uip/blob/fix_receive_wraparound/utility/Enc28J60Network.cpp

@philfreeeu
Copy link
Author

It seems to be more stable with this fix, at least I does not break as fast as it did before. I'll put it for a long-term test to see how it goes.

Thank you for very fast reaction and your support.

@philfreeeu
Copy link
Author

Hi!

  1. It still stops to react to incoming TCP connections. Seems that this happening less frequently, I am not sure. I use Ethernet.begin(mac) once per minute, with that it's more or less fine for my task.

  2. Sometimes (about 5 times less frequent than (1)) my main look hangs in EthernetClient client = server.available(); line. So a Serial.println before that line works, but after that - never does.

This is Arduino Pro Micro - this thing has hardware USB and probably some interrupts for working with that. And I use my interrupt for handling ADC converter results. Possibly that some places in the library are not immune to interrupts - that's just my thougths.

@ntruchsess
Copy link
Owner

fixed in c37970b
see new release 1.08 https://github.com/ntruchsess/arduino_uip/releases

@JoaoPagotto
Copy link

image

Hello dear developers, after analyzing Wireshark I realized that UIPEthernet 2.0.7 and ENC28J60 is generating TCP Retransmissions, I am using it with an Arduino Nano. I open a connection with a TCP server and send and receive packets in a period of 20 packets per second, but with UIPEthernet happens from time to time also lose connection to the server, I have other hardware running in this same way PIC24FJ256GB106 and ENC28J60 with the Microchip TCPIP Stack v5.42.08 stack, and the Arduino Shield W5100, and these TCP Restransmissions problems do not occur. What could it be? If you can guide me in something so I can try to discover this bug in the library and be able to send it to you, any help is welcome. Thank you all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants