Description
This is Issue 605 moved from a Google Code project.
Added by 2011-08-28T17:16:53.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Closed (Fixed).
Original labels: Type-Defect, Priority-Medium, Milestone-1.0.1, Component-Core
Original description
I am using a Linux version compiler.
Arduino V0022
avr-gcc v4.5.1
avr-libc v1.7.1
GCC v4.5.2
Here is the subject at the Arduino forum
http://arduino.cc/forum/index.php/topic,68624.0.html
The ethernet shield failed when I upgraded everything. The value returned by Client::available() was always larger than 1024.
I found the cause to be the 16 bit socket register read function. This is the old code at line 253 of w5100.h:
define __SOCKET_REGISTER16(name, address) \
static void write##name(SOCKET _s, uint16_t _data) {
writeSn(_s, address, _data >> 8);
writeSn(_s, address+1, _data & 0xFF);
}
static uint16_t read##name(SOCKET _s) {
uint16_t res = readSn(_s, address);
res = (res << 8) + readSn(_s, address + 1);
return res;
}
This is the new code that corrected the problem:
define __SOCKET_REGISTER16(name, address) \
static void write##name(SOCKET _s, uint16_t _data) {
writeSn(_s, address, _data >> 8);
writeSn(_s, address+1, _data & 0xFF);
}
static uint16_t read##name(SOCKET _s) {
uint16_t res = readSn(_s, address);
uint16_t res2 = readSn(_s,address + 1);
res = res << 8;
res2 = res2 & 0xFF;
res = res | res2;
return res;
}