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

Register addresses for W5500 are not correct #140

Open
gudnimg opened this issue Jul 16, 2020 · 2 comments
Open

Register addresses for W5500 are not correct #140

gudnimg opened this issue Jul 16, 2020 · 2 comments
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@gudnimg
Copy link
Contributor

gudnimg commented Jul 16, 2020

See #84 I want to break the issue into a smaller part since the original issue has more proposed changes than this.

This issue relates only to the wrong addresses and nothing more. This is important because the Arduino Ethernet Shield 2 uses W5500 chip (no official Arduino shield uses W5100 anymore from what I can tell).

The register addresses for W5500 can be found in the datasheet (v1.0.9) at page 29 / 66 (I posted an image below)


Current w5100.h

__GP_REGISTER16(RTR, 0x0017);      // Timeout address
__GP_REGISTER8 (RCR, 0x0019);      // Retry count
__GP_REGISTER8 (RMSR, 0x001A);     // Receive memory size (W5100 only)
__GP_REGISTER8 (TMSR, 0x001B);     // Transmit memory size (W5100 only)
__GP_REGISTER8 (PATR, 0x001C);     // Authentication type address in PPPoE mode
__GP_REGISTER8 (PTIMER, 0x0028);   // PPP LCP Request Timer
__GP_REGISTER8 (PMAGIC, 0x0029);   // PPP LCP Magic Number
__GP_REGISTER_N(UIPR, 0x002A, 4);  // Unreachable IP address in UDP mode (W5100 only)
__GP_REGISTER16(UPORT, 0x002E);    // Unreachable Port address in UDP mode (W5100 only)

Proposed changes to w5100.h

__GP_REGISTER16(RTR, 0x0019);           // Timeout address
__GP_REGISTER8 (RCR, 0x001B);           // Retry count
__GP_REGISTER8 (PTIMER, 0x001C);        // PPP LCP Request Timer
__GP_REGISTER8 (PMAGIC, 0x001D);        // PPP LCP Magic Number
__GP_REGISTER_N(PHAR, 0x001E, 6);       // PPP Destination MAC address
__GP_REGISTER16(PSID, 0x0024);          // PPP Session ID
__GP_REGISTER16(PMRU, 0x0026);          // PPP Maximum Segment Size
__GP_REGISTER_N(UIPR, 0x0028, 4);       // Unreachable IP address in UDP mode (W5500 only)
__GP_REGISTER16(UPORT, 0x002C);         // Unreachable Port address in UDP mode (W5500 only)
__GP_REGISTER8 (PHYCFGR_W5500, 0x002E); // PHY Configuration register, default: 10111xxx

Notice above how

  • RTR changes from 0x0017 to 0x0019
  • RCR changes from 0x0019 to 0x001B
  • PTIMER changes from 0x0028 to 0x001C
  • PMAGIC changes from 0x0029 to 0x001D
  • UIPR changes from 0x002A to 0x0028
  • UPORT changes from 0x002E to 0x002C
  • New addresses: PSID, PMRU, PHAR

This would fix an issue where setRetransmissionTime() has no effect on W5500. Only problem left to solve is to differentiate between RTR address for W5100 and W5500.

Quick view at the register map for W5500:
image

For comparison here are the W5100 registers

image

@masterx1981
Copy link

Thanks for spotting it. I've asked a pull request with a fix for it.

lathoub added a commit to lathoub/Ethernet that referenced this issue Feb 2, 2021
arduino-libraries#151
arduino-libraries#140

#define MAX_SOCK_NUM 4
#define ETHERNET_LARGE_BUFFERS
lathoub added a commit to lathoub/Ethernet that referenced this issue Feb 2, 2021
@fkromer
Copy link

fkromer commented Aug 27, 2021

Hey guys, when do you plan to merge and release these fixes 😏

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

4 participants