renatoaloi / EtherEncLib

Ethernet ENC28J60 Library for Arduino
GNU General Public License v3.0
26 stars 14 forks source link

Hanging-up after heavy use (DMA RX Pointer Conflict AND Missing Byte Between Packets) #8

Closed renatoaloi closed 9 years ago

renatoaloi commented 9 years ago

Ok, two issues in one. Just for record.

There is a problem between buffering sent data and receiving packets at same time.

I will need to perform a roll back now so I need to write this down.

The problem is the RX pointer being manipulated between buffering and transmitting the message. When buffering and reaching the end, a send process will occur. That time RX pointer is heavily consumed by DMA copy and cannot be used by the packet receiving system.

So, clear ECON1.RXEN between buffering and closing.

And Set ECON1.RXEN when finish sending packets.


Another bug to work out after roll back is the lost of one byte between packets.

I will need to add this: m_sizePayload++;

To this function: void TcpStack::write(char c)

before: send();

and alter the if statement: if (m_sizePayload < DATA_SIZE_HARDWARE - 1)

ok! Closing this issue soon! Renato

renatoaloi commented 9 years ago

Ok,ok missing byte between packets already implemented and will be commited soon.

But there is A bug. Involves clicking rapdilly on a link, several times. One of these times, the browser will become irresponsive

If you look at Wireshark you will see something like this:

erro_etherenclib

Meaning that Arduino sent ACK (in response for GET request) and refuses to send the HTML packet.

Serial monitor outputs that the packages were sent, but wireshark does not!

Probablly ENC28J60's TX hardware is getting lost somewhere between DMA copy and TX Flush.

Ok, so we have a real BUG!/ Actions? Search and destroy it!

See ya! Renato Aloi

renatoaloi commented 9 years ago

[SOLVED] - Ok, the problem was packets collision, meaning that TX Hardware appears to hang-up when collision occurs.

I have just added a fail-safe, reseting ENC28J60 hardware. That particular request will fail. But ENC28J60 will continue, from start.

Commiting at Newmods branch now.

Renato Aloi