renatoaloi / EtherEncLib

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

fix checksum calculation neglect #5

Closed ska-la closed 9 years ago

ska-la commented 9 years ago

eliminate a checksum calculation problem..

renatoaloi commented 9 years ago

Hi! How can I replicate the problem?

On 5/25/15, Suchkov K.A. notifications@github.com wrote:

eliminate a checksum calculation problem.. You can view, comment on, or merge this pull request online at:

https://github.com/renatoaloi/EtherEncLib/pull/5

-- Commit Summary --

  • fix checksum calculation neglect

-- File Changes --

M checksum.c (3)

-- Patch Links --

https://github.com/renatoaloi/EtherEncLib/pull/5.patch https://github.com/renatoaloi/EtherEncLib/pull/5.diff


Reply to this email directly or view it on GitHub: https://github.com/renatoaloi/EtherEncLib/pull/5

Serial Link Comunicações e Serviços Ltda (34) 9826-0777 seriallink.com.br

ska-la commented 9 years ago

Yes, today it's not important. As I see you've introduced checksumDMA method (in TcpStack) which involved in returnHttp method, but.. In April i've got a working instance only after appling the patch. I see the checksum method still used at other places of code (inside TcpStack), as so be aware (keep in mind) that it mistakes when deal with odd data chunks and return correct result with even ones. I'd got wrong results with one and three bytes arrays, and correct result with 2,4,.. bytes arrays. Suppose, it can be reproduced with something like: ...

include "checksum.h"

... arr[] = {0xf2,0xb7,0x40}; printf("result: %X\n",checksum(arr,1,2)); printf("result: %X\n",checksum(arr,2,2)); printf("result: %X\n",checksum(arr,3,2)); ...

ska-la commented 9 years ago

I can't reproduce the problem on host computer - it works properly. I've tried to rollback to previous version and to test it on my Arduino board, but Ethernet Shield beign seamed broken. Perhaps, for nearest time i will be futile.. sorry! I have some notes, if it's not abuse i would like to speak out them. Ok?

renatoaloi commented 9 years ago

Nice! Good pick up! There are 3 or 4 different checksum functions, but I think it is heritage from Pascal Stang's code.

I will merge all this stuff we did at master branch this weekend. Thank you for the contribs!

Renato