Go Down

Topic: Linux/Windows V0022/1.0 ethernet problem SOLVED (Read 13188 times) previous topic - next topic

westfw

so it WAS  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46779  (or related)??  Wow!

SurferTim

#16
Aug 26, 2011, 06:01 pm Last Edit: Aug 26, 2011, 08:05 pm by SurferTim Reason: 1

so it WAS  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46779  (or related)??  Wow!


I don't know. I did not need to get that deep. As soon as I determined how that code worked, it was easy to troubleshoot. First try did it.
I presumed by the write function above that, it also does the &0xFF with the low byte to insure a clear high byte. If you look at that new code, the read function is pretty much a reverse of the write function.

Edit: The closer I look at that, the more it looks like a case of partial uninitialized variable. A 16 bit variable was assigned an address, but never fully initialized (assigned a value). The read returns only a byte. So the high byte (edit: after the second read in the old code) would still be uninitialized after a read.

sounder030

Hi SurferTim,

I am experiencing the same issues with Mega 2560R2 + Ethernet Shield. I was about to give up until I saw your post. Could you help me understand what steps are exactly necessary to get this fixed? Are any of the code changes checked into githib? If not, could you share with me/us the changed libraries?

Thanks so much in advance,
Sounder030

SurferTim

#18
Aug 30, 2011, 06:31 pm Last Edit: Aug 30, 2011, 06:54 pm by SurferTim Reason: 1
If you are talking about just the ethenet shield fix, that is in
/arduino-0022/libraries/Ethernet/utility/w5100.h
Open that file with a text editor. At about line 253, you will see the "old code" I posted above.
Edit to the "new code" and save.

Add: That is all one line of code to the compiler. Insure the backslashes stay intact at the end of each line. The only line that does not have a backslash is after the last curly brace.


Thomas33


1000 thanks to SurferTim, CodingBadly and westfw. Now it works for me too.

@CodingBadly: Thanks for putting the arguments, why I didn't posted any assumed bugfix without getting any confirmation even on the bug itself. They exactly matches my reasons. Plus my assumed bugfix next day turned out to not really do it :-)


I found it. It was in the w5100.h file starting at line 253 in my version. The new compiler version did not like the old way.


I had (and still have) gcc 4.3.5, and experienced the bug
(I mean the one described in http://arduino.cc/forum/index.php/topic,57972.0.html to avoid confusion). Now I only took your patch from the previous post (w5100.h) and now it works. I did not take earlier mentioned change in socket.cpp.

Even my keep-alive socket connect (for very fast sensor polling) is working now! :)))

If anyone want to see the code (arduino code for the server and java for the client side) just ask for it. I just dont want to flood the board with code nobody wants to see.

Thanks again to you guys!


A mouse is a device to point at the xterm you want to type in.

robindegen

Thanks surfertim for this bugfix! You're the best  ;)

This problem was not only on linux, but also on windows (using the libs in the 1.0 beta zip) It wasnt until i found out that available() always returned 1024 that i could properly google for this issue. I can confirm your fix works with the latest AVR Studio 5 (and underlying avr-gcc) on windows. I'm not using arduino's gui as i could not get it to program at all.

SurferTim

#21
Oct 11, 2011, 07:46 pm Last Edit: Oct 11, 2011, 08:19 pm by SurferTim Reason: 1
Thanks for that report. Maybe we can get a change implemented soon. It has been reported. Maybe if you posted a comment on the change request, it might help. Here is the change request to the Arduino team:
http://code.google.com/p/arduino/issues/detail?id=605&start=200

Add: I also changed the topic on the original post to include Windows. That should help other find this.


lemming

Is this bug fix for W5100.h still required if I am running:

- avr-gcc 4.5.3
- gcc 4.6.1
and Arduino 1.0?

SurferTim


Is this bug fix for W5100.h still required if I am running:

- avr-gcc 4.5.3
- gcc 4.6.1
and Arduino 1.0?

Maybe not. The gcc had a bug that was causing that problem. The symptoms of this problem would be apparent. In my case, it caused client.available() to return a value larger that 1023, so it would never exit a routine like this:
Code: [Select]
while(client.available())
{
   inChar = client.read();
}

It would return the same dozen or so characters over and over forever.

JonandEl

Im wondering if this is the source of my problem (why I can't get my brand new Nanode working on the Ethernet libs).
I need some time to digest all the info you've posted here....

http://arduino.cc/forum/index.php/topic,84160.msg630427.html#msg630427

mellis

I applied the fix listed here: http://code.google.com/p/arduino/issues/detail?id=605

If there are other things that need changing, please open issues for them on the Google code issue list (http://code.google.com/p/arduino/issues/list) so they don't get lost.

SurferTim

Thanks, David. Some here may not know who you are, but I do. Thanks for your efforts to keep this stuff together.  :D

gregoryfenton

I owe you a beer :D

I have been going mad trying to figure out why I was getting corrupt data from my ethernet board yet I could happily ping it.. it made no sense at all - in my mind if I can get data from a ping request I can get data from any other request.

Your one liner fixed it, you absolute beauty \o/

Instructables here I come!!

SurferTim

#29
Mar 11, 2012, 04:51 am Last Edit: Mar 11, 2012, 01:24 pm by SurferTim Reason: 1

I owe you a beer :D

I have been going mad trying to figure out why I was getting corrupt data from my ethernet board yet I could happily ping it.. it made no sense at all - in my mind if I can get data from a ping request I can get data from any other request.

Your one liner fixed it, you absolute beauty \o/

Instructables here I come!!


Instead of a beer, one of which I am currently enjoying, how about going here and submitting a comment that you want the code crew to fix this bug NOW!
http://code.google.com/p/arduino/issues/detail?id=605

edit: Thank you for leaving a comment on the Arduino code page!  :)
Maybe we can get this fixed.

Go Up