Pages: 1 2 [3]   Go Down
Author Topic: Ethernet cleint println() makes new packet every time  (Read 2590 times)
0 Members and 1 Guest are viewing this topic.
Wellington, New Zealand
Offline Offline
Sr. Member
****
Karma: 1
Posts: 404
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you should have success if you keep exploring the option to avoid the "while (readSnCR(s));" statement.

I found the RTR and RCR registers in the wiznet w5100 datasheet.  You can download a copy from here (sparkfun) or from the wiznet website.
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 42
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SOLVED!

In the w5100.h there are two methods:

Code:
void W5100Class::setRetransmissionTime(uint16_t _timeout) {
  writeRTR(_timeout);
}

void W5100Class::setRetransmissionCount(uint8_t _retry) {
  writeRCR(_retry);
}

They are not used anywhere in the Ethernet library, so these get some default values. If you want to change these settings, just modify the begin() function in Ethernet.cpp to:

Code:
void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway, uint8_t *subnet)
{
  W5100.init();
  W5100.setMACAddress(mac);
  W5100.setIPAddress(ip);
  W5100.setGatewayIp(gateway);
  W5100.setSubnetMask(subnet);
 // Add the following two lines:
  W5100.setRetransmissionTime(50); // in milliseconds, 50 is a good value
  W5100.setRetransmissionCount(1); // tries just once
}

Now my Arduino freezes just for 50 millis every 12 seconds, which is acceptable.

Thank you, dhunt for pointing me in the right direction!
« Last Edit: August 03, 2011, 07:50:09 am by mishoboss » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It would be nice to see this added to the official version of the library, with default arguments for the begin method, so that a user could override the default values if desired.
Logged

Pages: 1 2 [3]   Go Up
Jump to: