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

Ethernet library fix for avr-gcc v4.5.1 [imported] #605

Closed
cmaglie opened this issue Nov 15, 2012 · 0 comments
Closed

Ethernet library fix for avr-gcc v4.5.1 [imported] #605

cmaglie opened this issue Nov 15, 2012 · 0 comments

Comments

@cmaglie
Copy link
Member

cmaglie commented Nov 15, 2012

This is Issue 605 moved from a Google Code project.
Added by 2011-08-28T17:16:53.000Z by t...@prolectron.com.
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;
}

@cmaglie cmaglie closed this as completed Nov 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant